I am trying to create a fitness app wherein I have created two apps sharing the same database.
Since I cannot have two Users Collection, I am using a common one for both with a True/False field
Both the apps should follow the following logic for operation
- The user registers onto the app, and the same gets updated in the “User Collection”
- The gym owner registers onto the app, and the same gets updated in the “User Collection”
- Now, the gym owner will link the user with his gym. This should only happen if both (user and gym) are already registered.
How can I do this ? Not getting any idea on how should I design the database for this ?
Hi @Nitish ,
In users collection,you should have 2 relationship fields to gym, as owner and as gym-goer.
Adalo allows us to have many relationship fields to the same collection, or even recursive, to itself, from users to users.
I do not have a gym collection
Do you mean I should have one user collection, and two relationship fields as owner and gym-goer ?
Also, how do I do the verification in that case ? (i.e. registering the gym-goer against gym owner) ?
Hi @Nitish ,
Clone this app and see its collections,
Sets and Reps (adalo.com)
I have too many cloneable apps now, so I think recycling some apps that are related to the topic could be useful.
Ignore the sets and exercise collections.
Hey @Yongki, thanks for this. I got partial answer to my query.
However, not understanding how can I set a validation?
As there are two apps (gym owner’s app and gym goer’s app), I want whenever a gym owner adds a gym goer, the app should first check in the database if gym-goer is present. If yes, update his gym name
Note - The gym owner adds gym-goer by typing his mobile number.
How can I do this ?
You can add additional screen to add gym name, I just made this an example, so I just add directly from collection editor.
And about phone number, you can use simple list and display phone number so it can be become searchable and then have action to update gym with add current user.
Yes thanks @Yongki this worked