twenty
twenty copied to clipboard
Handle deletion of files
Scope & Context
We have currently multiple spots where we create and delete files:
- Workspace image
- profile image
- attachments
- people pictures
- ...
Current behavior
Deletion of files at the moment only deletes the records and forgets the file. But the file is still remaining in the storage.
Expected behavior
To prevent storing unnecessary files - they should be deleted.
I can work on this @FelixMalfait
Thanks @pacyL2K19 - I haven't looked into it but this might not be an easy one. I'd probably do something listening to the deletion event?
Here is the GitStart Ticket for this issue: https://clients.gitstart.com/twenty/5449/tickets/TWNTY-2738
Still accurate
This should be a listener based on the hard-deletion of the Attachment object.
Additionally, once we have soft-delete, we should probably setup a cron, as the process will look like this:
- When a person deletes an attachment it is soft-deleted
- Maybe one day, user will also be able to view the trash/empty the trash directly in the ui (once we implement soft delete)
- For attachments, we'll have a cron that "empties" the trash, i.e. look at deletedAt and delete the recored over 1 week old for example.