-
Notifications
You must be signed in to change notification settings - Fork 0
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
80 create endpoints for activity type #107
base: develop
Are you sure you want to change the base?
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.
@TonyPython0505 Can you also add test suites for these routes? Include creating existing resource and updating new resource along with normal test suites. Reach out if that seems confusing
server/routes/ActivityType.route.js
Outdated
|
||
/////////////////////////// Routes /////////////////////////// | ||
router.route('/all') | ||
.get(activityTypeController.getAllActivityTypes); |
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.
Will need API_KEY verification called before crud operations can run for all routes
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.
Done with JWT instead.
… tests for activity type routes
if (err) { | ||
return res.status(400).send({message: `Failed to save new activity type. ${err}`}); | ||
exports.create = (req, res) => { | ||
if (JWTVerifier.verifyStaffToken(req.body.token, process.env.STAFF_SECRET_KEY)) { |
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.
This function can be called as middleware where the route is defined. More about middleware functions: https://reflectoring.io/express-middleware/
icard example: https://github.com/UofA-Blueprint/ICard/blob/develop/backend/src/routes/Students.js#L63 (notice how verifyApiKey is called before the actual getStudent controller is called in the route definition).
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.
If you decide to make this change, please also change all other endpoints accordingly.
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.
Done
Created a new schema model for Activity Type. Wrote endpoints for getting all existing activity types, creating a new activity type, updating and deleting an existing activity type.