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

Multiple improvements for Insert and hooks. #8

Closed
wants to merge 15 commits into from

Conversation

Kostanos
Copy link
Contributor

  • Added possibility to fill the response body from hook
  • Return Inserted row response as JSON in body
  • Open access to parent (pgRestigy) instance from inside the hooks, so pgRestify helpers or other methods could be used.

@coveralls
Copy link

Coverage Status

Coverage decreased (-2.09%) to 97.193% when pulling 5442435 on Kostanos:master into 69c46aa on acarl:master.

1 similar comment
@coveralls
Copy link

Coverage Status

Coverage decreased (-2.09%) to 97.193% when pulling 5442435 on Kostanos:master into 69c46aa on acarl:master.

@coveralls
Copy link

coveralls commented Oct 11, 2017

Coverage Status

Coverage decreased (-2.09%) to 97.193% when pulling 5442435 on Kostanos:master into 69c46aa on acarl:master.

@acarl
Copy link
Owner

acarl commented Oct 18, 2017

I think that this should be broken up into several separate pull requests.

  1. adding a parent to pgHooks
    I think it would be better not to do this if we can avoid it. Right now a Hooks instance stands on it's own and could potentially be used for multiple separate PgRestify instances. Could you provide a use case that could only be resolved by adding the parent property?

  2. skipping execution if res.pgRestifyResponseBody has already been set
    I agree that this would be useful. We should go ahead and apply it to all the methods.

  3. changing the value returned by POST
    By default I would like pgRestify to return the minimal response and if users want to provide additional data they can add it through hooks. Maybe we could add the db response as a new attribute of res and then allow a post hook to use it to generate an alternate pgRestifyResponseBody. That way we allow users to use whatever part of the database response they want.

For the next pull request make sure that the tests pass as well. You can just run "grunt" from your terminal to make sure they all pass.

@acarl acarl closed this Oct 18, 2017
@Kostanos
Copy link
Contributor Author

  1. the parent is needed to us the helpers that defined there. Otherwise these helpers should be separated apart.
  2. Good
  3. The confirmation of insert or update request is essential. Knowing the inserted row ID (not only the URL that pg-restify returns on header), knowing the number of updated rows, etc... those are the most important info, that is currently missing on POST and PUT.

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

Successfully merging this pull request may close these issues.

3 participants