-
Notifications
You must be signed in to change notification settings - Fork 3
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
♻️ Formatting responses and abstracting out some of the models #30
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks good
'message': 'person deleted', | ||
'content': {'persons': [person]}}, 200 | ||
|
||
return kf_response(person, 200, 'person deleted') | ||
|
||
def _not_found(self, kf_id): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One test is failing: test_get_not_found in tests > person > test_resources.
Change this method to the following to fix:
def _not_found(self, kf_id):
"""
Temporary helper - will do error handling better later
"""
return kf_response(code=404,
message='person with kf_id \'{}\' not found'.
format(kf_id))
Since the kf_response method already returns the tuple: (result dict, status code), we can just return the result of kf_response.
dataservice/api/person/resources.py
Outdated
from dataservice.api.person.serializers import (person_model, | ||
response_model) | ||
from dataservice.api.person.serializers import ( | ||
person_model, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
person_model
looks like its no longer used in this file
832d757
to
886193e
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great, see file comments for requested changes
0e5d0f4
to
110754d
Compare
110754d
to
79796e9
Compare
79796e9
to
c1e82c3
Compare
♻️ Formatting responses and abstracting out some of the models
Draws out some of the base models and establishes the common response formats.
TODO:
General test to test that all endpoints match this format