Skip to content

Instantly share code, notes, and snippets.

@RichardSPrins
Created June 26, 2020 19:19
Show Gist options
  • Save RichardSPrins/0cc0684cd94dc0b6839df91244ada1b2 to your computer and use it in GitHub Desktop.
Save RichardSPrins/0cc0684cd94dc0b6839df91244ada1b2 to your computer and use it in GitHub Desktop.
**
* @apiDefine changePassParams
* @apiParam {String} oldPassword Old password
* @apiParam {String} newPassword New Password
* @apiParam {String} confirmPassword Also new Password
*
* @apiParamExample Body Params:
* {
* "oldPassword": "123456",
* "newPassword": "654321",
* "confirmPassword": "654321"
* }
* */
/**
* @apiDefine errorExample
* @apiError (Error 400) WrongPassword Wrong old password
* @apiError (Error 401) Unauthorized error
*
* @apiErrorExample Special:
* HTTP/1.1 400 Bad Request
* {
* "message": "Wrong password",
* "status": 400,
* "errors": []
* }
* HTTP/1.1 401 Unauthorized
* {
* "message": "Unauthorized",
* "status": 401,
* "errors": []
* }
* */
/**
* @apiVersion 1.0.1
* @api {patch} password/change Change user password
* @apiDescription Change password and returns user
* @apiName changePassword
* @apiGroup Password
* @apiPermission User
*
* @apiSuccess (20x) {String} _id Unique user id. UUID V4
* @apiSuccess (20x) {String} email Unique user email
* @apiSuccess (20x) {String} model Candidate or Recruiter
* @apiSuccess (20x) {String} registerAt Date of register
* @apiSuccess (20x) {String} visitedAt Date of last visit
* @apiSuccess (20x) {String} isRejected Whether register was rejected
* @apiSuccess (20x) {String} isApproved Whether register is approved
*
* @apiUse changePassParams
*
* @apiSuccessExample {json} Success-Example
* {
* "_id": "54f2ead7-e98c-4a4e-8a5b-354ff7f87d20",
* "email": "[email protected]",
* "model": "Candidate",
* "registerAt": "2016-09-08T10:59:49.002Z",
* "visitedAt": "2016-09-08T10:59:53.436Z",
* "isConfirmed": true,
* "isRejected": false,
* "isApproved": true,
* "__v": 0
* }
*
* @apiUse ErrorBlock
* @apiUse errorExample
*
* @apiSampleRequest off
*/
router.patch('/change', access.for(ROLE.MEMBER), passwordHandler.change);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment