I’m trying to create an app which a PT will use to set workouts for their clients. To do this, I’m trying to set up a parent/child structure in realtimeDB.
This way, when a PT logs in, they can create a list view at the PERSONAL TRAINER level so that they can see all of their clients’ details, and add workouts and other data.
If a client logs in, they will see only their data and whatever additional data a PT has set for them.
What I am trying to achieve
The ideal will be -
- User is invited to use the app (I want a closed beta initially)
- If they’re a returning user, they’ll simply authenticate then go into the app, where they see the data that their user type should have access to
- If they’re a new user, their authentication details will be used to set up a new entry into the database at the correct level
What I’ve done so far
I was going to put screenshots too, but I have a max 3 images per post as a new user… Let me know if you want to see them.
Determine whether this is a new or returning user and direct them to the correct place. This isn’t how I wanted to do it, but I guess it works…
Create a new record for a PT
Create a new record for the Client, which saves under PT name which they provide, but it will create a new PT
Where I am stuck/What I’ve tried
I simply don’t understand how to query the realtimeDB for a match on the user’s details, and I can’t find any articles about running a query on realtimeDB.
Does anyone have any suggestions?