From b8e08153ea26d8ca3e9c48ca202a6a7f8fe464f6 Mon Sep 17 00:00:00 2001 From: hyerinhwang-sailin Date: Wed, 9 Oct 2024 00:58:29 +0900 Subject: [PATCH 01/16] =?UTF-8?q?[#241]=20refactor(BookingApi):=20booking?= =?UTF-8?q?=20swagger=20=EB=AC=B8=EC=84=9C=ED=99=94?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../beat/domain/booking/api/BookingApi.java | 60 +++++++++++++++++++ 1 file changed, 60 insertions(+) create mode 100644 src/main/java/com/beat/domain/booking/api/BookingApi.java diff --git a/src/main/java/com/beat/domain/booking/api/BookingApi.java b/src/main/java/com/beat/domain/booking/api/BookingApi.java new file mode 100644 index 00000000..2ecac317 --- /dev/null +++ b/src/main/java/com/beat/domain/booking/api/BookingApi.java @@ -0,0 +1,60 @@ +package com.beat.domain.booking.api; + +import java.util.List; + +import org.springframework.http.ResponseEntity; +import org.springframework.web.bind.annotation.RequestBody; + +import com.beat.domain.booking.application.dto.GuestBookingRequest; +import com.beat.domain.booking.application.dto.GuestBookingResponse; +import com.beat.domain.booking.application.dto.GuestBookingRetrieveRequest; +import com.beat.domain.booking.application.dto.GuestBookingRetrieveResponse; +import com.beat.domain.booking.application.dto.MemberBookingRequest; +import com.beat.domain.booking.application.dto.MemberBookingResponse; +import com.beat.domain.booking.application.dto.MemberBookingRetrieveResponse; +import com.beat.global.auth.annotation.CurrentMember; +import com.beat.global.common.dto.SuccessResponse; + +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.media.Content; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.responses.ApiResponse; +import io.swagger.v3.oas.annotations.responses.ApiResponses; +import io.swagger.v3.oas.annotations.tags.Tag; + +@Tag(name = "Booking", description = "예매 관련 API") +public interface BookingApi { + + @Operation(summary = "회원 예매 API", description = "회원이 예매를 요청하는 POST API입니다.") + @ApiResponses({ + @ApiResponse(responseCode = "201", description = "회원 예매가 성공적으로 완료되었습니다.", + content = @Content(schema = @Schema(implementation = SuccessResponse.class))) + }) + ResponseEntity> createMemberBooking( + @CurrentMember Long memberId, + @RequestBody MemberBookingRequest memberBookingRequest); + + @Operation(summary = "회원 예매 조회 API", description = "회원이 예매를 조회하는 GET API입니다.") + @ApiResponses({ + @ApiResponse(responseCode = "200", description = "회원 예매 조회가 성공적으로 완료되었습니다.", + content = @Content(schema = @Schema(implementation = SuccessResponse.class))) + }) + ResponseEntity>> getMemberBookings( + @CurrentMember Long memberId); + + @Operation(summary = "비회원 예매 API", description = "비회원이 예매를 요청하는 POST API입니다.") + @ApiResponses({ + @ApiResponse(responseCode = "201", description = "비회원 예매가 성공적으로 완료되었습니다.", + content = @Content(schema = @Schema(implementation = SuccessResponse.class))) + }) + ResponseEntity> createGuestBookings( + @RequestBody GuestBookingRequest guestBookingRequest); + + @Operation(summary = "비회원 예매 조회 API", description = "비회원이 예매를 조회하는 POST API입니다.") + @ApiResponses({ + @ApiResponse(responseCode = "200", description = "비회원 예매 조회가 성공적으로 완료되었습니다.", + content = @Content(schema = @Schema(implementation = SuccessResponse.class))) + }) + ResponseEntity>> getGuestBookings( + @RequestBody GuestBookingRetrieveRequest guestBookingRetrieveRequest); +} From f0a22feb90f5a200e6616975a228e10adf3d0173 Mon Sep 17 00:00:00 2001 From: hyerinhwang-sailin Date: Wed, 9 Oct 2024 01:00:14 +0900 Subject: [PATCH 02/16] =?UTF-8?q?[#241]=20refactor(BookingController):=20b?= =?UTF-8?q?ooking=20swagger=20=EB=AC=B8=EC=84=9C=ED=99=94?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../domain/booking/api/BookingController.java | 102 +++++++++--------- 1 file changed, 52 insertions(+), 50 deletions(-) diff --git a/src/main/java/com/beat/domain/booking/api/BookingController.java b/src/main/java/com/beat/domain/booking/api/BookingController.java index dae62784..5015397f 100644 --- a/src/main/java/com/beat/domain/booking/api/BookingController.java +++ b/src/main/java/com/beat/domain/booking/api/BookingController.java @@ -1,74 +1,76 @@ package com.beat.domain.booking.api; +import java.util.List; + +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + import com.beat.domain.booking.application.GuestBookingRetrieveService; import com.beat.domain.booking.application.GuestBookingService; import com.beat.domain.booking.application.MemberBookingRetrieveService; import com.beat.domain.booking.application.MemberBookingService; -import com.beat.domain.booking.application.dto.GuestBookingRetrieveRequest; -import com.beat.domain.booking.application.dto.GuestBookingRetrieveResponse; import com.beat.domain.booking.application.dto.GuestBookingRequest; import com.beat.domain.booking.application.dto.GuestBookingResponse; +import com.beat.domain.booking.application.dto.GuestBookingRetrieveRequest; +import com.beat.domain.booking.application.dto.GuestBookingRetrieveResponse; import com.beat.domain.booking.application.dto.MemberBookingRequest; import com.beat.domain.booking.application.dto.MemberBookingResponse; import com.beat.domain.booking.application.dto.MemberBookingRetrieveResponse; import com.beat.domain.booking.exception.BookingSuccessCode; import com.beat.global.auth.annotation.CurrentMember; import com.beat.global.common.dto.SuccessResponse; -import io.swagger.v3.oas.annotations.Operation; -import lombok.RequiredArgsConstructor; -import org.springframework.http.HttpStatus; -import org.springframework.http.ResponseEntity; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; -import java.util.List; +import lombok.RequiredArgsConstructor; @RestController @RequestMapping("/api/bookings") @RequiredArgsConstructor -public class BookingController { - private final MemberBookingService memberBookingService; - private final MemberBookingRetrieveService memberBookingRetrieveService; - private final GuestBookingService guestBookingService; - private final GuestBookingRetrieveService guestBookingRetrieveService; +public class BookingController implements BookingApi { + private final MemberBookingService memberBookingService; + private final MemberBookingRetrieveService memberBookingRetrieveService; + private final GuestBookingService guestBookingService; + private final GuestBookingRetrieveService guestBookingRetrieveService; - @Operation(summary = "회원 예매 API", description = "회원이 예매를 요청하는 POST API입니다.") - @PostMapping("/member") - public ResponseEntity> createMemberBooking( - @CurrentMember Long memberId, - @RequestBody MemberBookingRequest memberBookingRequest) { - MemberBookingResponse response = memberBookingService.createMemberBooking(memberId, memberBookingRequest); - return ResponseEntity.status(HttpStatus.CREATED) - .body(SuccessResponse.of(BookingSuccessCode.MEMBER_BOOKING_SUCCESS, response)); - } + @Override + @PostMapping("/member") + public ResponseEntity> createMemberBooking( + @CurrentMember Long memberId, + @RequestBody MemberBookingRequest memberBookingRequest) { + MemberBookingResponse response = memberBookingService.createMemberBooking(memberId, memberBookingRequest); + return ResponseEntity.status(HttpStatus.CREATED) + .body(SuccessResponse.of(BookingSuccessCode.MEMBER_BOOKING_SUCCESS, response)); + } - @Operation(summary = "회원 예매 조회 API", description = "회원이 예매를 조회하는 GET API입니다.") - @GetMapping("/member/retrieve") - public ResponseEntity>> getMemberBookings( - @CurrentMember Long memberId) { - List response = memberBookingRetrieveService.findMemberBookings(memberId); - return ResponseEntity.status(HttpStatus.OK) - .body(SuccessResponse.of(BookingSuccessCode.MEMBER_BOOKING_RETRIEVE_SUCCESS, response)); - } + @Override + @GetMapping("/member/retrieve") + public ResponseEntity>> getMemberBookings( + @CurrentMember Long memberId) { + List response = memberBookingRetrieveService.findMemberBookings(memberId); + return ResponseEntity.status(HttpStatus.OK) + .body(SuccessResponse.of(BookingSuccessCode.MEMBER_BOOKING_RETRIEVE_SUCCESS, response)); + } - @Operation(summary = "비회원 예매 API", description = "비회원이 예매를 요청하는 POST API입니다.") - @PostMapping("/guest") - public ResponseEntity> createGuestBookings( - @RequestBody GuestBookingRequest guestBookingRequest) { - GuestBookingResponse response = guestBookingService.createGuestBooking(guestBookingRequest); - return ResponseEntity.status(HttpStatus.CREATED) - .body(SuccessResponse.of(BookingSuccessCode.GUEST_BOOKING_SUCCESS, response)); - } + @Override + @PostMapping("/guest") + public ResponseEntity> createGuestBookings( + @RequestBody GuestBookingRequest guestBookingRequest) { + GuestBookingResponse response = guestBookingService.createGuestBooking(guestBookingRequest); + return ResponseEntity.status(HttpStatus.CREATED) + .body(SuccessResponse.of(BookingSuccessCode.GUEST_BOOKING_SUCCESS, response)); + } - @Operation(summary = "비회원 예매 조회 API", description = "비회원이 예매를 조회하는 POST API입니다.") - @PostMapping("/guest/retrieve") - public ResponseEntity>> getGuestBookings( - @RequestBody GuestBookingRetrieveRequest guestBookingRetrieveRequest) { - List response = guestBookingRetrieveService.findGuestBookings(guestBookingRetrieveRequest); - return ResponseEntity.status(HttpStatus.OK) - .body(SuccessResponse.of(BookingSuccessCode.GUEST_BOOKING_RETRIEVE_SUCCESS, response)); - } + @Override + @PostMapping("/guest/retrieve") + public ResponseEntity>> getGuestBookings( + @RequestBody GuestBookingRetrieveRequest guestBookingRetrieveRequest) { + List response = guestBookingRetrieveService.findGuestBookings( + guestBookingRetrieveRequest); + return ResponseEntity.status(HttpStatus.OK) + .body(SuccessResponse.of(BookingSuccessCode.GUEST_BOOKING_RETRIEVE_SUCCESS, response)); + } } From e112c5e1a2f961085a0508ee0ca91f3ff2919e82 Mon Sep 17 00:00:00 2001 From: hyerinhwang-sailin Date: Wed, 9 Oct 2024 01:00:28 +0900 Subject: [PATCH 03/16] =?UTF-8?q?[#241]=20refactor(MemberApi):=20member=20?= =?UTF-8?q?swagger=20=EB=AC=B8=EC=84=9C=ED=99=94?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/beat/domain/member/api/MemberApi.java | 47 +++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 src/main/java/com/beat/domain/member/api/MemberApi.java diff --git a/src/main/java/com/beat/domain/member/api/MemberApi.java b/src/main/java/com/beat/domain/member/api/MemberApi.java new file mode 100644 index 00000000..ae420ef4 --- /dev/null +++ b/src/main/java/com/beat/domain/member/api/MemberApi.java @@ -0,0 +1,47 @@ +package com.beat.domain.member.api; + +import java.security.Principal; + +import org.springframework.http.ResponseEntity; + +import com.beat.domain.member.dto.AccessTokenGetSuccess; +import com.beat.domain.member.dto.LoginSuccessResponse; +import com.beat.global.auth.client.dto.MemberLoginRequest; +import com.beat.global.common.dto.SuccessResponse; + +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.media.Content; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.responses.ApiResponse; +import io.swagger.v3.oas.annotations.responses.ApiResponses; +import io.swagger.v3.oas.annotations.tags.Tag; +import jakarta.servlet.http.HttpServletResponse; + +@Tag(name = "Member", description = "회원 관련 API") +public interface MemberApi { + + @Operation(summary = "로그인/회원가입 API", description = "로그인/회원가입하는 POST API입니다.") + @ApiResponses({ + @ApiResponse(responseCode = "200", description = "로그인 또는 회원가입 성공", + content = @Content(schema = @Schema(implementation = SuccessResponse.class))) + }) + ResponseEntity> signUp( + String authorizationCode, + MemberLoginRequest loginRequest, + HttpServletResponse response); + + @Operation(summary = "access token 재발급 API", description = "refresh token으로 access token을 재발급하는 GET API입니다.") + @ApiResponses({ + @ApiResponse(responseCode = "200", description = "access token 재발급 성공", + content = @Content(schema = @Schema(implementation = SuccessResponse.class))) + }) + ResponseEntity> refreshToken( + String refreshToken); + + @Operation(summary = "로그아웃 API", description = "로그아웃하는 POST API입니다.") + @ApiResponses({ + @ApiResponse(responseCode = "200", description = "로그아웃 성공", + content = @Content(schema = @Schema(implementation = SuccessResponse.class))) + }) + ResponseEntity> signOut(Principal principal); +} From 06542181ebf1cd0a4f8bf1a75ed8657de5a48074 Mon Sep 17 00:00:00 2001 From: hyerinhwang-sailin Date: Wed, 9 Oct 2024 01:00:42 +0900 Subject: [PATCH 04/16] =?UTF-8?q?[#241]=20refactor(MemberController):=20me?= =?UTF-8?q?mber=20swagger=20=EB=AC=B8=EC=84=9C=ED=99=94?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../domain/member/api/MemberController.java | 114 ++++++++++-------- 1 file changed, 62 insertions(+), 52 deletions(-) diff --git a/src/main/java/com/beat/domain/member/api/MemberController.java b/src/main/java/com/beat/domain/member/api/MemberController.java index f246a74d..35a646fb 100644 --- a/src/main/java/com/beat/domain/member/api/MemberController.java +++ b/src/main/java/com/beat/domain/member/api/MemberController.java @@ -1,71 +1,81 @@ package com.beat.domain.member.api; +import java.security.Principal; + +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseCookie; +import org.springframework.http.ResponseEntity; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +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.member.application.AuthenticationService; -import com.beat.domain.member.application.MemberService; import com.beat.domain.member.application.SocialLoginService; -import com.beat.domain.member.dto.*; +import com.beat.domain.member.dto.AccessTokenGetSuccess; +import com.beat.domain.member.dto.LoginSuccessResponse; import com.beat.domain.member.exception.MemberSuccessCode; import com.beat.global.auth.client.dto.MemberLoginRequest; import com.beat.global.auth.jwt.application.TokenService; import com.beat.global.common.dto.SuccessResponse; -import io.swagger.v3.oas.annotations.Operation; + import jakarta.servlet.http.HttpServletResponse; import lombok.RequiredArgsConstructor; -import org.springframework.http.HttpStatus; -import org.springframework.http.ResponseCookie; -import org.springframework.http.ResponseEntity; -import org.springframework.web.bind.annotation.*; - -import java.security.Principal; @RestController @RequestMapping("/api/users") @RequiredArgsConstructor -public class MemberController { - private final TokenService tokenService; - private final AuthenticationService authenticationService; - private final SocialLoginService socialLoginService; +public class MemberController implements MemberApi { + private final TokenService tokenService; + private final AuthenticationService authenticationService; + private final SocialLoginService socialLoginService; - private final static int COOKIE_MAX_AGE = 7 * 24 * 60 * 60; - private final static String REFRESH_TOKEN = "refreshToken"; + private final static int COOKIE_MAX_AGE = 7 * 24 * 60 * 60; + private final static String REFRESH_TOKEN = "refreshToken"; - @Operation(summary = "로그인/회원가입 API", description = "로그인/회원가입하는 POST API입니다.") - @PostMapping("/sign-up") - public ResponseEntity> signUp( - @RequestParam final String authorizationCode, - @RequestBody final MemberLoginRequest loginRequest, - HttpServletResponse response - ) { - LoginSuccessResponse loginSuccessResponse = socialLoginService.handleSocialLogin(authorizationCode, loginRequest); - ResponseCookie cookie = ResponseCookie.from(REFRESH_TOKEN, loginSuccessResponse.refreshToken()) - .maxAge(COOKIE_MAX_AGE) - .path("/") - .secure(true) - .sameSite("None") - .httpOnly(true) - .build(); - response.setHeader("Set-Cookie", cookie.toString()); - return ResponseEntity.status(HttpStatus.OK) - .body(SuccessResponse.of(MemberSuccessCode.SIGN_UP_SUCCESS, LoginSuccessResponse.of(loginSuccessResponse.accessToken(), null, loginSuccessResponse.nickname(), loginSuccessResponse.role()))); - } + @Override + @PostMapping("/sign-up") + public ResponseEntity> signUp( + @RequestParam final String authorizationCode, + @RequestBody final MemberLoginRequest loginRequest, + HttpServletResponse response + ) { + LoginSuccessResponse loginSuccessResponse = socialLoginService.handleSocialLogin(authorizationCode, + loginRequest); + ResponseCookie cookie = ResponseCookie.from(REFRESH_TOKEN, loginSuccessResponse.refreshToken()) + .maxAge(COOKIE_MAX_AGE) + .path("/") + .secure(true) + .sameSite("None") + .httpOnly(true) + .build(); + response.setHeader("Set-Cookie", cookie.toString()); + return ResponseEntity.status(HttpStatus.OK) + .body(SuccessResponse.of(MemberSuccessCode.SIGN_UP_SUCCESS, + LoginSuccessResponse.of(loginSuccessResponse.accessToken(), null, loginSuccessResponse.nickname(), + loginSuccessResponse.role()))); + } - @Operation(summary = "access token 재발급 API", description = "refresh token으로 access token을 재발급하는 GET API입니다.") - @GetMapping("/refresh-token") - public ResponseEntity> refreshToken( - @RequestParam final String refreshToken - ) { - AccessTokenGetSuccess accessTokenGetSuccess = authenticationService.generateAccessTokenFromRefreshToken(refreshToken); - return ResponseEntity.status(HttpStatus.OK) - .body(SuccessResponse.of(MemberSuccessCode.ISSUE_REFRESH_TOKEN_SUCCESS, accessTokenGetSuccess)); - } + @Override + @GetMapping("/refresh-token") + public ResponseEntity> refreshToken( + @RequestParam final String refreshToken + ) { + AccessTokenGetSuccess accessTokenGetSuccess = authenticationService.generateAccessTokenFromRefreshToken( + refreshToken); + return ResponseEntity.status(HttpStatus.OK) + .body(SuccessResponse.of(MemberSuccessCode.ISSUE_REFRESH_TOKEN_SUCCESS, accessTokenGetSuccess)); + } - @Operation(summary = "로그아웃 API", description = "로그아웃하는 POST API입니다.") - @PostMapping("/sign-out") - public ResponseEntity> signOut( - final Principal principal - ) { - tokenService.deleteRefreshToken(Long.valueOf(principal.getName())); - return ResponseEntity.status(HttpStatus.OK) - .body(SuccessResponse.from(MemberSuccessCode.SIGN_OUT_SUCCESS)); - } + @Override + @PostMapping("/sign-out") + public ResponseEntity> signOut( + final Principal principal + ) { + tokenService.deleteRefreshToken(Long.valueOf(principal.getName())); + return ResponseEntity.status(HttpStatus.OK) + .body(SuccessResponse.from(MemberSuccessCode.SIGN_OUT_SUCCESS)); + } } \ No newline at end of file From 236f78272ff983e0bfbb56c236632d006e216a12 Mon Sep 17 00:00:00 2001 From: hyerinhwang-sailin Date: Wed, 9 Oct 2024 01:00:56 +0900 Subject: [PATCH 05/16] =?UTF-8?q?[#241]=20refactor(PerformanceApi):=20perf?= =?UTF-8?q?ormance=20swagger=20=EB=AC=B8=EC=84=9C=ED=99=94?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../performance/api/PerformanceApi.java | 70 +++++++++++++++++++ 1 file changed, 70 insertions(+) create mode 100644 src/main/java/com/beat/domain/performance/api/PerformanceApi.java diff --git a/src/main/java/com/beat/domain/performance/api/PerformanceApi.java b/src/main/java/com/beat/domain/performance/api/PerformanceApi.java new file mode 100644 index 00000000..b9fb7228 --- /dev/null +++ b/src/main/java/com/beat/domain/performance/api/PerformanceApi.java @@ -0,0 +1,70 @@ +package com.beat.domain.performance.api; + +import org.springframework.http.ResponseEntity; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestBody; + +import com.beat.domain.performance.application.dto.bookingPerformanceDetail.BookingPerformanceDetailResponse; +import com.beat.domain.performance.application.dto.create.PerformanceRequest; +import com.beat.domain.performance.application.dto.create.PerformanceResponse; +import com.beat.domain.performance.application.dto.makerPerformance.MakerPerformanceResponse; +import com.beat.domain.performance.application.dto.modify.PerformanceModifyDetailResponse; +import com.beat.domain.performance.application.dto.modify.PerformanceModifyRequest; +import com.beat.domain.performance.application.dto.modify.PerformanceModifyResponse; +import com.beat.domain.performance.application.dto.performanceDetail.PerformanceDetailResponse; +import com.beat.global.auth.annotation.CurrentMember; +import com.beat.global.common.dto.SuccessResponse; + +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.responses.ApiResponse; +import io.swagger.v3.oas.annotations.responses.ApiResponses; +import io.swagger.v3.oas.annotations.tags.Tag; + +@Tag(name = "Performance", description = "공연 관련 API") +public interface PerformanceApi { + + @Operation(summary = "공연 생성 API", description = "공연을 생성하는 POST API입니다.") + ResponseEntity> createPerformance( + @CurrentMember Long memberId, + @RequestBody PerformanceRequest performanceRequest); + + @Operation(summary = "공연 정보 수정 API", description = "공연 정보를 수정하는 PUT API입니다.") + @ApiResponses({ + @ApiResponse(responseCode = "200", description = "공연 정보 수정 성공"), + @ApiResponse(responseCode = "400", description = "잘못된 요청 - 회차 최대 개수 초과"), + @ApiResponse(responseCode = "400", description = "잘못된 요청 - 티켓 가격은 음수일 수 없습니다."), + @ApiResponse(responseCode = "400", description = "잘못된 요청 - 예매자가 존재하여 가격을 수정할 수 없습니다."), + @ApiResponse(responseCode = "403", description = "권한 없음 - 해당 공연의 소유자가 아닙니다."), + @ApiResponse(responseCode = "404", description = "존재하지 않는 공연 ID로 수정 요청을 보낼 수 없습니다."), + @ApiResponse(responseCode = "404", description = "존재하지 않는 회원 ID로 수정 요청을 보낼 수 없습니다."), + @ApiResponse(responseCode = "404", description = "존재하지 않는 회차 ID로 수정 요청을 보낼 수 없습니다."), + @ApiResponse(responseCode = "404", description = "존재하지 않는 등장인물 ID로 수정 요청을 보낼 수 없습니다."), + @ApiResponse(responseCode = "404", description = "존재하지 않는 스태프 ID로 수정 요청을 보낼 수 없습니다."), + @ApiResponse(responseCode = "404", description = "존재하지 않는 상세이미지 ID로 수정 요청을 보낼 수 없습니다."), + @ApiResponse(responseCode = "500", description = "서버 내부 오류")}) + ResponseEntity> updatePerformance( + @CurrentMember Long memberId, + @RequestBody PerformanceModifyRequest performanceModifyRequest); + + @Operation(summary = "공연 수정 페이지 정보 조회 API", description = "공연 정보를 조회하는 GET API입니다.") + ResponseEntity> getPerformanceForEdit( + @CurrentMember Long memberId, + @PathVariable Long performanceId); + + @Operation(summary = "공연 상세정보 조회 API", description = "공연 상세페이지의 공연 상세정보를 조회하는 GET API입니다.") + ResponseEntity> getPerformanceDetail( + @PathVariable Long performanceId); + + @Operation(summary = "예매하기 관련 공연 정보 조회 API", description = "예매하기 페이지에서 필요한 예매 관련 공연 정보를 조회하는 GET API입니다.") + ResponseEntity> getBookingPerformanceDetail( + @PathVariable Long performanceId); + + @Operation(summary = "회원이 등록한 공연 목록 조회 API", description = "회원이 등록한 공연 목록을 조회하는 GET API입니다.") + ResponseEntity> getUserPerformances( + @CurrentMember Long memberId); + + @Operation(summary = "공연 삭제 API", description = "공연을 삭제하는 DELETE API입니다.") + ResponseEntity> deletePerformance( + @CurrentMember Long memberId, + @PathVariable Long performanceId); +} From 5b0b38204fe7f1bf32cffd0acf01f90b60808330 Mon Sep 17 00:00:00 2001 From: hyerinhwang-sailin Date: Wed, 9 Oct 2024 01:01:27 +0900 Subject: [PATCH 06/16] =?UTF-8?q?[#241]=20refactor(PerformanceController):?= =?UTF-8?q?=20performance=20swagger=20=EB=AC=B8=EC=84=9C=ED=99=94?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../api/PerformanceController.java | 170 +++++++++--------- 1 file changed, 80 insertions(+), 90 deletions(-) diff --git a/src/main/java/com/beat/domain/performance/api/PerformanceController.java b/src/main/java/com/beat/domain/performance/api/PerformanceController.java index 6cc25c77..ce1a15a7 100644 --- a/src/main/java/com/beat/domain/performance/api/PerformanceController.java +++ b/src/main/java/com/beat/domain/performance/api/PerformanceController.java @@ -1,115 +1,105 @@ package com.beat.domain.performance.api; +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.PostMapping; +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.RestController; + import com.beat.domain.performance.application.PerformanceManagementService; import com.beat.domain.performance.application.PerformanceModifyService; +import com.beat.domain.performance.application.PerformanceService; import com.beat.domain.performance.application.dto.bookingPerformanceDetail.BookingPerformanceDetailResponse; -import com.beat.domain.performance.application.dto.makerPerformance.MakerPerformanceResponse; -import com.beat.domain.performance.application.dto.performanceDetail.PerformanceDetailResponse; -import com.beat.domain.performance.application.dto.modify.PerformanceModifyDetailResponse; import com.beat.domain.performance.application.dto.create.PerformanceRequest; import com.beat.domain.performance.application.dto.create.PerformanceResponse; +import com.beat.domain.performance.application.dto.makerPerformance.MakerPerformanceResponse; +import com.beat.domain.performance.application.dto.modify.PerformanceModifyDetailResponse; import com.beat.domain.performance.application.dto.modify.PerformanceModifyRequest; import com.beat.domain.performance.application.dto.modify.PerformanceModifyResponse; +import com.beat.domain.performance.application.dto.performanceDetail.PerformanceDetailResponse; import com.beat.domain.performance.exception.PerformanceSuccessCode; -import com.beat.domain.performance.application.PerformanceService; import com.beat.global.auth.annotation.CurrentMember; import com.beat.global.common.dto.SuccessResponse; -import io.swagger.v3.oas.annotations.Operation; -import io.swagger.v3.oas.annotations.responses.ApiResponse; -import io.swagger.v3.oas.annotations.responses.ApiResponses; + import lombok.RequiredArgsConstructor; -import org.springframework.http.HttpStatus; -import org.springframework.http.ResponseEntity; -import org.springframework.web.bind.annotation.DeleteMapping; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.PathVariable; -import org.springframework.web.bind.annotation.PostMapping; -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.RestController; @RestController @RequestMapping("/api/performances") @RequiredArgsConstructor -public class PerformanceController { +public class PerformanceController implements PerformanceApi { + + private final PerformanceService performanceService; + private final PerformanceManagementService performanceManagementService; + private final PerformanceModifyService performanceModifyService; - private final PerformanceService performanceService; - private final PerformanceManagementService performanceManagementService; - private final PerformanceModifyService performanceModifyService; - - @Operation(summary = "공연 생성 API", description = "공연을 생성하는 POST API입니다.") - @PostMapping - public ResponseEntity> createPerformance( - @CurrentMember Long memberId, - @RequestBody PerformanceRequest performanceRequest) { - PerformanceResponse response = performanceManagementService.createPerformance(memberId, performanceRequest); - return ResponseEntity.status(HttpStatus.CREATED) - .body(SuccessResponse.of(PerformanceSuccessCode.PERFORMANCE_CREATE_SUCCESS, response)); - } + @Override + @PostMapping + public ResponseEntity> createPerformance( + @CurrentMember Long memberId, + @RequestBody PerformanceRequest performanceRequest) { + PerformanceResponse response = performanceManagementService.createPerformance(memberId, performanceRequest); + return ResponseEntity.status(HttpStatus.CREATED) + .body(SuccessResponse.of(PerformanceSuccessCode.PERFORMANCE_CREATE_SUCCESS, response)); + } - @Operation(summary = "공연 정보 수정 API", description = "공연 정보를 수정하는 PUT API입니다.") - @ApiResponses(value = { - @ApiResponse(responseCode = "200", description = "공연 정보 수정 성공"), - @ApiResponse(responseCode = "400", description = "잘못된 요청 - 회차 최대 개수 초과"), - @ApiResponse(responseCode = "400", description = "잘못된 요청 - 티켓 가격은 음수일 수 없습니다."), - @ApiResponse(responseCode = "400", description = "잘못된 요청 - 예매자가 존재하여 가격을 수정할 수 없습니다."), - @ApiResponse(responseCode = "403", description = "권한 없음 - 해당 공연의 소유자가 아닙니다."), - @ApiResponse(responseCode = "404", description = "존재하지 않는 공연 ID로 수정 요청을 보낼 수 없습니다."), - @ApiResponse(responseCode = "404", description = "존재하지 않는 회원 ID로 수정 요청을 보낼 수 없습니다."), - @ApiResponse(responseCode = "404", description = "존재하지 않는 회차 ID로 수정 요청을 보낼 수 없습니다."), - @ApiResponse(responseCode = "404", description = "존재하지 않는 등장인물 ID로 수정 요청을 보낼 수 없습니다."), - @ApiResponse(responseCode = "404", description = "존재하지 않는 스태프 ID로 수정 요청을 보낼 수 없습니다."), - @ApiResponse(responseCode = "404", description = "존재하지 않는 상세이미지 ID로 수정 요청을 보낼 수 없습니다."), - @ApiResponse(responseCode = "500", description = "서버 내부 오류") - }) - @PutMapping - public ResponseEntity> updatePerformance( - @CurrentMember Long memberId, - @RequestBody PerformanceModifyRequest performanceModifyRequest) { - PerformanceModifyResponse response = performanceModifyService.modifyPerformance(memberId, performanceModifyRequest); - return ResponseEntity.status(HttpStatus.OK) - .body(SuccessResponse.of(PerformanceSuccessCode.PERFORMANCE_UPDATE_SUCCESS, response)); - } + @Override + @PutMapping + public ResponseEntity> updatePerformance( + @CurrentMember Long memberId, + @RequestBody PerformanceModifyRequest performanceModifyRequest) { + PerformanceModifyResponse response = performanceModifyService.modifyPerformance(memberId, + performanceModifyRequest); + return ResponseEntity.status(HttpStatus.OK) + .body(SuccessResponse.of(PerformanceSuccessCode.PERFORMANCE_UPDATE_SUCCESS, response)); + } - @Operation(summary = "공연 수정 페이지 정보 조회 API", description = "공연 정보를 조회하는 GET API입니다.") - @GetMapping("/{performanceId}") - public ResponseEntity> getPerformanceForEdit( - @CurrentMember Long memberId, - @PathVariable Long performanceId) { - PerformanceModifyDetailResponse response = performanceService.getPerformanceEdit(memberId, performanceId); - return ResponseEntity.ok(SuccessResponse.of(PerformanceSuccessCode.PERFORMANCE_MODIFY_PAGE_SUCCESS, response)); - } + @Override + @GetMapping("/{performanceId}") + public ResponseEntity> getPerformanceForEdit( + @CurrentMember Long memberId, + @PathVariable Long performanceId) { + PerformanceModifyDetailResponse response = performanceService.getPerformanceEdit(memberId, performanceId); + return ResponseEntity.ok(SuccessResponse.of(PerformanceSuccessCode.PERFORMANCE_MODIFY_PAGE_SUCCESS, response)); + } - @Operation(summary = "공연 상세정보 조회 API", description = "공연 상세페이지의 공연 상세정보를 조회하는 GET API입니다.") - @GetMapping("/detail/{performanceId}") - public ResponseEntity> getPerformanceDetail( - @PathVariable Long performanceId) { - PerformanceDetailResponse performanceDetail = performanceService.getPerformanceDetail(performanceId); - return ResponseEntity.ok(SuccessResponse.of(PerformanceSuccessCode.PERFORMANCE_RETRIEVE_SUCCESS, performanceDetail)); - } + @Override + @GetMapping("/detail/{performanceId}") + public ResponseEntity> getPerformanceDetail( + @PathVariable Long performanceId) { + PerformanceDetailResponse performanceDetail = performanceService.getPerformanceDetail(performanceId); + return ResponseEntity.ok( + SuccessResponse.of(PerformanceSuccessCode.PERFORMANCE_RETRIEVE_SUCCESS, performanceDetail)); + } - @Operation(summary = "예매하기 관련 공연 정보 조회 API", description = "예매하기 페이지에서 필요한 예매 관련 공연 정보를 조회하는 GET API입니다.") - @GetMapping("/booking/{performanceId}") - public ResponseEntity> getBookingPerformanceDetail( - @PathVariable Long performanceId) { - BookingPerformanceDetailResponse bookingPerformanceDetail = performanceService.getBookingPerformanceDetail(performanceId); - return ResponseEntity.ok(SuccessResponse.of(PerformanceSuccessCode.BOOKING_PERFORMANCE_RETRIEVE_SUCCESS, bookingPerformanceDetail)); - } + @Override + @GetMapping("/booking/{performanceId}") + public ResponseEntity> getBookingPerformanceDetail( + @PathVariable Long performanceId) { + BookingPerformanceDetailResponse bookingPerformanceDetail = performanceService.getBookingPerformanceDetail( + performanceId); + return ResponseEntity.ok( + SuccessResponse.of(PerformanceSuccessCode.BOOKING_PERFORMANCE_RETRIEVE_SUCCESS, bookingPerformanceDetail)); + } - @Operation(summary = "회원이 등록한 공연 목록 조회 API", description = "회원이 등록한 공연 목록을 조회하는 GET API입니다.") - @GetMapping("/user") - public ResponseEntity> getUserPerformances(@CurrentMember Long memberId) { - MakerPerformanceResponse response = performanceService.getMemberPerformances(memberId); - return ResponseEntity.ok(SuccessResponse.of(PerformanceSuccessCode.MAKER_PERFORMANCE_RETRIEVE_SUCCESS, response)); - } + @Override + @GetMapping("/user") + public ResponseEntity> getUserPerformances(@CurrentMember Long memberId) { + MakerPerformanceResponse response = performanceService.getMemberPerformances(memberId); + return ResponseEntity.ok( + SuccessResponse.of(PerformanceSuccessCode.MAKER_PERFORMANCE_RETRIEVE_SUCCESS, response)); + } - @Operation(summary = "공연 삭제 API", description = "공연을 삭제하는 DELETE API입니다.") - @DeleteMapping("/{performanceId}") - public ResponseEntity> deletePerformance( - @CurrentMember Long memberId, - @PathVariable Long performanceId) { - performanceManagementService.deletePerformance(memberId, performanceId); - return ResponseEntity.ok(SuccessResponse.from(PerformanceSuccessCode.PERFORMANCE_DELETE_SUCCESS)); - } + @Override + @DeleteMapping("/{performanceId}") + public ResponseEntity> deletePerformance( + @CurrentMember Long memberId, + @PathVariable Long performanceId) { + performanceManagementService.deletePerformance(memberId, performanceId); + return ResponseEntity.ok(SuccessResponse.from(PerformanceSuccessCode.PERFORMANCE_DELETE_SUCCESS)); + } } \ No newline at end of file From 8beb1b06d90a200d62bb62b2bbeae1964de00fbf Mon Sep 17 00:00:00 2001 From: hyerinhwang-sailin Date: Wed, 9 Oct 2024 01:01:39 +0900 Subject: [PATCH 07/16] =?UTF-8?q?[#241]=20refactor(ScheduleApi):=20schedul?= =?UTF-8?q?e=20swagger=20=EB=AC=B8=EC=84=9C=ED=99=94?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../beat/domain/schedule/api/ScheduleApi.java | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 src/main/java/com/beat/domain/schedule/api/ScheduleApi.java diff --git a/src/main/java/com/beat/domain/schedule/api/ScheduleApi.java b/src/main/java/com/beat/domain/schedule/api/ScheduleApi.java new file mode 100644 index 00000000..50dc90ca --- /dev/null +++ b/src/main/java/com/beat/domain/schedule/api/ScheduleApi.java @@ -0,0 +1,20 @@ +package com.beat.domain.schedule.api; + +import org.springframework.http.ResponseEntity; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestParam; + +import com.beat.domain.schedule.application.dto.TicketAvailabilityResponse; +import com.beat.global.common.dto.SuccessResponse; + +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.tags.Tag; + +@Tag(name = "Schedule", description = "스케줄 관련 API") +public interface ScheduleApi { + + @Operation(summary = "티켓 구매 가능 여부 조회 API", description = "티켓 구매 가능 여부를 확인하는 GET API입니다.") + ResponseEntity> getTicketAvailability( + @PathVariable Long scheduleId, + @RequestParam int purchaseTicketCount); +} From c964c35cfc3e0a61407f2a249c1a6c13e6cefa1e Mon Sep 17 00:00:00 2001 From: hyerinhwang-sailin Date: Wed, 9 Oct 2024 01:01:47 +0900 Subject: [PATCH 08/16] =?UTF-8?q?[#241]=20refactor(ScheduleController):=20?= =?UTF-8?q?schedule=20swagger=20=EB=AC=B8=EC=84=9C=ED=99=94?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../schedule/api/ScheduleController.java | 38 ++++++++++--------- 1 file changed, 21 insertions(+), 17 deletions(-) diff --git a/src/main/java/com/beat/domain/schedule/api/ScheduleController.java b/src/main/java/com/beat/domain/schedule/api/ScheduleController.java index 3e0d8982..b8caec54 100644 --- a/src/main/java/com/beat/domain/schedule/api/ScheduleController.java +++ b/src/main/java/com/beat/domain/schedule/api/ScheduleController.java @@ -1,11 +1,5 @@ package com.beat.domain.schedule.api; -import com.beat.domain.schedule.application.ScheduleService; -import com.beat.domain.schedule.application.dto.TicketAvailabilityRequest; -import com.beat.domain.schedule.application.dto.TicketAvailabilityResponse; -import com.beat.domain.schedule.exception.ScheduleSuccessCode; -import com.beat.global.common.dto.SuccessResponse; -import lombok.RequiredArgsConstructor; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.GetMapping; @@ -14,22 +8,32 @@ import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RestController; +import com.beat.domain.schedule.application.ScheduleService; +import com.beat.domain.schedule.application.dto.TicketAvailabilityRequest; +import com.beat.domain.schedule.application.dto.TicketAvailabilityResponse; +import com.beat.domain.schedule.exception.ScheduleSuccessCode; +import com.beat.global.common.dto.SuccessResponse; + +import lombok.RequiredArgsConstructor; + @RestController @RequestMapping("/api/schedules") @RequiredArgsConstructor -public class ScheduleController { +public class ScheduleController implements ScheduleApi { - private final ScheduleService scheduleService; + private final ScheduleService scheduleService; - @GetMapping("/{scheduleId}/availability") - public ResponseEntity> getTicketAvailability( - @PathVariable Long scheduleId, - @RequestParam int purchaseTicketCount) { + @Override + @GetMapping("/{scheduleId}/availability") + public ResponseEntity> getTicketAvailability( + @PathVariable Long scheduleId, + @RequestParam int purchaseTicketCount) { - TicketAvailabilityRequest ticketAvailabilityRequest = TicketAvailabilityRequest.of(purchaseTicketCount); - TicketAvailabilityResponse response = scheduleService.findTicketAvailability(scheduleId, ticketAvailabilityRequest); + TicketAvailabilityRequest ticketAvailabilityRequest = TicketAvailabilityRequest.of(purchaseTicketCount); + TicketAvailabilityResponse response = scheduleService.findTicketAvailability(scheduleId, + ticketAvailabilityRequest); - return ResponseEntity.status(HttpStatus.OK) - .body(SuccessResponse.of(ScheduleSuccessCode.TICKET_AVAILABILITY_RETRIEVAL_SUCCESS, response)); - } + return ResponseEntity.status(HttpStatus.OK) + .body(SuccessResponse.of(ScheduleSuccessCode.TICKET_AVAILABILITY_RETRIEVAL_SUCCESS, response)); + } } \ No newline at end of file From 238c5a08d01b1968049def6e9536b6de639f43aa Mon Sep 17 00:00:00 2001 From: hyerinhwang-sailin Date: Wed, 9 Oct 2024 01:02:00 +0900 Subject: [PATCH 09/16] =?UTF-8?q?[#241]=20refactor(TicketApi):=20ticket=20?= =?UTF-8?q?swagger=20=EB=AC=B8=EC=84=9C=ED=99=94?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../beat/domain/booking/api/TicketApi.java | 54 +++++++++++++++++++ 1 file changed, 54 insertions(+) create mode 100644 src/main/java/com/beat/domain/booking/api/TicketApi.java diff --git a/src/main/java/com/beat/domain/booking/api/TicketApi.java b/src/main/java/com/beat/domain/booking/api/TicketApi.java new file mode 100644 index 00000000..fe3ae02c --- /dev/null +++ b/src/main/java/com/beat/domain/booking/api/TicketApi.java @@ -0,0 +1,54 @@ +package com.beat.domain.booking.api; + +import org.springframework.http.ResponseEntity; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestParam; + +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.schedule.domain.ScheduleNumber; +import com.beat.global.auth.annotation.CurrentMember; +import com.beat.global.common.dto.SuccessResponse; + +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.media.Content; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.responses.ApiResponse; +import io.swagger.v3.oas.annotations.responses.ApiResponses; +import io.swagger.v3.oas.annotations.tags.Tag; + +@Tag(name = "Ticket", description = "티켓 관련 API") +public interface TicketApi { + + @Operation(summary = "예매자 목록 조회 API", description = "메이커가 자신의 공연에 대한 예매자 목록을 조회하는 GET API입니다.") + @ApiResponses({ + @ApiResponse(responseCode = "200", description = "예매자 목록 조회 성공", + content = @Content(schema = @Schema(implementation = SuccessResponse.class))) + }) + ResponseEntity> getTickets( + @CurrentMember Long memberId, + @PathVariable Long performanceId, + @RequestParam(required = false) ScheduleNumber scheduleNumber, + @RequestParam(required = false) BookingStatus bookingStatus); + + @Operation(summary = "예매자 입금여부 수정 및 웹발신 API", description = "메이커가 자신의 공연에 대한 예매자의 입금여부 정보를 수정한 뒤 예매확정 웹발신을 보내는 PUT API입니다.") + @ApiResponses({ + @ApiResponse(responseCode = "200", description = "예매자 입금여부 수정 성공", + content = @Content(schema = @Schema(implementation = SuccessResponse.class))) + }) + ResponseEntity> updateTickets( + @CurrentMember Long memberId, + @RequestBody TicketUpdateRequest request); + + @Operation(summary = "예매자 취소 API", description = "메이커가 자신의 공연에 대한 1명 이상의 예매자의 정보를 취소 상태로 변경하는 PATCH API입니다.") + @ApiResponses({ + @ApiResponse(responseCode = "200", description = "예매자 취소 성공", + content = @Content(schema = @Schema(implementation = SuccessResponse.class))) + }) + ResponseEntity> cancelTickets( + @CurrentMember Long memberId, + @RequestBody TicketCancelRequest ticketCancelRequest); +} From c7b836a488c5272e17a6639cf4f0e2e1a8be07d7 Mon Sep 17 00:00:00 2001 From: hyerinhwang-sailin Date: Wed, 9 Oct 2024 01:02:07 +0900 Subject: [PATCH 10/16] =?UTF-8?q?[#241]=20refactor(TicketController):=20ti?= =?UTF-8?q?cket=20swagger=20=EB=AC=B8=EC=84=9C=ED=99=94?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../domain/booking/api/TicketController.java | 81 ++++++++++--------- 1 file changed, 45 insertions(+), 36 deletions(-) diff --git a/src/main/java/com/beat/domain/booking/api/TicketController.java b/src/main/java/com/beat/domain/booking/api/TicketController.java index ef10a3d7..313abd92 100644 --- a/src/main/java/com/beat/domain/booking/api/TicketController.java +++ b/src/main/java/com/beat/domain/booking/api/TicketController.java @@ -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> 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> 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> 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> 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> updateTickets( + @CurrentMember Long memberId, + @RequestBody TicketUpdateRequest request) { + ticketService.updateTickets(memberId, request); + return ResponseEntity.ok(SuccessResponse.from(BookingSuccessCode.TICKET_UPDATE_SUCCESS)); + } + + @Override + @PatchMapping + public ResponseEntity> cancelTickets( + @CurrentMember Long memberId, + @RequestBody TicketCancelRequest ticketCancelRequest) { + ticketService.cancelTickets(memberId, ticketCancelRequest); + return ResponseEntity.ok(SuccessResponse.from(BookingSuccessCode.TICKET_CANCEL_SUCCESS)); + } } From 555c57d26667ed5ebf254c715f6c422a0245be9a Mon Sep 17 00:00:00 2001 From: hyerinhwang-sailin Date: Fri, 11 Oct 2024 00:34:48 +0900 Subject: [PATCH 11/16] =?UTF-8?q?[#241]=20refactor(BookingApi):=20booking?= =?UTF-8?q?=20swagger=20=EB=AC=B8=EC=84=9C=ED=99=94=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../beat/domain/booking/api/BookingApi.java | 125 +++++++++++++++--- 1 file changed, 105 insertions(+), 20 deletions(-) diff --git a/src/main/java/com/beat/domain/booking/api/BookingApi.java b/src/main/java/com/beat/domain/booking/api/BookingApi.java index 2ecac317..00d21cf8 100644 --- a/src/main/java/com/beat/domain/booking/api/BookingApi.java +++ b/src/main/java/com/beat/domain/booking/api/BookingApi.java @@ -13,6 +13,7 @@ import com.beat.domain.booking.application.dto.MemberBookingResponse; import com.beat.domain.booking.application.dto.MemberBookingRetrieveResponse; import com.beat.global.auth.annotation.CurrentMember; +import com.beat.global.common.dto.ErrorResponse; import com.beat.global.common.dto.SuccessResponse; import io.swagger.v3.oas.annotations.Operation; @@ -26,35 +27,119 @@ public interface BookingApi { @Operation(summary = "회원 예매 API", description = "회원이 예매를 요청하는 POST API입니다.") - @ApiResponses({ - @ApiResponse(responseCode = "201", description = "회원 예매가 성공적으로 완료되었습니다.", - content = @Content(schema = @Schema(implementation = SuccessResponse.class))) - }) + @ApiResponses( + value = { + @ApiResponse( + responseCode = "201", + description = "회원 예매가 성공적으로 완료되었습니다.", + content = @Content(schema = @Schema(implementation = SuccessResponse.class)) + ), + @ApiResponse( + responseCode = "400", + description = "필수 데이터가 누락되었습니다.", + content = @Content(schema = @Schema(implementation = ErrorResponse.class)) + ), + @ApiResponse( + responseCode = "400", + description = "잘못된 데이터 형식입니다.", + content = @Content(schema = @Schema(implementation = ErrorResponse.class)) + ), + @ApiResponse( + responseCode = "400", + description = "잘못된 요청 형식입니다.", + content = @Content(schema = @Schema(implementation = ErrorResponse.class)) + ), + @ApiResponse( + responseCode = "404", + description = "회원 정보를 찾을 수 없습니다.", + content = @Content(schema = @Schema(implementation = ErrorResponse.class)) + ), + @ApiResponse( + responseCode = "404", + description = "공연 정보를 찾을 수 없습니다.", + content = @Content(schema = @Schema(implementation = ErrorResponse.class)) + ), + @ApiResponse( + responseCode = "404", + description = "회차 정보를 찾을 수 없습니다.", + content = @Content(schema = @Schema(implementation = ErrorResponse.class)) + ) + } + ) ResponseEntity> createMemberBooking( @CurrentMember Long memberId, - @RequestBody MemberBookingRequest memberBookingRequest); + @RequestBody MemberBookingRequest memberBookingRequest + ); @Operation(summary = "회원 예매 조회 API", description = "회원이 예매를 조회하는 GET API입니다.") - @ApiResponses({ - @ApiResponse(responseCode = "200", description = "회원 예매 조회가 성공적으로 완료되었습니다.", - content = @Content(schema = @Schema(implementation = SuccessResponse.class))) - }) + @ApiResponses( + value = { + @ApiResponse( + responseCode = "200", + description = "회원 예매 조회가 성공적으로 완료되었습니다.", + content = @Content(schema = @Schema(implementation = SuccessResponse.class)) + ), + @ApiResponse( + responseCode = "404", + description = "입력하신 정보와 일치하는 예매 내역이 없습니다. 확인 후 다시 조회해주세요.", + content = @Content(schema = @Schema(implementation = ErrorResponse.class)) + ) + } + ) ResponseEntity>> getMemberBookings( - @CurrentMember Long memberId); + @CurrentMember Long memberId + ); @Operation(summary = "비회원 예매 API", description = "비회원이 예매를 요청하는 POST API입니다.") - @ApiResponses({ - @ApiResponse(responseCode = "201", description = "비회원 예매가 성공적으로 완료되었습니다.", - content = @Content(schema = @Schema(implementation = SuccessResponse.class))) - }) + @ApiResponses( + value = { + @ApiResponse( + responseCode = "201", + description = "비회원 예매가 성공적으로 완료되었습니다.", + content = @Content(schema = @Schema(implementation = SuccessResponse.class)) + ), + @ApiResponse( + responseCode = "400", + description = "필수 데이터가 누락되었습니다.", + content = @Content(schema = @Schema(implementation = ErrorResponse.class)) + ), + @ApiResponse( + responseCode = "400", + description = "잘못된 데이터 형식입니다.", + content = @Content(schema = @Schema(implementation = ErrorResponse.class)) + ), + @ApiResponse( + responseCode = "404", + description = "공연 정보를 찾을 수 없습니다.", + content = @Content(schema = @Schema(implementation = ErrorResponse.class)) + ), + @ApiResponse( + responseCode = "404", + description = "회차 정보를 찾을 수 없습니다.", + content = @Content(schema = @Schema(implementation = ErrorResponse.class)) + ) + } + ) ResponseEntity> createGuestBookings( - @RequestBody GuestBookingRequest guestBookingRequest); + @RequestBody GuestBookingRequest guestBookingRequest + ); @Operation(summary = "비회원 예매 조회 API", description = "비회원이 예매를 조회하는 POST API입니다.") - @ApiResponses({ - @ApiResponse(responseCode = "200", description = "비회원 예매 조회가 성공적으로 완료되었습니다.", - content = @Content(schema = @Schema(implementation = SuccessResponse.class))) - }) + @ApiResponses( + value = { + @ApiResponse( + responseCode = "200", + description = "비회원 예매 조회가 성공적으로 완료되었습니다.", + content = @Content(schema = @Schema(implementation = SuccessResponse.class)) + ), + @ApiResponse( + responseCode = "404", + description = "입력하신 정보와 일치하는 예매 내역이 없습니다. 확인 후 다시 조회해주세요.", + content = @Content(schema = @Schema(implementation = ErrorResponse.class)) + ) + } + ) ResponseEntity>> getGuestBookings( - @RequestBody GuestBookingRetrieveRequest guestBookingRetrieveRequest); + @RequestBody GuestBookingRetrieveRequest guestBookingRetrieveRequest + ); } From ea6445d4a970bb5705b24d2ec2f54e784ff1c52e Mon Sep 17 00:00:00 2001 From: hyerinhwang-sailin Date: Fri, 11 Oct 2024 00:35:01 +0900 Subject: [PATCH 12/16] =?UTF-8?q?[#241]=20refactor(MemberApi):=20member=20?= =?UTF-8?q?swagger=20=EB=AC=B8=EC=84=9C=ED=99=94=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/beat/domain/member/api/MemberApi.java | 67 +++++++++++++++---- 1 file changed, 53 insertions(+), 14 deletions(-) diff --git a/src/main/java/com/beat/domain/member/api/MemberApi.java b/src/main/java/com/beat/domain/member/api/MemberApi.java index ae420ef4..f4cbd052 100644 --- a/src/main/java/com/beat/domain/member/api/MemberApi.java +++ b/src/main/java/com/beat/domain/member/api/MemberApi.java @@ -7,6 +7,7 @@ import com.beat.domain.member.dto.AccessTokenGetSuccess; import com.beat.domain.member.dto.LoginSuccessResponse; import com.beat.global.auth.client.dto.MemberLoginRequest; +import com.beat.global.common.dto.ErrorResponse; import com.beat.global.common.dto.SuccessResponse; import io.swagger.v3.oas.annotations.Operation; @@ -21,27 +22,65 @@ public interface MemberApi { @Operation(summary = "로그인/회원가입 API", description = "로그인/회원가입하는 POST API입니다.") - @ApiResponses({ - @ApiResponse(responseCode = "200", description = "로그인 또는 회원가입 성공", - content = @Content(schema = @Schema(implementation = SuccessResponse.class))) - }) + @ApiResponses( + value = { + @ApiResponse( + responseCode = "200", + description = "로그인 또는 회원가입 성공", + content = @Content(schema = @Schema(implementation = SuccessResponse.class)) + ), + @ApiResponse( + responseCode = "400", + description = "로그인 요청이 유효하지 않습니다.", + content = @Content(schema = @Schema(implementation = ErrorResponse.class)) + ), + @ApiResponse( + responseCode = "404", + description = "회원 정보를 찾을 수 없습니다.", + content = @Content(schema = @Schema(implementation = ErrorResponse.class)) + ) + } + ) ResponseEntity> signUp( String authorizationCode, MemberLoginRequest loginRequest, - HttpServletResponse response); + HttpServletResponse response + ); @Operation(summary = "access token 재발급 API", description = "refresh token으로 access token을 재발급하는 GET API입니다.") - @ApiResponses({ - @ApiResponse(responseCode = "200", description = "access token 재발급 성공", - content = @Content(schema = @Schema(implementation = SuccessResponse.class))) - }) + @ApiResponses( + value = { + @ApiResponse( + responseCode = "200", + description = "access token 재발급 성공", + content = @Content(schema = @Schema(implementation = SuccessResponse.class)) + ), + @ApiResponse( + responseCode = "400", + description = "유효하지 않은 토큰입니다.", + content = @Content(schema = @Schema(implementation = ErrorResponse.class)) + ) + } + ) ResponseEntity> refreshToken( - String refreshToken); + String refreshToken + ); @Operation(summary = "로그아웃 API", description = "로그아웃하는 POST API입니다.") - @ApiResponses({ - @ApiResponse(responseCode = "200", description = "로그아웃 성공", - content = @Content(schema = @Schema(implementation = SuccessResponse.class))) - }) + @ApiResponses( + value = { + @ApiResponse( + responseCode = "200", + description = "로그아웃 성공", + content = @Content(schema = @Schema(implementation = SuccessResponse.class)) + ), + @ApiResponse( + responseCode = "404", + description = "회원 정보를 찾을 수 없습니다.", + content = @Content(schema = @Schema(implementation = ErrorResponse.class)) + ) + } + ) ResponseEntity> signOut(Principal principal); } + From 4d9143d2dbf2a1d1080695e02b917cf1601a5aa4 Mon Sep 17 00:00:00 2001 From: hyerinhwang-sailin Date: Fri, 11 Oct 2024 00:35:17 +0900 Subject: [PATCH 13/16] =?UTF-8?q?[#241]=20refactor(PerformanceApi):=20perf?= =?UTF-8?q?ormance=20swagger=20=EB=AC=B8=EC=84=9C=ED=99=94=20=EC=88=98?= =?UTF-8?q?=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../performance/api/PerformanceApi.java | 165 +++++++++++++++--- 1 file changed, 145 insertions(+), 20 deletions(-) diff --git a/src/main/java/com/beat/domain/performance/api/PerformanceApi.java b/src/main/java/com/beat/domain/performance/api/PerformanceApi.java index b9fb7228..8b2acf96 100644 --- a/src/main/java/com/beat/domain/performance/api/PerformanceApi.java +++ b/src/main/java/com/beat/domain/performance/api/PerformanceApi.java @@ -13,9 +13,12 @@ import com.beat.domain.performance.application.dto.modify.PerformanceModifyResponse; import com.beat.domain.performance.application.dto.performanceDetail.PerformanceDetailResponse; import com.beat.global.auth.annotation.CurrentMember; +import com.beat.global.common.dto.ErrorResponse; import com.beat.global.common.dto.SuccessResponse; import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.media.Content; +import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.responses.ApiResponse; import io.swagger.v3.oas.annotations.responses.ApiResponses; import io.swagger.v3.oas.annotations.tags.Tag; @@ -24,47 +27,169 @@ public interface PerformanceApi { @Operation(summary = "공연 생성 API", description = "공연을 생성하는 POST API입니다.") + @ApiResponses( + value = { + @ApiResponse( + responseCode = "201", + description = "공연이 성공적으로 생성되었습니다.", + content = @Content(schema = @Schema(implementation = SuccessResponse.class)) + ), + @ApiResponse( + responseCode = "400", + description = "필수 데이터가 누락되었습니다.", + content = @Content(schema = @Schema(implementation = ErrorResponse.class)) + ), + @ApiResponse( + responseCode = "404", + description = "공연 정보를 찾을 수 없습니다.", + content = @Content(schema = @Schema(implementation = ErrorResponse.class)) + ) + } + ) ResponseEntity> createPerformance( @CurrentMember Long memberId, - @RequestBody PerformanceRequest performanceRequest); + @RequestBody PerformanceRequest performanceRequest + ); @Operation(summary = "공연 정보 수정 API", description = "공연 정보를 수정하는 PUT API입니다.") - @ApiResponses({ - @ApiResponse(responseCode = "200", description = "공연 정보 수정 성공"), - @ApiResponse(responseCode = "400", description = "잘못된 요청 - 회차 최대 개수 초과"), - @ApiResponse(responseCode = "400", description = "잘못된 요청 - 티켓 가격은 음수일 수 없습니다."), - @ApiResponse(responseCode = "400", description = "잘못된 요청 - 예매자가 존재하여 가격을 수정할 수 없습니다."), - @ApiResponse(responseCode = "403", description = "권한 없음 - 해당 공연의 소유자가 아닙니다."), - @ApiResponse(responseCode = "404", description = "존재하지 않는 공연 ID로 수정 요청을 보낼 수 없습니다."), - @ApiResponse(responseCode = "404", description = "존재하지 않는 회원 ID로 수정 요청을 보낼 수 없습니다."), - @ApiResponse(responseCode = "404", description = "존재하지 않는 회차 ID로 수정 요청을 보낼 수 없습니다."), - @ApiResponse(responseCode = "404", description = "존재하지 않는 등장인물 ID로 수정 요청을 보낼 수 없습니다."), - @ApiResponse(responseCode = "404", description = "존재하지 않는 스태프 ID로 수정 요청을 보낼 수 없습니다."), - @ApiResponse(responseCode = "404", description = "존재하지 않는 상세이미지 ID로 수정 요청을 보낼 수 없습니다."), - @ApiResponse(responseCode = "500", description = "서버 내부 오류")}) + @ApiResponses( + value = { + @ApiResponse( + responseCode = "200", + description = "공연 정보 수정 성공", + content = @Content(schema = @Schema(implementation = SuccessResponse.class)) + ), + @ApiResponse( + responseCode = "400", + description = "공연 회차는 최대 10개까지 추가할 수 있습니다.", + content = @Content(schema = @Schema(implementation = ErrorResponse.class)) + ), + @ApiResponse( + responseCode = "400", + description = "티켓 가격은 음수일 수 없습니다.", + content = @Content(schema = @Schema(implementation = ErrorResponse.class)) + ), + @ApiResponse( + responseCode = "400", + description = "예매자가 존재하여 가격을 수정할 수 없습니다.", + content = @Content(schema = @Schema(implementation = ErrorResponse.class)) + ), + @ApiResponse( + responseCode = "403", + description = "해당 공연의 소유자가 아닙니다.", + content = @Content(schema = @Schema(implementation = ErrorResponse.class)) + ), + @ApiResponse( + responseCode = "404", + description = "공연 정보를 찾을 수 없습니다.", + content = @Content(schema = @Schema(implementation = ErrorResponse.class)) + ) + } + ) ResponseEntity> updatePerformance( @CurrentMember Long memberId, - @RequestBody PerformanceModifyRequest performanceModifyRequest); + @RequestBody PerformanceModifyRequest performanceModifyRequest + ); @Operation(summary = "공연 수정 페이지 정보 조회 API", description = "공연 정보를 조회하는 GET API입니다.") + @ApiResponses( + value = { + @ApiResponse( + responseCode = "200", + description = "공연 수정 페이지 정보 조회 성공", + content = @Content(schema = @Schema(implementation = SuccessResponse.class)) + ), + @ApiResponse( + responseCode = "404", + description = "공연 정보를 찾을 수 없습니다.", + content = @Content(schema = @Schema(implementation = ErrorResponse.class)) + ) + } + ) ResponseEntity> getPerformanceForEdit( @CurrentMember Long memberId, - @PathVariable Long performanceId); + @PathVariable Long performanceId + ); @Operation(summary = "공연 상세정보 조회 API", description = "공연 상세페이지의 공연 상세정보를 조회하는 GET API입니다.") + @ApiResponses( + value = { + @ApiResponse( + responseCode = "200", + description = "공연 상세정보 조회 성공", + content = @Content(schema = @Schema(implementation = SuccessResponse.class)) + ), + @ApiResponse( + responseCode = "404", + description = "공연 정보를 찾을 수 없습니다.", + content = @Content(schema = @Schema(implementation = ErrorResponse.class)) + ) + } + ) ResponseEntity> getPerformanceDetail( - @PathVariable Long performanceId); + @PathVariable Long performanceId + ); @Operation(summary = "예매하기 관련 공연 정보 조회 API", description = "예매하기 페이지에서 필요한 예매 관련 공연 정보를 조회하는 GET API입니다.") + @ApiResponses( + value = { + @ApiResponse( + responseCode = "200", + description = "예매하기 관련 공연 정보 조회 성공", + content = @Content(schema = @Schema(implementation = SuccessResponse.class)) + ), + @ApiResponse( + responseCode = "404", + description = "공연 정보를 찾을 수 없습니다.", + content = @Content(schema = @Schema(implementation = ErrorResponse.class)) + ) + } + ) ResponseEntity> getBookingPerformanceDetail( - @PathVariable Long performanceId); + @PathVariable Long performanceId + ); @Operation(summary = "회원이 등록한 공연 목록 조회 API", description = "회원이 등록한 공연 목록을 조회하는 GET API입니다.") + @ApiResponses( + value = { + @ApiResponse( + responseCode = "200", + description = "회원이 등록한 공연 목록 조회 성공", + content = @Content(schema = @Schema(implementation = SuccessResponse.class)) + ), + @ApiResponse( + responseCode = "404", + description = "회원 정보를 찾을 수 없습니다.", + content = @Content(schema = @Schema(implementation = ErrorResponse.class)) + ) + } + ) ResponseEntity> getUserPerformances( - @CurrentMember Long memberId); + @CurrentMember Long memberId + ); @Operation(summary = "공연 삭제 API", description = "공연을 삭제하는 DELETE API입니다.") + @ApiResponses( + value = { + @ApiResponse( + responseCode = "200", + description = "공연 삭제 성공", + content = @Content(schema = @Schema(implementation = SuccessResponse.class)) + ), + @ApiResponse( + responseCode = "403", + description = "공연의 소유자가 아니거나 예매자가 있어 삭제할 수 없습니다.", + content = @Content(schema = @Schema(implementation = ErrorResponse.class)) + ), + @ApiResponse( + responseCode = "404", + description = "공연 정보를 찾을 수 없습니다.", + content = @Content(schema = @Schema(implementation = ErrorResponse.class)) + ) + } + ) ResponseEntity> deletePerformance( @CurrentMember Long memberId, - @PathVariable Long performanceId); + @PathVariable Long performanceId + ); } From 5ec452f165eb03b6163973029266357a6cd6b7e3 Mon Sep 17 00:00:00 2001 From: hyerinhwang-sailin Date: Fri, 11 Oct 2024 00:35:31 +0900 Subject: [PATCH 14/16] =?UTF-8?q?[#241]=20refactor(ScheduleApi):=20schedul?= =?UTF-8?q?e=20swagger=20=EB=AC=B8=EC=84=9C=ED=99=94=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../beat/domain/schedule/api/ScheduleApi.java | 32 ++++++++++++++++++- 1 file changed, 31 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/beat/domain/schedule/api/ScheduleApi.java b/src/main/java/com/beat/domain/schedule/api/ScheduleApi.java index 50dc90ca..ff04a221 100644 --- a/src/main/java/com/beat/domain/schedule/api/ScheduleApi.java +++ b/src/main/java/com/beat/domain/schedule/api/ScheduleApi.java @@ -5,16 +5,46 @@ import org.springframework.web.bind.annotation.RequestParam; import com.beat.domain.schedule.application.dto.TicketAvailabilityResponse; +import com.beat.global.common.dto.ErrorResponse; import com.beat.global.common.dto.SuccessResponse; import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.media.Content; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.responses.ApiResponse; +import io.swagger.v3.oas.annotations.responses.ApiResponses; import io.swagger.v3.oas.annotations.tags.Tag; @Tag(name = "Schedule", description = "스케줄 관련 API") public interface ScheduleApi { @Operation(summary = "티켓 구매 가능 여부 조회 API", description = "티켓 구매 가능 여부를 확인하는 GET API입니다.") + @ApiResponses( + value = { + @ApiResponse( + responseCode = "200", + description = "티켓 수량 조회가 성공적으로 완료되었습니다.", + content = @Content(schema = @Schema(implementation = SuccessResponse.class)) + ), + @ApiResponse( + responseCode = "400", + description = "잘못된 데이터 형식입니다.", + content = @Content(schema = @Schema(implementation = ErrorResponse.class)) + ), + @ApiResponse( + responseCode = "404", + description = "회차 정보를 찾을 수 없습니다.", + content = @Content(schema = @Schema(implementation = ErrorResponse.class)) + ), + @ApiResponse( + responseCode = "409", + description = "요청한 티켓 수량이 잔여 티켓 수를 초과했습니다.", + content = @Content(schema = @Schema(implementation = ErrorResponse.class)) + ) + } + ) ResponseEntity> getTicketAvailability( @PathVariable Long scheduleId, - @RequestParam int purchaseTicketCount); + @RequestParam int purchaseTicketCount + ); } From 1ae594d3cd7dbf71a0a9e9366be173cae1e8d6de Mon Sep 17 00:00:00 2001 From: hyerinhwang-sailin Date: Fri, 11 Oct 2024 00:35:43 +0900 Subject: [PATCH 15/16] =?UTF-8?q?[#241]=20refactor(TicketApi):=20ticket=20?= =?UTF-8?q?swagger=20=EB=AC=B8=EC=84=9C=ED=99=94=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../beat/domain/booking/api/TicketApi.java | 94 ++++++++++++++++--- 1 file changed, 79 insertions(+), 15 deletions(-) diff --git a/src/main/java/com/beat/domain/booking/api/TicketApi.java b/src/main/java/com/beat/domain/booking/api/TicketApi.java index fe3ae02c..f8e58d6b 100644 --- a/src/main/java/com/beat/domain/booking/api/TicketApi.java +++ b/src/main/java/com/beat/domain/booking/api/TicketApi.java @@ -11,6 +11,7 @@ import com.beat.domain.booking.domain.BookingStatus; import com.beat.domain.schedule.domain.ScheduleNumber; import com.beat.global.auth.annotation.CurrentMember; +import com.beat.global.common.dto.ErrorResponse; import com.beat.global.common.dto.SuccessResponse; import io.swagger.v3.oas.annotations.Operation; @@ -24,31 +25,94 @@ public interface TicketApi { @Operation(summary = "예매자 목록 조회 API", description = "메이커가 자신의 공연에 대한 예매자 목록을 조회하는 GET API입니다.") - @ApiResponses({ - @ApiResponse(responseCode = "200", description = "예매자 목록 조회 성공", - content = @Content(schema = @Schema(implementation = SuccessResponse.class))) - }) + @ApiResponses( + value = { + @ApiResponse( + responseCode = "200", + description = "예매자 목록 조회 성공", + content = @Content(schema = @Schema(implementation = SuccessResponse.class)) + ), + @ApiResponse( + responseCode = "404", + description = "입력하신 정보와 일치하는 예매자 목록이 없습니다.", + content = @Content(schema = @Schema(implementation = ErrorResponse.class)) + ), + @ApiResponse( + responseCode = "404", + description = "공연 정보를 찾을 수 없습니다.", + content = @Content(schema = @Schema(implementation = ErrorResponse.class)) + ), + @ApiResponse( + responseCode = "404", + description = "회차 정보를 찾을 수 없습니다.", + content = @Content(schema = @Schema(implementation = ErrorResponse.class)) + ) + } + ) ResponseEntity> getTickets( @CurrentMember Long memberId, @PathVariable Long performanceId, @RequestParam(required = false) ScheduleNumber scheduleNumber, - @RequestParam(required = false) BookingStatus bookingStatus); + @RequestParam(required = false) BookingStatus bookingStatus + ); @Operation(summary = "예매자 입금여부 수정 및 웹발신 API", description = "메이커가 자신의 공연에 대한 예매자의 입금여부 정보를 수정한 뒤 예매확정 웹발신을 보내는 PUT API입니다.") - @ApiResponses({ - @ApiResponse(responseCode = "200", description = "예매자 입금여부 수정 성공", - content = @Content(schema = @Schema(implementation = SuccessResponse.class))) - }) + @ApiResponses( + value = { + @ApiResponse( + responseCode = "200", + description = "예매자 입금여부 수정 성공", + content = @Content(schema = @Schema(implementation = SuccessResponse.class)) + ), + @ApiResponse( + responseCode = "400", + description = "이미 결제가 완료된 티켓의 상태는 변경할 수 없습니다.", + content = @Content(schema = @Schema(implementation = ErrorResponse.class)) + ), + @ApiResponse( + responseCode = "404", + description = "공연 정보를 찾을 수 없습니다.", + content = @Content(schema = @Schema(implementation = ErrorResponse.class)) + ), + @ApiResponse( + responseCode = "404", + description = "회차 정보를 찾을 수 없습니다.", + content = @Content(schema = @Schema(implementation = ErrorResponse.class)) + ) + } + ) ResponseEntity> updateTickets( @CurrentMember Long memberId, - @RequestBody TicketUpdateRequest request); + @RequestBody TicketUpdateRequest request + ); @Operation(summary = "예매자 취소 API", description = "메이커가 자신의 공연에 대한 1명 이상의 예매자의 정보를 취소 상태로 변경하는 PATCH API입니다.") - @ApiResponses({ - @ApiResponse(responseCode = "200", description = "예매자 취소 성공", - content = @Content(schema = @Schema(implementation = SuccessResponse.class))) - }) + @ApiResponses( + value = { + @ApiResponse( + responseCode = "200", + description = "예매자 취소 성공", + content = @Content(schema = @Schema(implementation = SuccessResponse.class)) + ), + @ApiResponse( + responseCode = "404", + description = "해당 예매 내역을 찾을 수 없습니다.", + content = @Content(schema = @Schema(implementation = ErrorResponse.class)) + ), + @ApiResponse( + responseCode = "404", + description = "공연 정보를 찾을 수 없습니다.", + content = @Content(schema = @Schema(implementation = ErrorResponse.class)) + ), + @ApiResponse( + responseCode = "404", + description = "회차 정보를 찾을 수 없습니다.", + content = @Content(schema = @Schema(implementation = ErrorResponse.class)) + ) + } + ) ResponseEntity> cancelTickets( @CurrentMember Long memberId, - @RequestBody TicketCancelRequest ticketCancelRequest); + @RequestBody TicketCancelRequest ticketCancelRequest + ); } From fbfdeffff48e9d506ab81b7c5142e12b8ab9fb2f Mon Sep 17 00:00:00 2001 From: hyerinhwang-sailin Date: Fri, 11 Oct 2024 00:36:02 +0900 Subject: [PATCH 16/16] =?UTF-8?q?[#241]=20chore(MemberController):=20?= =?UTF-8?q?=EC=BD=94=EB=93=9C=20=EC=BB=A8=EB=B2=A4=EC=85=98=20=EB=B0=98?= =?UTF-8?q?=EC=98=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/beat/domain/member/api/MemberController.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/beat/domain/member/api/MemberController.java b/src/main/java/com/beat/domain/member/api/MemberController.java index 35a646fb..63a01720 100644 --- a/src/main/java/com/beat/domain/member/api/MemberController.java +++ b/src/main/java/com/beat/domain/member/api/MemberController.java @@ -32,8 +32,8 @@ public class MemberController implements MemberApi { private final AuthenticationService authenticationService; private final SocialLoginService socialLoginService; - private final static int COOKIE_MAX_AGE = 7 * 24 * 60 * 60; - private final static String REFRESH_TOKEN = "refreshToken"; + private static final int COOKIE_MAX_AGE = 7 * 24 * 60 * 60; + private static final String REFRESH_TOKEN = "refreshToken"; @Override @PostMapping("/sign-up")