From 11b616f2999c2cb21f2cf49a1b0a5ea9d5b7e353 Mon Sep 17 00:00:00 2001 From: Muhammad Mustafa Date: Sat, 20 Feb 2021 02:46:35 +0500 Subject: [PATCH] Swagger docs for email verification --- .vscode/launch.json | 29 ++++++++++++++---- package.json | 1 - src/routes/v1/auth.route.js | 59 +++++++++++++++++++++++++++++++++++++ 3 files changed, 82 insertions(+), 7 deletions(-) diff --git a/.vscode/launch.json b/.vscode/launch.json index 265b8053..099c97b4 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -7,11 +7,28 @@ { "type": "node", "request": "launch", - "name": "Launch via Yarn", - "runtimeExecutable": "yarn", - "cwd": "${workspaceFolder}", - "runtimeArgs": ["start:debug"], - "port": 5858 - } + "name": "nodemon", + "runtimeExecutable": "nodemon", + "program": "${workspaceFolder}/app.js", + "restart": true, + "console": "integratedTerminal", + "internalConsoleOptions": "neverOpen", + "env": { + "NODE_ENV": "development" + }, + "skipFiles": [ + "/**" + ] + }, + // { + // "type": "node", + // "request": "launch", + // "name": "Launch via Yarn", + // "runtimeExecutable": "yarn", + // "cwd": "${workspaceFolder}", + // "runtimeArgs": ["start:debug"], + // "port": 5858 + // } + ] } \ No newline at end of file diff --git a/package.json b/package.json index 1ff09628..57906a09 100644 --- a/package.json +++ b/package.json @@ -13,7 +13,6 @@ "scripts": { "start": "pm2 start ecosystem.config.json --no-daemon", "dev": "cross-env NODE_ENV=development nodemon src/index.js", - "dev:debug": "nodemon --inspect-brk=5858 src/index.js", "test": "jest -i --colors --testEnvironment=node --verbose --coverage --detectOpenHandles", "test:watch": "jest -i --watchAll", "coverage": "jest -i --coverage", diff --git a/src/routes/v1/auth.route.js b/src/routes/v1/auth.route.js index 5c778df0..385b091a 100644 --- a/src/routes/v1/auth.route.js +++ b/src/routes/v1/auth.route.js @@ -257,3 +257,62 @@ module.exports = router; * code: 401 * message: Password reset failed */ + +/** + * @swagger + * path: + * /auth/verification-email: + * post: + * summary: verification-email Email + * description: An email will be sent to verify email. + * tags: [Auth] + * security: + * - bearerAuth: [] + * requestBody: + * required: true + * content: + * application/json: + * schema: + * type: object + * required: + * - email + * properties: + * email: + * type: string + * format: email + * example: + * email: fake@example.com + * responses: + * "204": + * description: No content + * "404": + * $ref: '#/components/responses/NotFound' + */ + +/** + * @swagger + * path: + * /auth/verify-email: + * post: + * summary: verify email + * tags: [Auth] + * parameters: + * - in: query + * name: token + * required: true + * schema: + * type: string + * description: The verify email token + * responses: + * "204": + * description: No content + * "401": + * description: verify email failed + * content: + * application/json: + * schema: + * $ref: '#/components/schemas/Error' + * example: + * code: 401 + * message: verify email failed + */