-
-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
Add trigger support for files (i.e beforeSaveFile, afterSaveFile, etc.) #6340
Comments
I have already built the beforeSaveFile and afterSaveFile hooks... I still need to write tests for them but I would like to have someone review what I have done and provide any feedback before I go any further. Is the best way to do this to just create a PR? @dplewis |
@stevestencil It looks a good additional to Parse Sever. I'd be happy to review the PR. |
@stevestencil If you already have a branch made I can look at it since I have access to your fork. |
The branch is file-triggers. After sleeping on it I think the fileObject that gets passed into the request should be a Parse.File with base64 data? This would then allow a user to return a different Parse.File with different data or even a Parse.File that has a url (and is already saved)? |
@dplewis @davimacedo Is there any documentation on getting the tests to pass? If I checkout the master branch, run npm install and npm run test, I cannot get them to pass. I would like to contribute more to this project but I feel like i'm chasing my tail with these tests. Thanks! |
I'm not aware of any documentation. I figured out how to pass the tests, the env vars and software versions by checking the Travis Job (for example, https://travis-ci.org/parse-community/parse-server/jobs/637059444). I use to to do like this: In the beggning: export PARSE_SERVER_TEST_TIMEOUT=20000 # in order to avoid the timeouts
npm run pretest Then I run as many times I need: npm run testonly Then in the end: npm run posttest Do you have many tests not passing? Or just few ones? If you want to share them, I can try to figure it out. |
@davimacedo I have a PR in for this feature if you want to review it. I'd love to hear your feedback. |
Is your feature request related to a problem? Please describe.
Currently there is zero authentication or customization of files via hooks.
Describe the solution you'd like
Just like we have beforeSave, afterSave, etc. for Objects. Having the ability for beforeSaveFile, afterSaveFile, etc. would allow for different authentication, validations, file name changes, meta data, etc. when saving files. This would allow the ability to implement a file tracking class that would then allow for easily deleting files from file storage when they're no longer needed.
Describe alternatives you've considered
building my own middleware in front of Parse
Additional context
I have no problem building this!
The text was updated successfully, but these errors were encountered: