-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[#241] refactor(TicketController): ticket swagger 문서화
- Loading branch information
1 parent
238c5a0
commit c7b836a
Showing
1 changed file
with
45 additions
and
36 deletions.
There are no files selected for viewing
81 changes: 45 additions & 36 deletions
81
src/main/java/com/beat/domain/booking/api/TicketController.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,52 +1,61 @@ | ||
package com.beat.domain.booking.api; | ||
|
||
import org.springframework.http.ResponseEntity; | ||
import org.springframework.web.bind.annotation.GetMapping; | ||
import org.springframework.web.bind.annotation.PatchMapping; | ||
import org.springframework.web.bind.annotation.PathVariable; | ||
import org.springframework.web.bind.annotation.PutMapping; | ||
import org.springframework.web.bind.annotation.RequestBody; | ||
import org.springframework.web.bind.annotation.RequestMapping; | ||
import org.springframework.web.bind.annotation.RequestParam; | ||
import org.springframework.web.bind.annotation.RestController; | ||
|
||
import com.beat.domain.booking.application.TicketService; | ||
import com.beat.domain.booking.application.dto.TicketCancelRequest; | ||
import com.beat.domain.booking.application.dto.TicketRetrieveResponse; | ||
import com.beat.domain.booking.application.dto.TicketUpdateRequest; | ||
import com.beat.domain.booking.domain.BookingStatus; | ||
import com.beat.domain.booking.exception.BookingSuccessCode; | ||
import com.beat.domain.schedule.domain.ScheduleNumber; | ||
import com.beat.global.auth.annotation.CurrentMember; | ||
import com.beat.global.common.dto.SuccessResponse; | ||
import com.beat.domain.schedule.domain.ScheduleNumber; | ||
import io.swagger.v3.oas.annotations.Operation; | ||
|
||
import lombok.RequiredArgsConstructor; | ||
import org.springframework.http.ResponseEntity; | ||
import org.springframework.web.bind.annotation.*; | ||
|
||
@RestController | ||
@RequestMapping("/api/tickets") | ||
@RequiredArgsConstructor | ||
public class TicketController { | ||
|
||
private final TicketService ticketService; | ||
|
||
@Operation(summary = "예매자 목록 조회 API", description = "메이커가 자신의 공연에 대한 예매자 목록을 조회하는 GET API입니다.") | ||
@GetMapping("/{performanceId}") | ||
public ResponseEntity<SuccessResponse<TicketRetrieveResponse>> getTickets( | ||
@CurrentMember Long memberId, | ||
@PathVariable Long performanceId, | ||
@RequestParam(required = false) ScheduleNumber scheduleNumber, | ||
@RequestParam(required = false) BookingStatus bookingStatus) { | ||
TicketRetrieveResponse response = ticketService.getTickets(memberId, performanceId, scheduleNumber, bookingStatus); | ||
return ResponseEntity.ok(SuccessResponse.of(BookingSuccessCode.TICKET_RETRIEVE_SUCCESS, response)); | ||
} | ||
|
||
@Operation(summary = "예매자 입금여부 수정 및 웹발신 API", description = "메이커가 자신의 공연에 대한 예매자의 입금여부 정보를 수정한 뒤 예매확정 웹발신을 보내는 PUT API입니다.") | ||
@PutMapping | ||
public ResponseEntity<SuccessResponse<Void>> updateTickets( | ||
@CurrentMember Long memberId, | ||
@RequestBody TicketUpdateRequest request) { | ||
ticketService.updateTickets(memberId, request); | ||
return ResponseEntity.ok(SuccessResponse.from(BookingSuccessCode.TICKET_UPDATE_SUCCESS)); | ||
} | ||
|
||
@Operation(summary = "예매자 취소 API", description = "메이커가 자신의 공연에 대한 1명 이상의 예매자의 정보를 취소 상태로 변경하는 PATCH API입니다.") | ||
@PatchMapping | ||
public ResponseEntity<SuccessResponse<Void>> cancelTickets( | ||
@CurrentMember Long memberId, | ||
@RequestBody TicketCancelRequest ticketCancelRequest) { | ||
ticketService.cancelTickets(memberId, ticketCancelRequest); | ||
return ResponseEntity.ok(SuccessResponse.from(BookingSuccessCode.TICKET_CANCEL_SUCCESS)); | ||
} | ||
public class TicketController implements TicketApi { | ||
|
||
private final TicketService ticketService; | ||
|
||
@Override | ||
@GetMapping("/{performanceId}") | ||
public ResponseEntity<SuccessResponse<TicketRetrieveResponse>> getTickets( | ||
@CurrentMember Long memberId, | ||
@PathVariable Long performanceId, | ||
@RequestParam(required = false) ScheduleNumber scheduleNumber, | ||
@RequestParam(required = false) BookingStatus bookingStatus) { | ||
TicketRetrieveResponse response = ticketService.getTickets(memberId, performanceId, scheduleNumber, | ||
bookingStatus); | ||
return ResponseEntity.ok(SuccessResponse.of(BookingSuccessCode.TICKET_RETRIEVE_SUCCESS, response)); | ||
} | ||
|
||
@Override | ||
@PutMapping | ||
public ResponseEntity<SuccessResponse<Void>> updateTickets( | ||
@CurrentMember Long memberId, | ||
@RequestBody TicketUpdateRequest request) { | ||
ticketService.updateTickets(memberId, request); | ||
return ResponseEntity.ok(SuccessResponse.from(BookingSuccessCode.TICKET_UPDATE_SUCCESS)); | ||
} | ||
|
||
@Override | ||
@PatchMapping | ||
public ResponseEntity<SuccessResponse<Void>> cancelTickets( | ||
@CurrentMember Long memberId, | ||
@RequestBody TicketCancelRequest ticketCancelRequest) { | ||
ticketService.cancelTickets(memberId, ticketCancelRequest); | ||
return ResponseEntity.ok(SuccessResponse.from(BookingSuccessCode.TICKET_CANCEL_SUCCESS)); | ||
} | ||
} |