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

How do I access to beforeSave's request and response objects? #5

Open
fatuhoku opened this issue Dec 10, 2015 · 1 comment
Open

How do I access to beforeSave's request and response objects? #5

fatuhoku opened this issue Dec 10, 2015 · 1 comment
Labels

Comments

@fatuhoku
Copy link

It looks like ParseMockDB.registerHook expects a promise, even though regular Cloud Code beforeX handlers are of type function(request,response). The contract should be identical to Cloud Code's for fidelity. callbacks are a pain!

EDIT: Okay, instead of function(request,response), how about we replace the response part with promise syntax, but leave the request as a parameter: i.e. function(request).

Check the Parse.Object docs. Most *Request types are the same as each other and the *Response types are the same as each other too:

Parse.Cloud.AfterDeleteRequest
Parse.Cloud.AfterSaveRequest
Parse.Cloud.BeforeDeleteRequest
Parse.Cloud.BeforeDeleteResponse
Parse.Cloud.BeforeSaveRequest
Parse.Cloud.BeforeSaveResponse

Note: some assumptions have to be made about the masterKey.

@fatuhoku fatuhoku changed the title How do I access to beforeSave request and response objects? How do I access to beforeSave's request and response objects, as well as afterSave's request object? Dec 10, 2015
@fatuhoku fatuhoku changed the title How do I access to beforeSave's request and response objects, as well as afterSave's request object? How do I access to beforeSave's request and response objects? Dec 10, 2015
@yutin1987
Copy link
Contributor

+1, following:

Parse.Cloud.AfterDeleteRequest
Parse.Cloud.AfterSaveRequest
Parse.Cloud.BeforeDeleteRequest
Parse.Cloud.BeforeDeleteResponse
Parse.Cloud.BeforeSaveRequest
Parse.Cloud.BeforeSaveResponse

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

No branches or pull requests

3 participants