From 1c08ab2a631d2400940e0ca037ba2f7b5bc57e3a Mon Sep 17 00:00:00 2001 From: Abdul Rahman Reza Date: Mon, 20 Jan 2025 09:12:01 +0700 Subject: [PATCH] add parameter application on api reset password --- src/controllers/auth.ts | 17 +++++++++++++++-- src/routes/public.ts | 2 +- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/src/controllers/auth.ts b/src/controllers/auth.ts index 38d0b10..e6cfd8d 100644 --- a/src/controllers/auth.ts +++ b/src/controllers/auth.ts @@ -257,17 +257,24 @@ export class AuthController { static async resetPassword(req: Request, res: Response, next: NextFunction): Promise { /* #swagger.tags = ['Auth'] - #swagger.parameters['email'] = { + #swagger.parameters['email'] = { in: 'path', description: 'Email', required: true, type: 'string' } + #swagger.parameters['application'] = { + in: 'path', + description: 'Application', + required: true, + type: 'string' + } */ try { const schema = Joi.object().keys({ email: Joi.string().email().required().label('Email'), + application: Joi.string().required().label('Application'), }); const param: User = await schema.validateAsync(req.params); @@ -321,12 +328,18 @@ export class AuthController { static async renewToken(req: Request, res: Response, next: NextFunction): Promise { /* #swagger.tags = ['Auth'] - #swagger.parameters['refresh_token'] = { + #swagger.parameters['refresh_token'] = { in: 'path', description: 'Refresh Token', required: true, type: 'string' } + #swagger.parameters['application'] = { + in: 'path', + description: 'Application', + required: true, + type: 'string' + } */ try { const schema = Joi.object().keys({ diff --git a/src/routes/public.ts b/src/routes/public.ts index 29de73a..b7b578e 100644 --- a/src/routes/public.ts +++ b/src/routes/public.ts @@ -9,7 +9,7 @@ export class RoutePublic { app.use(Language.apply); app.post('/api/login', AuthController.login) - app.put('/api/reset_password/:email', AuthController.resetPassword) + app.put('/api/reset_password/:email/:application', AuthController.resetPassword) app.put('/api/update_password/:token', AuthController.updatePassword) app.put('/api/logout/:refresh_token', AuthController.logout) app.put('/api/renew_token/:refresh_token/:application', AuthController.renewToken)