Skip to content

Commit

Permalink
🩹 fix api descriptions and add ApiBody in returnBundle #114
Browse files Browse the repository at this point in the history
fix api descriptions and add ApiBody in returnBundle #114
  • Loading branch information
sichoi42 committed Nov 5, 2022
1 parent 083a67f commit 187faa3
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 3 deletions.
17 changes: 17 additions & 0 deletions backend/src/v3/return/dto/return.bundle.data.dto.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import { ApiProperty } from "@nestjs/swagger";

export class ReturnBundleDataDto {
@ApiProperty({
description: 'user_id 배열',
default: [],
required: false,
})
users: number[];

@ApiProperty({
description: 'cabinet_id 배열',
default: [],
required: false,
})
cabinets: number[];
}
8 changes: 5 additions & 3 deletions backend/src/v3/return/return.controller.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { Body, Controller, Delete, HttpCode, HttpException, HttpStatus, InternalServerErrorException, Logger, Param, ParseArrayPipe, ParseIntPipe, UseGuards } from '@nestjs/common';
import { ApiBadRequestResponse, ApiNoContentResponse, ApiNotFoundResponse, ApiOperation, ApiResponse, ApiTags } from '@nestjs/swagger';
import { ApiBadRequestResponse, ApiBody, ApiNoContentResponse, ApiNotFoundResponse, ApiOperation, ApiResponse, ApiTags } from '@nestjs/swagger';
import { JWTAuthGuard } from 'src/auth/auth.guard';
import { ReturnBundleDataDto } from './dto/return.bundle.data.dto';
import { ReturnService } from './return.service';

@ApiTags('(V3) Return')
Expand Down Expand Up @@ -79,17 +80,18 @@ export class ReturnController {
}

@ApiOperation({
summary: '선택한 캐비넷이나 유저를 일괄 반납합니다.',
summary: '선택한 캐비넷이나 유저를 일괄 반납',
description: 'Request Body로 cabinet_id 배열이나 user_id 배열을 보내면 해당 캐비넷 혹은 유저에 대해 일괄 반납 처리를 합니다.',
})
@ApiNoContentResponse({
description: '모든 요청에 대해 반납에 성공 시, 204 No Content를 응답합니다.',
})
@ApiBadRequestResponse({
description:
`대여중인 사물함이 없는 유저가 있거나 대여중인 유저가 없는 사물함이 있다면 경우, 400 Bad Request를 응답합니다.
`대여중인 사물함이 없는 유저가 있거나 대여중인 유저가 없는 사물함이 있는 경우, 400 Bad Request를 응답합니다.
이때 response body로 처리에 실패한 user_id나 cabinet_id의 배열을 전달합니다.`,
})
@ApiBody({ type: ReturnBundleDataDto })
@Delete('bundle/cabinet')
@HttpCode(HttpStatus.NO_CONTENT)
async returnBundle(
Expand Down

0 comments on commit 187faa3

Please sign in to comment.