From c46639bf55f0b10463d9c9e244221da7b3f89159 Mon Sep 17 00:00:00 2001 From: gengminy Date: Wed, 3 Aug 2022 12:35:18 +0900 Subject: [PATCH] =?UTF-8?q?:hammer:=20refactor(ticket):=20=ED=8B=B0?= =?UTF-8?q?=EC=BC=93=20=EC=9E=85=EC=9E=A5=20=EC=9D=91=EB=8B=B5=20=EC=98=88?= =?UTF-8?q?=EC=8B=9C=20=EC=B6=94=EA=B0=80=20#118?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/tickets/tickets.controller.ts | 61 +++++++++++++++++++++++++++++-- src/tickets/tickets.service.ts | 1 + 2 files changed, 59 insertions(+), 3 deletions(-) diff --git a/src/tickets/tickets.controller.ts b/src/tickets/tickets.controller.ts index 5c30efa..3255d8c 100644 --- a/src/tickets/tickets.controller.ts +++ b/src/tickets/tickets.controller.ts @@ -37,6 +37,7 @@ import { PageDto } from 'src/common/dtos/page/page.dto'; import { NoAuth } from 'src/auth/guards/NoAuth.guard'; import { TicketCountDto } from './dtos/ticket-count.dto'; import { ErrorResponse } from 'src/common/decorators/ErrorResponse.decorator'; +import { TicketEntryResponseDto } from './dtos/ticket-entry-response.dto'; @ApiTags('tickets') @ApiBearerAuth('accessToken') @@ -70,7 +71,7 @@ export class TicketsController { } @ApiOperation({ - summary: '[어드민]해당 조건의 티켓을 모두 불러온다, querystring으로 전달' + summary: '[어드민]해당 조건의 티켓을 모두 불러온다' }) // @ApiResponse({ // status: 200, @@ -181,14 +182,68 @@ export class TicketsController { return this.ticketService.findByUuid(uuid, user); } + @ErrorResponse(HttpStatus.BAD_REQUEST, [ + { + model: BadRequestException, + exampleDescription: '이미 입장 완료된 티켓', + exampleTitle: 'status:400 BadRequestException DONE', + message: '이미 입장 완료된 티켓입니다' + }, + { + model: BadRequestException, + exampleDescription: '입금 기한이 만료된 티켓', + exampleTitle: 'status:400 BadRequestException EXPIRE', + message: '입금 기한이 만료된 티켓입니다' + }, + { + model: BadRequestException, + exampleDescription: '입금 대기중인 티켓', + exampleTitle: 'status:400 BadRequestException ORDERWAIT', + message: '입금 대기중인 티켓입니다' + }, + { + model: BadRequestException, + exampleDescription: 'Body 파라미터와 타켓 공연 날짜가 일치하지 않음', + exampleTitle: 'status:400 BadRequestException Date', + message: '공연 날짜가 일치하지 않습니다' + }, + { + model: BadRequestException, + exampleDescription: 'Body 파라미터와 타켓 공연 날짜가 일치하지 않음', + exampleTitle: 'status:400 BadRequestException Date', + message: '공연 날짜가 일치하지 않습니다' + }, + { + model: BadRequestException, + exampleDescription: 'Body 파라미터 검증 오류', + exampleTitle: 'status:400 BadRequestException Validation', + message: '검증 오류' + } + ]) + @ErrorResponse(HttpStatus.UNAUTHORIZED, [ + { + model: UnauthorizedException, + exampleDescription: '엑세스 토큰이 없거나 어드민이 아닐 경우 접근 제어', + exampleTitle: 'status:401 UnauthorizedException', + message: '잘못된 헤더 요청' + } + ]) + @ErrorResponse(HttpStatus.NOT_FOUND, [ + { + model: NotFoundException, + exampleDescription: 'Ticket uuid 입력 오류입니다', + exampleTitle: 'status:404 NotFoundException', + message: "Can't find Ticket with uuid {ticketId}" + } + ]) @ApiOperation({ summary: '[어드민] 티켓 QR코드 찍었을 때 uuid를 받아 소켓 이벤트를 전송한다' }) @ApiBody({ type: TicketEntryDateValidationDto }) @ApiResponse({ - status: 200 || 201, + status: 201, description: '요청 성공시', - type: TicketEntryDateValidationDto + type: TicketEntryResponseDto }) @ApiUnauthorizedResponse({ status: 401, diff --git a/src/tickets/tickets.service.ts b/src/tickets/tickets.service.ts index ef0e6b6..9dfd1c9 100644 --- a/src/tickets/tickets.service.ts +++ b/src/tickets/tickets.service.ts @@ -150,6 +150,7 @@ export class TicketsService { await connectedRepository.saveTicket(ticket); response.message = `[입장성공] ${ticket.user?.name}님이 입장하셨습니다`; + response.success = true; this.logger.log(`${ticket.user?.name}님이 입장하셨습니다`); this.socketService.emitToAll(response);