From 7c3ad8ee989caa61460a13950e2c6ec6444760e0 Mon Sep 17 00:00:00 2001 From: Arman Kumar Jena Date: Mon, 10 Jun 2024 08:41:19 +0530 Subject: [PATCH] updated swagger doc for 403 and 401 --- src/teams/teams.controller.ts | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/src/teams/teams.controller.ts b/src/teams/teams.controller.ts index 873b097..84f3ed9 100644 --- a/src/teams/teams.controller.ts +++ b/src/teams/teams.controller.ts @@ -17,6 +17,7 @@ import { VoyageTeamResponse, } from "./teams.response"; import { + ForbiddenErrorResponse, NotFoundErrorResponse, UnauthorizedErrorResponse, } from "../global/responses/errors"; @@ -39,6 +40,16 @@ export class TeamsController { type: VoyageTeamResponse, isArray: true, }) + @ApiResponse({ + status: HttpStatus.UNAUTHORIZED, + description: "unauthorized access - user is not logged in", + type: UnauthorizedErrorResponse, + }) + @ApiResponse({ + status: HttpStatus.FORBIDDEN, + description: "forbidden - user does not have the required permission", + type: ForbiddenErrorResponse, + }) @CheckAbilities({ action: Action.Manage, subject: "all" }) @Get() findAll() { @@ -69,6 +80,16 @@ export class TeamsController { required: true, example: 1, }) + @ApiResponse({ + status: HttpStatus.UNAUTHORIZED, + description: "unauthorized access - user is not logged in", + type: UnauthorizedErrorResponse, + }) + @ApiResponse({ + status: HttpStatus.FORBIDDEN, + description: "forbidden - user does not have the required permission", + type: ForbiddenErrorResponse, + }) @CheckAbilities({ action: Action.Manage, subject: "all" }) @Get("voyages/:voyageId") findTeamsByVoyageId(@Param("voyageId", ParseIntPipe) voyageId: number) {