Scheduled file deletions
Automatically deleting files after a set amount of time is interesting.
The desire to have that kind of feature comes both from users and things such as #95 (closed) / #33 (removing a file after 30 days, for example).
It's relatively simple:
with violet:
- create a
scheduled_file_deletes
job queue in violet - let violet do the rest
without violet:
Add afile_delete_jobs
tableAdd a background task at app start that checks every minute (maybe every 5 minutes? idk) on the desired jobsIf a job is already set to be deleted, delete the file described in the job.
this issue is blocking on violet.
Proposal for API
- Add a
users.default_max_retention
column, can be null if the user wants the images to live indefinitely by default.- Means changes in
PATCH /api/profile
as well, so it's best to solve #91 (closed) first before tackling this one.
- Means changes in
- Add an optional
max_retention
query argument in/api/upload
that overrides the givendefault_max_retention
setting. - Add
GET /api/v3/files/pending_deletion
, (?page
,&per_page
, etc.), to show scheduled delete jobs. - Add
DELETE /api/v3/files/pending_deletion/<job_id>
to remove a scheduled delete job.
Proposal for Admin API
I don't know about a valid usecase of this proposal for the Admin API yet, but it would go like this:
Add aPUT /api/admin/admin_delete_jobs
route.Add aDELETE /api/admin/admin_delete_jobs/<job_id>
route.
Edited by Skip R.