SENG480a-NutriDine / mobile

The mobile app
Apache License 2.0
0 stars 0 forks source link

Data Modelling #4

Closed johnmck95 closed 7 months ago

johnmck95 commented 8 months ago

In Firebase, you have collections that contain documents

In this ticket we need to plan out our data, the relationships between collections/documents, and specifically make sure we are able to query the correct data based on business needs. Keep in mind you cannot perform joins in firebase. There are great tutorials on how to model data on youtube, lets check them out.

Some things to keep in mind

While it is convenient to store foreign keys on docs, keep in mind this might put us in a situation where we need to fire an initial query to get the foreign key, then a second query to get the data we actually care about. Firebase synchronously generates uids for each doc, so please read up on how we can do this efficiently. If we mess it up, we'll burn through our allowed usage and either get denied service or end up with a bill. DB reads/writes/mutations are important!

Once the data is modelled, lets make some TypeScript types to enforce correctness in the mobile app.