
Hi, I'm building a gym app tracker.
I want the app to have Routines that contain Sessions and these contain exercises (That is like a starter for the user), and the track info to be on different collections "training day" that is related to "exercise training" and contains an exercise, reps and weight. When I say contains, I refer that have one attribute in relation to another collection.
I have problems with permissions. I understand that the default info (for all users) needs to read document permissions for all users, and then, have turned on the document permission and not collection, but I want users can share routines (Via url or ID), so, I didn't know how to handle that. Also, I would like in the future to add a trainer type of user that can see the training days of the users (Not all, only their trainees), and have a "Routines hub" where trainees can see the routines that the trainer creates and shares. I think that this can be solved with teams, but I don't know how to give teams permission to single documents.
What should be the permissions and is my structure correct?
Thanks in advance and sorry for my English, not native.

Hi, there's several questions here let me break them down.

Sharing exercises with other users:
This can be done a few ways. You can use teams, when sending invites, update their permissions by adding them to the "team" attached to a routine.
You can use an Appwrite Function to add individual permissions to a document or set of documents, and call it from the inviter to add the invitee's ID to document permissions.
You can also generate a long UUID, like a "secret" that isn't exposed to user and is only accessible to Appwrite's Server SDKs. This lets you share a routine by this sercret ID. When a user invites another user, they call and "invite" Appwrite Function, which returns a secret ID that they can pass to another user. When a user accepts the invite, they can call another Appwrite function with the secret ID, the Appwrite function looks up the collection by secret ID, adds their user into the permissions of that routine.
The solution will be some combination of these different approaches.

Also, I would like in the future to add a trainer type of user that can see the training days of the users (Not all, only their trainees)
This is done with teams and roles.
Team for each trainer,
Trainers have the trainer role within teams
Only people from a specific team with role trainer can see training days 🙂

So you'd just update permissions of a specific document with Role.team(TRAINER_ID, TRAINER)
Recommended threads
- 2 Columns still processing since yesterd...
Hey o/ Yesterday (around <t:1758045600:f>), I created a database and added several columns to it. After about 15 minutes, most of the "processing" tags disappe...
- 503 Timeout when Updating or Upserting D...
Hey I’m running into an issue when trying to update or upsert a row in Appwrite. The request hangs for a while and then throws this error: ``` AppwriteException...
- Row with the requested ID already exists...
I’m hitting a blocking issue creating rows in Appwrite (both from the console and my React Native app). After successfully inserting the first row, every subseq...
