Skip to content

Commit

Permalink
update: swagger
Browse files Browse the repository at this point in the history
  • Loading branch information
siwonpada committed Sep 2, 2024
1 parent 52b404d commit d1c24ad
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/external/dto/req/createExternalToken.dto.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import { ApiProperty } from '@nestjs/swagger';
import { IsString } from 'class-validator';

export class CreateExternalTokenDto {
@ApiProperty()
@IsString()
idpToken: string;
}
1 change: 1 addition & 0 deletions src/external/dto/res/externalInfoRes.dto.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,5 +69,6 @@ class GroupWithRoleResDto implements GroupWithRole {
}

export class ExternalInfoResDto {
@ApiProperty({ type: GroupWithRoleResDto, isArray: true })
list: GroupWithRoleResDto[];
}
3 changes: 3 additions & 0 deletions src/external/dto/res/externalTokenRes.dto.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
import { ApiProperty } from '@nestjs/swagger';

export class ExternalTokenResDto {
@ApiProperty()
token: string;
}
4 changes: 4 additions & 0 deletions src/external/external.controller.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import { Body, Controller, Get, Post, Req, UseGuards } from '@nestjs/common';
import {
ApiBasicAuth,
ApiBearerAuth,
ApiForbiddenResponse,
ApiInternalServerErrorResponse,
ApiOperation,
Expand Down Expand Up @@ -29,6 +31,7 @@ export class ExternalController {
@ApiUnauthorizedResponse()
@ApiForbiddenResponse()
@ApiInternalServerErrorResponse()
@ApiBasicAuth('client')
@Post()
async createCertToken(
@GetClient() client: Client,
Expand All @@ -44,6 +47,7 @@ export class ExternalController {
@UseGuards(ExternalGuard)
@ApiUnauthorizedResponse()
@ApiInternalServerErrorResponse()
@ApiBearerAuth('external')
@Get('info')
async getCertInfo(@Req() req: any): Promise<ExternalInfoResDto> {
return this.externalService.getExternalInfo(req.user);
Expand Down
6 changes: 6 additions & 0 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,12 @@ async function bootstrap() {
.setTitle('Groups API')
.setDescription('The Groups API')
.setVersion('1.0')
.addBearerAuth(
{
type: 'http',
},
'external',
)
.addBasicAuth(
{
type: 'http',
Expand Down

0 comments on commit d1c24ad

Please sign in to comment.