-
Notifications
You must be signed in to change notification settings - Fork 1
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
[Closes #45] Admin/Staff/Volunteer can search allergy/medication/condition data #70
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.
Hi @samau3 welcome back...!
I was out of town for a few weeks but I'm back and have taken a look here...
This is looking good! A few more changes...
Right now you're only selecting the name to be returned in the results, I think we should return all the attributes of the corresponding object (id, name, type, system, code, etc) so that the caller has everything they might need.
For the pagination, you're manually specifying the take parameter, doing the count, and formatting a string with the results. However, there are some pagination helpers that have since been added into the codebase that you can use instead.
See server/routes/api/v1/users/list.js
for an example of how these helpers are used. The query helper is in server/prisma/client.js
and the response helper (which sets the pagination values in headers) is in server/plugins/pagination.js
. This implementation is based on how the Github does their pagination in their REST APIs (https://docs.github.com/en/rest/using-the-rest-api/using-pagination-in-the-rest-api)
Thanks for the feedback @francisli!
I've updated all the three routes to return all attributes instead of just the
I've updated the routes to use the helpers rather than the manual formatting I had before. |
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.
Awesome! Great work...!
Closes #45.
This PR creates three protected routes that correspond to querying the allergy, medication, and condition tables of the database.