From bf70e703e1fdadeb2ab67ccb0cc36e489e53753f Mon Sep 17 00:00:00 2001 From: Brayo Date: Thu, 22 Aug 2024 21:22:48 +0300 Subject: [PATCH] docs: document the firestore data model --- src/firebase/data.ts | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/firebase/data.ts b/src/firebase/data.ts index 55b648b..a0c3532 100644 --- a/src/firebase/data.ts +++ b/src/firebase/data.ts @@ -5,8 +5,14 @@ // - A collection called `screentime` // - Each document in the collection is keyed by the user's ID // - Each document has a collection of days, which each have an array of events for that day -// - A collection called 'leaderboard' -// - +// - A collection called `leaderboard` +// - Each document in the collection points to a nested user collection +// - Each user collection has docs keyed by the ISO date of the data contained within. +// - Each user collection doc is of type `ScreenTimeSummaryRanked` which is just ScreenTimeSummary +// with an extra rank field +// - A collection called `users` +// - Each document is keyed by the user's uid +// - Each document contains an apikey import { db } from './firebaseInit' import {