Skip to content

Commit

Permalink
OV-2: + implemented swagger and added sign-in docs
Browse files Browse the repository at this point in the history
  • Loading branch information
JKaypa committed Aug 20, 2024
1 parent 06fa5d1 commit e411fe2
Show file tree
Hide file tree
Showing 2 changed files with 60 additions and 5 deletions.
45 changes: 42 additions & 3 deletions backend/src/bundles/auth/auth.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,9 @@ class AuthController extends BaseController {

/**
* @swagger
* /auth/sign-up:
* /auth/sign-in:
* post:
* description: Sign up user into the application
* description: Sign in user into the application
* requestBody:
* description: User auth data
* required: true
Expand All @@ -72,7 +72,7 @@ class AuthController extends BaseController {
* password:
* type: string
* responses:
* 201:
* 200:
* description: Successful operation
* content:
* application/json:
Expand All @@ -82,7 +82,15 @@ class AuthController extends BaseController {
* message:
* type: object
* $ref: '#/components/schemas/User'
* 400:
* description: Failed operation
* content:
* application/json:
* schema:
* type: object
* $ref: '#/components/schemas/Error'
*/

private async signIn(
options: ApiHandlerOptions<{
body: UserSignInRequestDto;
Expand All @@ -94,6 +102,37 @@ class AuthController extends BaseController {
};
}

/**
* @swagger
* /auth/sign-up:
* post:
* description: Sign up user into the application
* requestBody:
* description: User auth data
* required: true
* content:
* application/json:
* schema:
* type: object
* properties:
* email:
* type: string
* format: email
* password:
* type: string
* responses:
* 201:
* description: Successful operation
* content:
* application/json:
* schema:
* type: object
* properties:
* message:
* type: object
* $ref: '#/components/schemas/User'
*/

private async signUp(
options: ApiHandlerOptions<{
body: UserSignUpRequestDto;
Expand Down
20 changes: 18 additions & 2 deletions backend/src/common/server-application/base-server-app-api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,27 @@ class BaseServerAppApi implements ServerAppApi {
definition: {
openapi: '3.0.0',
info: {
title: 'Hello World',
title: 'OutreachVids API documentation',
version: `${this.version}.0.0`,
},
components: {
schemas: {
Error: {
type: 'object',
properties: {
errorType: {
type: 'string',
enum: ['COMMON', 'VALIDATION'],
},
message: {
type: 'string',
},
},
},
},
},
},
apis: [`src/packages/**/*.controller.${controllerExtension}`],
apis: [`src/bundles/**/*.controller.${controllerExtension}`],
});
}
}
Expand Down

0 comments on commit e411fe2

Please sign in to comment.