Open tbeidlershenk opened 9 months ago
https://firebase.google.com/docs/database/flutter/structure-data https://firebase.google.com/docs/firestore/data-model
These pages might be helpful ^
Even though Firebase is document based in a NoSQL format we are basically using it relationally because each of our collection entries follows the same format.
UPPERCASE signifies a collection lowercase is just regular data (string, timestamp, etc.) or a reference to another document
How we currently have it with my changes on lost-at-pitt-dev database:
├── USERS
│ ├── POSTS
│ │ ├── item
│ ├── first_name (string)
│ ├── last_name (string)
│ ├── location (geopoint)
├── CONVERSATIONS
│ ├── MESSAGES
│ │ ├── from (string)
│ │ ├── message (string)
│ │ ├── time_sent (timestamp)
│ ├── found_user ~ reference to document in USERS
│ ├── lost_user ~ reference to document in USERS
│ ├── item ~ reference to document in FOUND or LOST
│ ├── time_created (timestamp)
├── FOUND
│ ├── description (string)
│ ├── item_name (string)
│ ├── location (geopoint)
│ ├── phone (number)
│ ├── picture (number)
├── LOST
│ ├── description (string)
│ ├── item_name (string)
│ ├── location (geopoint)
│ ├── phone (number)
│ ├── picture (number)
└──
However I think we should move to a Item collection in order to reduce duplication between Found and Lost. This will be useful because in the Posts collection for each user we can just reference an item in this collection.
We can use a boolean flag to signify if the item was found or lost. I didn't make these changes because existing code relies on it.
We should also remove phone because we will be implementing a chat system.
├── ITEM
│ ├── description (string)
│ ├── item_name (string)
│ ├── location (geopoint)
│ ├── picture (number)
│ ├── lost (boolean)
└──
Accidentally closed issue, this is not completed as of yet
Updated schema with what should be the correct naming convention at this point.
├── users
│ ├── posts
│ │ ├── item
│ ├── firstName (string)
│ ├── lastName (string)
│ ├── location (geopoint)
├── conversations
│ ├── messages
│ │ ├── from (string)
│ │ ├── message (string)
│ │ ├── timeSent (timestamp)
│ ├── foundUser ~ reference to document in USERS
│ ├── lostUser ~ reference to document in USERS
│ ├── item ~ reference to document in FOUND or LOST
│ ├── timeCreated (timestamp)
├── FOUND
│ ├── description (string)
│ ├── itemName (string)
│ ├── location (geopoint)
│ ├── phone (number)
│ ├── picture (number)
│ ├── timeCreated (timestamp)
├── lost
│ ├── description (string)
│ ├── itemName (string)
│ ├── location (geopoint)
│ ├── phone (number)
│ ├── picture (number)
│ ├── timeCreated (timestamp)
└──
Keeping open until we implement conversations
collection as a part of Chat system
Items should have
datetime
- Time submittedboolean
- whether the item was successfully returned or not yetstring
- User UID that submitted the postUpdate the
PostPage
UI to include 1) and 3) probably not 2) because we'll just not display the post if it's been returned Update Firebase for both dev and prodDo we need User document storage as well to store user data? like PFP and other settings? especially once we work on user messaging and we have to store chat logs for a period of time. @jeffzheng13