Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Global app filesystem hooks for upload/delete of file #2387

Open
ganigeorgiev opened this issue Apr 30, 2023 · 6 comments
Open

Global app filesystem hooks for upload/delete of file #2387

ganigeorgiev opened this issue Apr 30, 2023 · 6 comments

Comments

@ganigeorgiev
Copy link
Member

ganigeorgiev commented Apr 30, 2023

This was partially discussed in #2386

We could add generic app level filesystem hooks when uploading or deleting file.
These hooks should not be dependent on the current http api request (or the Record model), but will fire on every upload/delete action of the filesystem created from app.NewFilesystem() (similar to how we fire the db model hooks when changes are done through app.Dao()).

Possible hooks:

OnFileBeforeUpload()
OnFileAfterUpload()
OnFileBeforeDelete()
OnFileAfterDelete()
@ganigeorgiev ganigeorgiev changed the title Add app filesystem hooks for upload/delete of file [#2386] Global app filesystem hooks for upload/delete of file Apr 30, 2023
@gedw99
Copy link

gedw99 commented Apr 30, 2023

👍 thanks @ganigeorgiev

@navaneeth-dev
Copy link

What about OnFileAfterDownloadRequest ?
I am using protected file, I want to delete after download

@ganigeorgiev
Copy link
Member Author

@navaneeth-dev The suggested hooks are independent from the api requests.
I don't have the full picture of your use case to understand what you are trying to do, but if you want to delete a file after serving it to a client response, you can attach a global echo middleware OR attach to the before download hook and fire a go routine that will delete the record associated with the file.

@perostlin
Copy link

This would be great! With these in place we would be able to add other cloud storage options, e.g. Cloudinary. 👌

Cloudinary provides a really good free tier.

@gedw99
Copy link

gedw99 commented Sep 1, 2023

Go CDK might be a good option then if you want to support cloud storage

@Meraj
Copy link

Meraj commented Feb 22, 2024

I would love to build this feature, if it is okay

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Backlog
Development

No branches or pull requests

5 participants