-
-
Notifications
You must be signed in to change notification settings - Fork 37
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
All the codes referred to swagger routes were moved from the company
controller to separate fil
- Loading branch information
1 parent
c8c095c
commit 0caa13a
Showing
10 changed files
with
277 additions
and
178 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import { HttpStatus, applyDecorators } from "@nestjs/common"; | ||
import { ApiOperation, ApiResponse } from "@nestjs/swagger"; | ||
import { UnauthorizedSwagger } from "../unauthorized.swagger"; | ||
import { BadRequestSwagger } from "../bad-request.swagger"; | ||
|
||
export function ActivateCompanySwagger() { | ||
return applyDecorators( | ||
ApiResponse({ | ||
status: HttpStatus.UNAUTHORIZED, | ||
description: 'Modelo de erro', | ||
type: UnauthorizedSwagger, | ||
}), | ||
ApiResponse({ | ||
status: HttpStatus.BAD_REQUEST, | ||
description: 'Modelo de erro', | ||
type: BadRequestSwagger, | ||
}), | ||
ApiOperation({ | ||
summary: 'Ativar uma empresa pelo ID', | ||
}) | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import { HttpStatus, applyDecorators } from "@nestjs/common"; | ||
import { ApiOperation, ApiResponse } from "@nestjs/swagger"; | ||
import { CreateCompanyDto } from "src/modules/company/dtos/create-company.dto"; | ||
import { UnauthorizedSwagger } from "../unauthorized.swagger"; | ||
import { BadRequestSwagger } from "../bad-request.swagger"; | ||
|
||
export function CreateCompanySwagger() { | ||
return applyDecorators( | ||
ApiResponse({ | ||
status: HttpStatus.OK, | ||
description: 'Exemplo do retorno de sucesso da rota', | ||
type: CreateCompanyDto, | ||
}), | ||
ApiResponse({ | ||
status: HttpStatus.UNAUTHORIZED, | ||
description: 'Modelo de erro', | ||
type: UnauthorizedSwagger, | ||
}), | ||
ApiResponse({ | ||
status: HttpStatus.BAD_REQUEST, | ||
description: 'Modelo de erro', | ||
type: BadRequestSwagger, | ||
}), | ||
ApiOperation({ | ||
summary: 'Cadastrar uma empresa.', | ||
}) | ||
) | ||
} |
28 changes: 28 additions & 0 deletions
28
src/shared/Swagger/company/delete-company-by-id.swagger.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import { HttpStatus, applyDecorators } from "@nestjs/common"; | ||
import { ApiOperation, ApiResponse } from "@nestjs/swagger"; | ||
import { CompanyIdDto } from "src/modules/company/dtos/company-id.dto"; | ||
import { UnauthorizedSwagger } from "../unauthorized.swagger"; | ||
import { BadRequestSwagger } from "../bad-request.swagger"; | ||
|
||
export function DeleteCompanyByIdSwagger() { | ||
return applyDecorators( | ||
ApiResponse({ | ||
status: HttpStatus.OK, | ||
description: 'Exemplo do retorno de sucesso da rota', | ||
type: CompanyIdDto, | ||
}), | ||
ApiResponse({ | ||
status: HttpStatus.UNAUTHORIZED, | ||
description: 'Modelo de erro', | ||
type: UnauthorizedSwagger, | ||
}), | ||
ApiResponse({ | ||
status: HttpStatus.BAD_REQUEST, | ||
description: 'Modelo de erro', | ||
type: BadRequestSwagger, | ||
}), | ||
ApiOperation({ | ||
summary: 'Excluir uma empresa por id.', | ||
}) | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import { HttpStatus, applyDecorators } from "@nestjs/common"; | ||
import { ApiOperation, ApiResponse } from "@nestjs/swagger"; | ||
import { BadRequestSwagger } from "../bad-request.swagger"; | ||
import { UnauthorizedSwagger } from "../unauthorized.swagger"; | ||
import { PageOptionsDto } from "src/shared/pagination"; | ||
|
||
export function GetAllCompaniesSwagger() { | ||
return applyDecorators( | ||
ApiResponse({ | ||
status: HttpStatus.OK, | ||
description: 'Exemplo do retorno de sucesso da rota', | ||
type: PageOptionsDto, | ||
}), | ||
ApiResponse({ | ||
status: HttpStatus.UNAUTHORIZED, | ||
description: 'Modelo de erro', | ||
type: UnauthorizedSwagger, | ||
}), | ||
ApiResponse({ | ||
status: HttpStatus.BAD_REQUEST, | ||
description: 'Modelo de erro', | ||
type: BadRequestSwagger, | ||
}), | ||
ApiOperation({ | ||
summary: 'Buscar todas as empresas.', | ||
}) | ||
) | ||
} |
Oops, something went wrong.