Hello all,
I have two tables in Supabase that define a user's created post in my app. One table is the user_post table (parent) and the other is user_post_media which houses the image and video info in a column field called media_url. On deletion of rows in the user_post_media table I'm trying to cascade delete the associated/matching URL's in my storage bucket folder. I understand you can do this one at a time in Flutterflow but that seems to be a poor user experience if a user just wants to delete the entire post. I'm trying to prevent the lingering of unused media items in my Supabase bucket folder. It seems clear to me that this can't be automated through sql query functions/triggers in Supabase but that it may be doable with third party integrations for Webhooks and rest API nodes?
Supabase docs list this for storage item deletion as an example of how to do it.
"
const { data, error } = await supabase .storage .from('avatars') .remove(['folder/avatar1.png'])"
I've tried setting this up with a webhook to BuildShip but I can't quite get it right to execute the storage removal. Any help on how to achieve this and prevent junk storage items from remaining in my folders would be appreciated!
-Connor