Skip to content

Commit

Permalink
feat(email-integration): implement email integration
Browse files Browse the repository at this point in the history
- add swagger documentation

[Delivers #4]
  • Loading branch information
jkarenzi committed Jun 13, 2024
1 parent bba78d9 commit 26d7ee9
Show file tree
Hide file tree
Showing 2 changed files with 124 additions and 0 deletions.
9 changes: 9 additions & 0 deletions docker-compose.test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,18 @@ services:
build:
context: .
dockerfile: Dockerfile.test
environment:
JWT_SECRET: ${JWT_SECRET}
EMAIL: ${EMAIL}
EMAIL_PASS: ${EMAIL_PASS}
MONGO_URL: ${MONGO_URL}
DB_NAME: ${DB_NAME}
depends_on:
- mongo
mongo:
image: mongo:latest
ports:
- "32768:27017"
environment:
MONGO_INITDB_ROOT_USERNAME: ${MONGO_INITDB_ROOT_USERNAME}
MONGO_INITDB_ROOT_PASSWORD: ${MONGO_INITDB_ROOT_PASSWORD}
115 changes: 115 additions & 0 deletions src/docs/authDocs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,3 +57,118 @@
* '500':
* description: Internal Server Error
*/

/**
* @swagger
* api/auth/verify_email/${token}:
* get:
* summary: Verify Email
* tags: [Authentication]
* parameters:
* - in: path
* name: token
* schema:
* type: string
* required: true
* description: token
* responses:
* '200':
* description: Email successfully verified
* '409':
* description: Invalid or expired token
* '500':
* description: Internal Server Error
*/

/**
* @swagger
* api/auth/request_new_link:
* post:
* summary: Request new verification link
* tags: [Authentication]
* security:
* - bearerAuth: []
* responses:
* '200':
* description: Email sent successfully
* '400':
* description: User is already verified
* '500':
* description: Internal Server Error
*/

/**
* @swagger
* api/auth/verify_code/{userId}:
* post:
* summary: Verify 2FA Code
* tags: [Authentication]
* parameters:
* - in: path
* name: userId
* schema:
* type: string
* required: true
* description: userId
* requestBody:
* required: true
* content:
* application/json:
* schema:
* type: object
* properties:
* twoFactorCode:
* type: number
* responses:
* '200':
* description: Login successful
* '409':
* description: Failed validation
* '404':
* description: User not found
* '401':
* description: Code provided does not match code sent
* '500':
* description: Internal Server Error
*/

/**
* @swagger
* api/auth/request_new_code/{userId}:
* post:
* summary: Request new 2FA Code
* tags: [Authentication]
* parameters:
* - in: path
* name: userId
* schema:
* type: string
* required: true
* description: userId
* responses:
* '200':
* description: Email sent successfully
* '401':
* description: 2FA is not enabled
* '404':
* description: User not found
* '500':
* description: Internal Server Error
*/

/**
* @swagger
* api/auth/toggle_2fa:
* patch:
* summary: Enable/Disable 2FA
* tags: [Authentication]
* security:
* - bearerAuth: []
* responses:
* '200':
* description: 2FA status updated successfully
* '400':
* description: Failed validation
* '500':
* description: Internal Server Error
*/

0 comments on commit 26d7ee9

Please sign in to comment.