Imagine a situation - a user deletes a file from storage, but during the procedure the Internet is turned off, and although the file is deleted, the mention of ITS FILE ID in other documents remains and users may encounter problems. What to do in such cases? Is it possible to check if a File/Document exists in an Appwrite project?
There's a lot of ways to go about this, but the best way would be to use an appwrite function.
To make sure I understand you correctly, you have a file who's File ID is in document. This document may or may not have other details of the file. Regardless, you can create a function that runs when the buckets.*.files.*.delete event is triggered.
This function would get the details of the file that was deleted in an environment variable. Use these details to get the File ID, and perform any operations you want - delete a document, update a user preference, etc.
For more details about Appwrite Functions, have a read through the guide: https://appwrite.io/docs/functions
Recommended threads
- Relation Question
How do I create a relation from table y to an others x.$id. in my example I have a users table where I use Appwrites unique User IDs and I want other tables fo...
- Unknown attribute type: varchar / text
Since the `string` type is deprecated I tried using `varchar` and `text` in some newer tables, but when running `appwrite pull tables && appwrite types ./src/li...
- I'm experiencing a critical bug on Appwr...
Hey <@870607367597850624> team / support 👋 I'm experiencing a critical bug on Appwrite Cloud that's blocking my production Flutter app. I've already filed GitH...