Skip to content

Commit

Permalink
[v1.0.1] 티켓모듈 엔터관련 예시에러응답값 추가, 인증번호 exclude
Browse files Browse the repository at this point in the history
[v1.0.1] 티켓모듈 엔터관련 예시에러응답값 추가, 인증번호 exclude
  • Loading branch information
ImNM authored Aug 3, 2022
2 parents e409186 + df2389b commit fb24a57
Show file tree
Hide file tree
Showing 4 changed files with 63 additions and 7 deletions.
4 changes: 2 additions & 2 deletions src/auth/dtos/AdminSendValidationNumber.response.dto.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { ApiProperty } from '@nestjs/swagger';
import { Expose } from 'class-transformer';
import { Exclude, Expose } from 'class-transformer';
import { IsEmail, IsMobilePhone } from 'class-validator';

export class ResponseAdminSendValidationNumberDto {
Expand All @@ -11,6 +11,6 @@ export class ResponseAdminSendValidationNumberDto {
isArray: true,
example: 'asdf'
})
@Expose()
@Exclude()
validationNumber: string;
}
4 changes: 2 additions & 2 deletions src/auth/dtos/RequestValidation.response.dto.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import { ApiProperty } from '@nestjs/swagger';
import { Expose } from 'class-transformer';
import { Exclude, Expose } from 'class-transformer';

export class ResponseRequestValidationDto {
@ApiProperty({ description: '요청보낸 전화번호', type: String })
@Expose()
phoneNumber: string;

@ApiProperty({ description: '테스트용 인증번호', type: String })
@Expose()
@Exclude()
validationNumber: string;

@ApiProperty({ description: '이미 가입했는지에대한 정보', type: Boolean })
Expand Down
61 changes: 58 additions & 3 deletions src/tickets/tickets.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand Down Expand Up @@ -70,7 +71,7 @@ export class TicketsController {
}

@ApiOperation({
summary: '[어드민]해당 조건의 티켓을 모두 불러온다, querystring으로 전달'
summary: '[어드민]해당 조건의 티켓을 모두 불러온다'
})
// @ApiResponse({
// status: 200,
Expand Down Expand Up @@ -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,
Expand Down
1 change: 1 addition & 0 deletions src/tickets/tickets.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down

0 comments on commit fb24a57

Please sign in to comment.