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

Add trigger support for files (i.e beforeSaveFile, afterSaveFile, etc.) #6340

Closed
stevestencil opened this issue Jan 13, 2020 · 7 comments · Fixed by #6344
Closed

Add trigger support for files (i.e beforeSaveFile, afterSaveFile, etc.) #6340

stevestencil opened this issue Jan 13, 2020 · 7 comments · Fixed by #6344
Labels
type:feature New feature or improvement of existing feature

Comments

@stevestencil
Copy link
Contributor

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!

@stevestencil stevestencil changed the title Add trigger support for files Add trigger support for files (i.e beforeSaveFile, afterSaveFile, etc.) Jan 13, 2020
@stevestencil
Copy link
Contributor Author

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

@davimacedo
Copy link
Member

@stevestencil It looks a good additional to Parse Sever. I'd be happy to review the PR.

@dplewis
Copy link
Member

dplewis commented Jan 14, 2020

@stevestencil If you already have a branch made I can look at it since I have access to your fork.

@dplewis dplewis added the type:feature New feature or improvement of existing feature label Jan 14, 2020
@stevestencil
Copy link
Contributor Author

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)?

@stevestencil
Copy link
Contributor Author

@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!

@davimacedo
Copy link
Member

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.

@stevestencil
Copy link
Contributor Author

@davimacedo I have a PR in for this feature if you want to review it. I'd love to hear your feedback.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type:feature New feature or improvement of existing feature
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants