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

Enhance #83: Hook functionality #88

Closed
wants to merge 3 commits into from
Closed

Conversation

coxley
Copy link
Contributor

@coxley coxley commented Sep 19, 2015

Commit log

POST to /api/hooks/ works to create new hooks
PUT to /api/hooks/[id]/ works to update existing hooks
DELETE to /api/hooks/[id]/ works to delete existing hooks

User will be inferred from the current authenticated one which
means either in X-NSoT-Email header or Auth_Token.

If trying to POST an existing token, an error similar to the normal
one is returned (HTTP 400 {status: error, error: { message: Hook must be unique, code: 400 } } )

Notes

This is ready to merge, but is lacking unittests therefore don't merge until we have some for it. Still this is progress!

POST to /api/hooks/ works to create new hooks
PUT to /api/hooks/[id]/ works to update existing hooks
DELETE to /api/hooks/[id]/ works to delete existing hooks

User will be inferred from the current authenticated one which
means either in X-NSoT-Email header or Auth_Token.

If trying to POST an existing token, an error similar to the normal
one is returned (HTTP 400 {status: error, error: { message: Hook must be unique, code: 400 } } )
@coxley
Copy link
Contributor Author

coxley commented Sep 19, 2015

* Linking this to #83 *

ModelClass = self.Meta.model
validated_data['user'] = self.context['request'].user
try:
obj = ModelClass.objects.create(**validated_data)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would prefer that we still call the parent's .create() (e.g.obj = super(HookCreateUpdateSerializer, self).create(validated_data)) here, because it's doing more than just calling the model's .create() method. Everything else is great!

@coxley
Copy link
Contributor Author

coxley commented Nov 6, 2016

This is stale and using a not-really-maintained fork of django-rest-hooks

@coxley coxley closed this Nov 6, 2016
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.

2 participants