Firestore database setting up data structure

I managed add authentication to my app. The next step is to store some data in de database (not the realtime database but cloud firestore).

I am building a simple workout app for a couple of people. What I want:

  • User can enter the workout-types with the fields:
    • Name (“Leg press”)
    • Weight (“40kgs”)
    • Note (“Some additional information”)

then when in the gym they can log what they did:

  • Workout date
  • Choose workout-types with details from above

Nobody is allowed to see workout-types and the workouts from other users.

I understand i can make collections and add documents but for now I can’t figure out how to structure this in Firestore.

Hi!

Not sure if you need help anymore as it’s been almost a week but here’s one way of structuring it:

Exercise

  • id (text)
  • Name (text)
  • Weight (number)
  • Note (text)
  • User id (text)

Workout

  • id (text)
  • Date (datetime text)
  • User id (text)
  • Workout id (text)

Thanks! That’s how I structured it.

1 Like