Back

How to relationship with files in collections?

  • 0
  • Self Hosted
  • Databases
Onder
12 Jun, 2024, 09:19

I find relatonships are so basic and support many less features than Appwrite's competitors. I can't create relationship with files I can't see buckets in the collections list as well as users.

How can we build a relationship system between files and also users. This is blocking me from going with the appwrite.

I tried supabase self-hosted but jesus, that's not okay for selfhosting. Thankfully appwrite has great self hosting support.

Please help this guy

TL;DR
Developers can create relationships between files and collections in Appwrite by using the files' IDs from storage buckets. This allows for assigning files to specific documents like product catalogs. For public accessibility, consider using permissions on storage buckets or a dedicated collection for user permissions. Appwrite may have basic relationship support compared to competitors, but additional functionalities can be achieved by exploring different approaches.
darShan
12 Jun, 2024, 09:25

There's no built in support for creating relationships among Storage Files x User. What you could do is either use Permissions on Storage buckets, use User Prefs or create a dedicated collection for user with permissions so that only they can access them. You haven't described your usecase so this is just a very basic approach.

Onder
12 Jun, 2024, 09:28

It will be like a product catalog. I want to assign files to each product document including pdfs, sheets and docx files. and same for images png and jpg. those files will be publicly assessible

darShan
12 Jun, 2024, 09:33

I see.. Here's something I've done recently.

Make storage buckets, keep note of their IDs. Use those IDs in your collection for reference.

Example Bucket - PS5 Consoles (id: ps5_consoles)

Example Collection Attribute - bucketId - ps5_consoles.

Then you can list the contents of the bucket as usual.

Onder
12 Jun, 2024, 09:34

yes that is useful thanks

darShan
12 Jun, 2024, 09:41

If your query is resolved, please mark the thread as [SOLVED]. If you have additional queries, make sure to create a new thread.

Happy Appwriting :appwritecheers:.

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