Back

best way to store objects

  • 0
  • General
  • Web
tinfoilht
15 Oct, 2024, 20:06

My apologies in advance for not asking this question correctly, I am teaching myself how to do this

I have looked though discord and it appears that storing object in appwrite is currently not an option.

I see that creating other collection is one option to get beyond this.

these are the interfaces that we currently have in the matches part of out app location: { name: string; address?: string; }; courts: { count: number; reservations: { courtNumber: string; reservedBy: string; // Player ID }[]; }; players: { inGame: string[]; // Array of player IDs waitlist: string[]; // Array of player IDs };

I think the following approach will work, but would like some feed back on how the best way to approach this in appwrite is:

LOCATION: can be set up as a separate collection, and the create a one to one relationship to a location attribute in the Match Collection

COURTS: give the Match collection a court:number attribute then create a Reservation collection with the courtNumber:string and reservedBy as a one to one relations ship with the player collection, or would putting the player ID in this field be better? then create a one to one relationship with a reservation attribute in the match collection

PLAYERS: add inGame and waitList attribute in the Match collection both with a many to one relationship as there will be multiple players in each attribute.

I appreciate any help we can get on this, and if I have not done this correctly in this discord server, please let me know. As I said, I am still learning

TL;DR
The developer is unsure of the best way to store objects in Appwrite. They have considered creating separate collections for locations, reservations, and players. They are seeking feedback on their proposed approach, involving one-to-one and many-to-one relationships between collections. Solution: Based on the provided interfaces, one option is to set up separate collections for locations, reservations, and players, and establish the necessary relationships between them as mentioned in the post.
Reply

Reply to this thread by joining our Discord

Reply on Discord

Need support?

Join our Discord

Get community support by joining our Discord server.

Join Discord

Get premium support

Join Appwrite Pro and get email support from our team.

Learn more