From 5fe52cd65ba465a9ac3fc549ae80ea3480fd7aec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EB=AF=BC=EC=B0=AC=EA=B8=B0?= Date: Sun, 4 Aug 2024 22:48:23 +0900 Subject: [PATCH] =?UTF-8?q?feat:=20=EA=B3=B5=EC=97=B0=20=EC=83=81=EC=84=B8?= =?UTF-8?q?=20=EC=A1=B0=ED=9A=8C=20(#71)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../org/example/config/SecurityConfig.java | 5 +- .../show/controller/ShowController.java | 23 +---- .../dto/param/ShowTicketingSiteApiParam.java | 18 ++++ .../dto/request/ShowCreateApiForm.java | 47 +++++++---- .../dto/request/ShowUpdateApiForm.java | 23 ++--- .../dto/response/SeatInfoApiResponse.java | 8 +- .../dto/response/ShowArtistApiResponse.java | 32 +++++++ .../dto/response/ShowDetailApiResponse.java | 52 ++++++++++-- .../dto/response/ShowGenreApiResponse.java | 24 ++++++ .../dto/response/ShowInfoApiResponse.java | 14 ++-- .../dto/response/ShowSeatApiResponse.java | 13 +++ .../response/TicketingInfoApiResponse.java | 19 ----- .../show/controller/vo/TicketingApiType.java | 26 ++++++ .../show/service/ShowAdminService.java | 17 ++-- .../com/example/show/service/ShowService.java | 17 ++++ .../ShowSearchPaginationServiceParam.java | 2 +- .../param/ShowTicketingSiteServiceParam.java | 11 +++ .../dto/request/ShowCreateServiceRequest.java | 68 +++++++++++---- .../dto/request/ShowUpdateServiceRequest.java | 38 ++++----- .../response/ShowArtistServiceResponse.java | 23 +++++ .../response/ShowDetailServiceResponse.java | 55 ++++++++++++ .../response/ShowGenreServiceResponse.java | 19 +++++ .../dto/response/ShowInfoServiceResponse.java | 41 +++++---- .../dto/response/ShowSeatServiceResponse.java | 15 ++++ .../example/show/service/error/ShowError.java | 28 +++++++ .../artist/fixture/dto/ArtistDtoFixture.java | 2 +- .../java/show/fixture/dto/ShowDtoFixture.java | 34 ++++---- .../show/service/ShowAdminServiceTest.java | 4 +- .../resources/templates/show_create_form.html | 83 +++++++++++++------ .../main/resources/templates/show_form.html | 14 +++- .../resources/templates/show_list_form.html | 10 ++- .../artist/response/ArtistDomainResponse.java | 20 +++++ .../genre/response/GenreDomainResponse.java | 13 +++ .../request/ShowCreationDomainRequest.java | 82 ++++++++++++++++++ .../response/ShowDetailDomainResponse.java | 14 ++++ .../dto/show/response/ShowDomainResponse.java | 23 +++++ ...ponse.java => ShowInfoDomainResponse.java} | 13 +-- .../response/ShowSearchDomainResponse.java | 3 +- .../java/org/example/entity/show/Show.java | 39 +++++---- .../org/example/entity/show/ShowSearch.java | 3 +- .../entity/show/ShowTicketingTime.java | 43 ++++++++++ .../info/{SeatPrice.java => SeatPrices.java} | 16 ++-- .../example/entity/show/info/Ticketing.java | 39 --------- .../entity/show/info/TicketingSites.java | 32 +++++++ .../show/ShowQuerydslRepository.java | 10 ++- .../show/ShowQuerydslRepositoryImpl.java | 75 ++++++++++++++--- .../show/ShowTicketingTimeRepository.java | 9 ++ .../ShowSearchQuerydslRepositoryImpl.java | 3 +- .../org/example/usecase/show/ShowUseCase.java | 40 ++++++--- .../java/org/example/vo/TicketingType.java | 8 ++ .../java/org/example/fixture/ShowFixture.java | 31 ++++--- 51 files changed, 991 insertions(+), 310 deletions(-) create mode 100644 app/api/show-api/src/main/java/com/example/show/controller/dto/param/ShowTicketingSiteApiParam.java create mode 100644 app/api/show-api/src/main/java/com/example/show/controller/dto/response/ShowArtistApiResponse.java create mode 100644 app/api/show-api/src/main/java/com/example/show/controller/dto/response/ShowGenreApiResponse.java create mode 100644 app/api/show-api/src/main/java/com/example/show/controller/dto/response/ShowSeatApiResponse.java delete mode 100644 app/api/show-api/src/main/java/com/example/show/controller/dto/response/TicketingInfoApiResponse.java create mode 100644 app/api/show-api/src/main/java/com/example/show/controller/vo/TicketingApiType.java create mode 100644 app/api/show-api/src/main/java/com/example/show/service/dto/param/ShowTicketingSiteServiceParam.java create mode 100644 app/api/show-api/src/main/java/com/example/show/service/dto/response/ShowArtistServiceResponse.java create mode 100644 app/api/show-api/src/main/java/com/example/show/service/dto/response/ShowDetailServiceResponse.java create mode 100644 app/api/show-api/src/main/java/com/example/show/service/dto/response/ShowGenreServiceResponse.java create mode 100644 app/api/show-api/src/main/java/com/example/show/service/dto/response/ShowSeatServiceResponse.java create mode 100644 app/api/show-api/src/main/java/com/example/show/service/error/ShowError.java create mode 100644 app/domain/show-domain/src/main/java/org/example/dto/artist/response/ArtistDomainResponse.java create mode 100644 app/domain/show-domain/src/main/java/org/example/dto/genre/response/GenreDomainResponse.java create mode 100644 app/domain/show-domain/src/main/java/org/example/dto/show/request/ShowCreationDomainRequest.java create mode 100644 app/domain/show-domain/src/main/java/org/example/dto/show/response/ShowDetailDomainResponse.java create mode 100644 app/domain/show-domain/src/main/java/org/example/dto/show/response/ShowDomainResponse.java rename app/domain/show-domain/src/main/java/org/example/dto/show/response/{ShowInfoResponse.java => ShowInfoDomainResponse.java} (63%) create mode 100644 app/domain/show-domain/src/main/java/org/example/entity/show/ShowTicketingTime.java rename app/domain/show-domain/src/main/java/org/example/entity/show/info/{SeatPrice.java => SeatPrices.java} (54%) delete mode 100644 app/domain/show-domain/src/main/java/org/example/entity/show/info/Ticketing.java create mode 100644 app/domain/show-domain/src/main/java/org/example/entity/show/info/TicketingSites.java create mode 100644 app/domain/show-domain/src/main/java/org/example/repository/show/ShowTicketingTimeRepository.java create mode 100644 app/domain/show-domain/src/main/java/org/example/vo/TicketingType.java diff --git a/app/api/common-api/src/main/java/org/example/config/SecurityConfig.java b/app/api/common-api/src/main/java/org/example/config/SecurityConfig.java index c347e760..c16bee1c 100644 --- a/app/api/common-api/src/main/java/org/example/config/SecurityConfig.java +++ b/app/api/common-api/src/main/java/org/example/config/SecurityConfig.java @@ -38,10 +38,10 @@ public SecurityFilterChain securityFilterChain(HttpSecurity http) throws Excepti configurer -> configurer.sessionCreationPolicy(SessionCreationPolicy.STATELESS) ) .authorizeHttpRequests(registry -> registry - .requestMatchers(getMatcherForAnyone()) - .permitAll() .requestMatchers(getMatcherForUserAndAdmin()) .hasAnyRole("USER", "ADMIN") + .requestMatchers(getMatcherForAnyone()) + .permitAll() .anyRequest() .hasAnyRole("ADMIN") ) @@ -74,6 +74,7 @@ private RequestMatcher getMatcherForAnyone() { antMatcher(HttpMethod.GET, "/api/v1/artists"), antMatcher(HttpMethod.GET, "/api/v1/genres"), antMatcher(HttpMethod.GET, "/api/v1/shows"), + antMatcher(HttpMethod.GET, "/api/v1/shows/{showId}"), antMatcher(HttpMethod.GET, "/api/v1/artists/search/**"), antMatcher(HttpMethod.GET, "/api/v1/shows/search/**") ); diff --git a/app/api/show-api/src/main/java/com/example/show/controller/ShowController.java b/app/api/show-api/src/main/java/com/example/show/controller/ShowController.java index ee45e603..44808bfc 100644 --- a/app/api/show-api/src/main/java/com/example/show/controller/ShowController.java +++ b/app/api/show-api/src/main/java/com/example/show/controller/ShowController.java @@ -131,28 +131,7 @@ public ResponseEntity getShow( @PathVariable("showId") UUID showId ) { return ResponseEntity.ok( - new ShowDetailApiResponse( - showId, - "2021 서울재즈페스티벌", - new ArtistSimpleApiResponse( - UUID.randomUUID(), - "윈터", - image - ), - new GenreSimpleApiResponse( - UUID.randomUUID(), - "재즈", - image - ), - List.of( - new TicketingAndShowInfoApiResponse( - "2021-10-01 14:00:00", - "2021-10-03 14:00:00", - image - ) - ), - image - ) + ShowDetailApiResponse.from(showService.getShow(showId)) ); } diff --git a/app/api/show-api/src/main/java/com/example/show/controller/dto/param/ShowTicketingSiteApiParam.java b/app/api/show-api/src/main/java/com/example/show/controller/dto/param/ShowTicketingSiteApiParam.java new file mode 100644 index 00000000..c4fbb544 --- /dev/null +++ b/app/api/show-api/src/main/java/com/example/show/controller/dto/param/ShowTicketingSiteApiParam.java @@ -0,0 +1,18 @@ +package com.example.show.controller.dto.param; + +import com.example.show.service.dto.param.ShowTicketingSiteServiceParam; +import lombok.Builder; + +@Builder +public record ShowTicketingSiteApiParam( + String siteName, + String siteURL +) { + + public static ShowTicketingSiteApiParam from(ShowTicketingSiteServiceParam param) { + return ShowTicketingSiteApiParam.builder() + .siteName(param.siteName()) + .siteURL(param.siteURL()) + .build(); + } +} diff --git a/app/api/show-api/src/main/java/com/example/show/controller/dto/request/ShowCreateApiForm.java b/app/api/show-api/src/main/java/com/example/show/controller/dto/request/ShowCreateApiForm.java index 0163573e..148e087a 100644 --- a/app/api/show-api/src/main/java/com/example/show/controller/dto/request/ShowCreateApiForm.java +++ b/app/api/show-api/src/main/java/com/example/show/controller/dto/request/ShowCreateApiForm.java @@ -1,12 +1,11 @@ package com.example.show.controller.dto.request; import com.example.show.controller.dto.response.SeatInfoApiResponse; -import com.example.show.controller.dto.response.TicketingInfoApiResponse; +import com.example.show.controller.vo.TicketingApiType; import com.example.show.service.dto.request.ShowCreateServiceRequest; import jakarta.validation.constraints.NotBlank; import jakarta.validation.constraints.NotNull; import java.time.LocalDate; -import java.time.LocalDateTime; import java.util.List; import java.util.Map; import java.util.UUID; @@ -22,8 +21,11 @@ public record ShowCreateApiForm( @NotBlank(message = "공연 내용은 필수 요청값 입니다.") String content, - @NotNull(message = "공연 날짜는 필수 요청값 입니다.") - LocalDate date, + @NotNull(message = "공연 시작 날짜는 필수 요청값 입니다.") + LocalDate startDate, + + @NotNull(message = "공연 종료 날짜는 필수 요청값 입니다.") + LocalDate endDate, @NotNull(message = "공연 장소는 필수 요청값 입니다.") String location, @@ -31,20 +33,23 @@ public record ShowCreateApiForm( @NotNull(message = "공연 포스터는 필수 요청값 입니다.") MultipartFile post, - @NotNull(message = "공연 좌석 타입은 필수 요청값 입니다.") - List seatTypes, + @NotNull(message = "공연 티켓팅 종류는 필수 요청값 입니다.") + List ticketingTypes, - @NotNull(message = "공연 좌석별 가격은 필수 요청값 입니다.") - List pricesPerSeatType, - - @NotNull(message = "공연 티켓 오픈 시간은 필수 요청값 입니다.") - LocalDateTime ticketOpenTime, + @NotNull(message = "공연 티켓팅 종류는 필수 요청값 입니다.") + List ticketingDates, @NotNull(message = "티켓팅 예약 사이트명은 필수 요청값 입니다.") List ticketBookingSites, @NotNull(message = "티켓팅 예약 사이트 URL는 필수 요청값 입니다.") - List ticketingSiteUrls, + List ticketingSiteURL, + + @NotNull(message = "공연 좌석 타입은 필수 요청값 입니다.") + List seatTypes, + + @NotNull(message = "공연 좌석별 가격은 필수 요청값 입니다.") + List pricesPerSeatType, @NotNull(message = "아티스트 ID는 필수 요청값 입니다.") List artistIds, @@ -57,11 +62,13 @@ public ShowCreateServiceRequest toServiceRequest() { return ShowCreateServiceRequest.builder() .title(title) .content(content) - .date(date) + .startDate(startDate) + .endDate(endDate) .location(location) .post(post) .seatInfoApiResponse(getSeatInfoApiResponse()) - .ticketingInfoApiResponse(getTicketingInfoApiResponse()) + .showTicketingSites(getTicketingSitesApiResponse()) + .showTicketingDates(getTicketingDatesApiResponse()) .artistIds(artistIds) .genreIds(genreIds) .build(); @@ -74,11 +81,15 @@ private SeatInfoApiResponse getSeatInfoApiResponse() { return new SeatInfoApiResponse(priceInformation); } - private TicketingInfoApiResponse getTicketingInfoApiResponse() { - Map ticketingInformation = IntStream.range(0, ticketBookingSites.size()) + private Map getTicketingSitesApiResponse() { + return IntStream.range(0, ticketBookingSites.size()) .boxed() - .collect(Collectors.toMap(ticketBookingSites::get, ticketingSiteUrls::get)); - return new TicketingInfoApiResponse(ticketOpenTime, ticketingInformation); + .collect(Collectors.toMap(ticketBookingSites::get, ticketingSiteURL::get)); } + private Map getTicketingDatesApiResponse() { + return IntStream.range(0, ticketingTypes.size()) + .boxed() + .collect(Collectors.toMap(ticketingTypes::get, ticketingDates::get)); + } } diff --git a/app/api/show-api/src/main/java/com/example/show/controller/dto/request/ShowUpdateApiForm.java b/app/api/show-api/src/main/java/com/example/show/controller/dto/request/ShowUpdateApiForm.java index 00f646c0..4cfe4f14 100644 --- a/app/api/show-api/src/main/java/com/example/show/controller/dto/request/ShowUpdateApiForm.java +++ b/app/api/show-api/src/main/java/com/example/show/controller/dto/request/ShowUpdateApiForm.java @@ -1,7 +1,6 @@ package com.example.show.controller.dto.request; import com.example.show.controller.dto.response.SeatInfoApiResponse; -import com.example.show.controller.dto.response.TicketingInfoApiResponse; import com.example.show.service.dto.request.ShowUpdateServiceRequest; import jakarta.validation.constraints.NotBlank; import jakarta.validation.constraints.NotNull; @@ -22,8 +21,11 @@ public record ShowUpdateApiForm( @NotBlank(message = "공연 내용은 필수 요청값 입니다.") String content, - @NotNull(message = "공연 날짜는 필수 요청값 입니다.") - LocalDate date, + @NotNull(message = "공연 시작 날짜는 필수 요청값 입니다.") + LocalDate startDate, + + @NotNull(message = "공연 종료 날짜는 필수 요청값 입니다.") + LocalDate endDate, @NotNull(message = "공연 장소는 필수 요청값 입니다.") String location, @@ -44,7 +46,7 @@ public record ShowUpdateApiForm( List ticketBookingSites, @NotNull(message = "티켓팅 예약 사이트 URL는 필수 요청값 입니다.") - List ticketingSiteUrls, + List ticketingSiteURL, @NotNull(message = "아티스트 ID는 필수 요청값 입니다.") List artistIds, @@ -57,11 +59,12 @@ public ShowUpdateServiceRequest toServiceRequest() { return ShowUpdateServiceRequest.builder() .title(title) .content(content) - .date(date) + .startDate(startDate) + .endDate(endDate) .location(location) .post(post) .seatInfoApiResponse(getSeatInfoApiResponse()) - .ticketingInfoApiResponse(getTicketingInfoApiResponse()) + .showTicketingSiteInfos(getTicketingInfoApiResponse()) .artistIds(artistIds) .genreIds(genreIds) .build(); @@ -74,11 +77,9 @@ private SeatInfoApiResponse getSeatInfoApiResponse() { return new SeatInfoApiResponse(priceInformation); } - private TicketingInfoApiResponse getTicketingInfoApiResponse() { - Map ticketingInformation = IntStream.range(0, ticketBookingSites.size()) + private Map getTicketingInfoApiResponse() { + return IntStream.range(0, ticketBookingSites.size()) .boxed() - .collect(Collectors.toMap(ticketBookingSites::get, ticketingSiteUrls::get)); - return new TicketingInfoApiResponse(ticketOpenTime, ticketingInformation); + .collect(Collectors.toMap(ticketBookingSites::get, ticketingSiteURL::get)); } - } diff --git a/app/api/show-api/src/main/java/com/example/show/controller/dto/response/SeatInfoApiResponse.java b/app/api/show-api/src/main/java/com/example/show/controller/dto/response/SeatInfoApiResponse.java index 2d8e253c..86b81f5c 100644 --- a/app/api/show-api/src/main/java/com/example/show/controller/dto/response/SeatInfoApiResponse.java +++ b/app/api/show-api/src/main/java/com/example/show/controller/dto/response/SeatInfoApiResponse.java @@ -1,15 +1,13 @@ package com.example.show.controller.dto.response; import java.util.Map; -import org.example.entity.show.info.SeatPrice; +import org.example.entity.show.info.SeatPrices; public record SeatInfoApiResponse( Map priceInformation ) { - public static SeatInfoApiResponse from(SeatPrice seatPrice) { - return new SeatInfoApiResponse(seatPrice.getPriceInformation()); + public static SeatInfoApiResponse from(SeatPrices seatPrices) { + return new SeatInfoApiResponse(seatPrices.getPriceBySeat()); } - - } diff --git a/app/api/show-api/src/main/java/com/example/show/controller/dto/response/ShowArtistApiResponse.java b/app/api/show-api/src/main/java/com/example/show/controller/dto/response/ShowArtistApiResponse.java new file mode 100644 index 00000000..fdbe24f8 --- /dev/null +++ b/app/api/show-api/src/main/java/com/example/show/controller/dto/response/ShowArtistApiResponse.java @@ -0,0 +1,32 @@ +package com.example.show.controller.dto.response; + +import com.example.show.service.dto.response.ShowArtistServiceResponse; +import io.swagger.v3.oas.annotations.media.Schema; +import java.util.UUID; +import lombok.Builder; + +@Builder +public record ShowArtistApiResponse( + + @Schema(description = "아티스트 ID") + UUID id, + + @Schema(description = "아티스트 한국어 이름") + String koreanName, + + @Schema(description = "아티스트 영어 이름") + String englishName, + + @Schema(description = "아티스트 이미지 주소") + String image +) { + + public static ShowArtistApiResponse from(ShowArtistServiceResponse artists) { + return ShowArtistApiResponse.builder() + .id(artists.id()) + .koreanName(artists.koreanName()) + .englishName(artists.englishName()) + .image(artists.image()) + .build(); + } +} diff --git a/app/api/show-api/src/main/java/com/example/show/controller/dto/response/ShowDetailApiResponse.java b/app/api/show-api/src/main/java/com/example/show/controller/dto/response/ShowDetailApiResponse.java index 1f404d8a..b6fdd6da 100644 --- a/app/api/show-api/src/main/java/com/example/show/controller/dto/response/ShowDetailApiResponse.java +++ b/app/api/show-api/src/main/java/com/example/show/controller/dto/response/ShowDetailApiResponse.java @@ -1,11 +1,13 @@ package com.example.show.controller.dto.response; -import com.example.artist.controller.dto.response.ArtistSimpleApiResponse; -import com.example.genre.controller.dto.response.GenreSimpleApiResponse; +import com.example.show.controller.dto.param.ShowTicketingSiteApiParam; +import com.example.show.service.dto.response.ShowDetailServiceResponse; import io.swagger.v3.oas.annotations.media.Schema; import java.util.List; import java.util.UUID; +import lombok.Builder; +@Builder public record ShowDetailApiResponse( @Schema(description = "공연 ID") @@ -14,17 +16,51 @@ public record ShowDetailApiResponse( @Schema(description = "공연 이름") String name, + @Schema(description = "공연 시작일") + String startDate, + + @Schema(description = "공연 종료일") + String endDate, + + @Schema(description = "공연 포스터 주소") + String posterImageURL, + @Schema(description = "아티스트 정보") - ArtistSimpleApiResponse artist, + List artists, @Schema(description = "장르 정보") - GenreSimpleApiResponse genre, + List genres, - @Schema(description = "티켓팅 정보 및 공연 날짜") - List ticketingAndShowInfo, + @Schema(description = "좌석 정보") + ShowSeatApiResponse seats, - @Schema(description = "공연 포스터 주소") - String posterImageURL + @Schema(description = "티켓팅 정보 및 공연 날짜") + List ticketingSites ) { + public static ShowDetailApiResponse from(ShowDetailServiceResponse show) { + return ShowDetailApiResponse.builder() + .id(show.id()) + .name(show.title()) + .startDate(show.startDate().toString()) + .endDate(show.endDate().toString()) + .posterImageURL(show.posterImageURL()) + .artists( + show.artists().stream() + .map(ShowArtistApiResponse::from) + .toList() + ) + .genres( + show.genres().stream() + .map(ShowGenreApiResponse::from) + .toList() + ) + .seats(ShowSeatApiResponse.from((show.seats()))) + .ticketingSites( + show.ticketingSites().stream() + .map(ShowTicketingSiteApiParam::from) + .toList() + ) + .build(); + } } diff --git a/app/api/show-api/src/main/java/com/example/show/controller/dto/response/ShowGenreApiResponse.java b/app/api/show-api/src/main/java/com/example/show/controller/dto/response/ShowGenreApiResponse.java new file mode 100644 index 00000000..0db05f6f --- /dev/null +++ b/app/api/show-api/src/main/java/com/example/show/controller/dto/response/ShowGenreApiResponse.java @@ -0,0 +1,24 @@ +package com.example.show.controller.dto.response; + +import com.example.show.service.dto.response.ShowGenreServiceResponse; +import io.swagger.v3.oas.annotations.media.Schema; +import java.util.UUID; +import lombok.Builder; + +@Builder +public record ShowGenreApiResponse( + + @Schema(description = "장르 ID") + UUID id, + + @Schema(description = "장르 이름") + String name +) { + + public static ShowGenreApiResponse from(ShowGenreServiceResponse genre) { + return ShowGenreApiResponse.builder() + .id(genre.id()) + .name(genre.name()) + .build(); + } +} diff --git a/app/api/show-api/src/main/java/com/example/show/controller/dto/response/ShowInfoApiResponse.java b/app/api/show-api/src/main/java/com/example/show/controller/dto/response/ShowInfoApiResponse.java index 42182504..b961f9ac 100644 --- a/app/api/show-api/src/main/java/com/example/show/controller/dto/response/ShowInfoApiResponse.java +++ b/app/api/show-api/src/main/java/com/example/show/controller/dto/response/ShowInfoApiResponse.java @@ -2,6 +2,7 @@ import com.example.artist.service.dto.response.ArtistKoreanNameServiceResponse; import com.example.genre.service.dto.response.GenreNameServiceResponse; +import com.example.show.controller.dto.param.ShowTicketingSiteApiParam; import com.example.show.service.dto.response.ShowInfoServiceResponse; import java.time.LocalDate; import java.util.List; @@ -12,25 +13,28 @@ public record ShowInfoApiResponse( UUID id, String title, String content, - LocalDate date, + LocalDate startDate, + LocalDate endDate, String location, String image, SeatInfoApiResponse seatInfoApiResponse, - TicketingInfoApiResponse ticketingInfoApiResponse, + List ticketingSites, List artistKoreanNameResponses, List genreNameResponses - ) { public ShowInfoApiResponse(ShowInfoServiceResponse showInfoServiceResponse) { this( showInfoServiceResponse.id(), showInfoServiceResponse.title(), showInfoServiceResponse.content(), - showInfoServiceResponse.date(), + showInfoServiceResponse.startDate(), + showInfoServiceResponse.startDate(), showInfoServiceResponse.location(), showInfoServiceResponse.image(), showInfoServiceResponse.seatInfoApiResponse(), - showInfoServiceResponse.ticketingInfoApiResponse(), + showInfoServiceResponse.ticketingSiteInfos().stream() + .map(ShowTicketingSiteApiParam::from) + .toList(), showInfoServiceResponse.artistKoreanNameResponses(), showInfoServiceResponse.genreNameResponses() ); diff --git a/app/api/show-api/src/main/java/com/example/show/controller/dto/response/ShowSeatApiResponse.java b/app/api/show-api/src/main/java/com/example/show/controller/dto/response/ShowSeatApiResponse.java new file mode 100644 index 00000000..0eb78aaf --- /dev/null +++ b/app/api/show-api/src/main/java/com/example/show/controller/dto/response/ShowSeatApiResponse.java @@ -0,0 +1,13 @@ +package com.example.show.controller.dto.response; + +import com.example.show.service.dto.response.ShowSeatServiceResponse; +import java.util.Map; + +public record ShowSeatApiResponse( + Map priceBySeat +) { + + public static ShowSeatApiResponse from(ShowSeatServiceResponse seats) { + return new ShowSeatApiResponse(seats.priceBySeat()); + } +} diff --git a/app/api/show-api/src/main/java/com/example/show/controller/dto/response/TicketingInfoApiResponse.java b/app/api/show-api/src/main/java/com/example/show/controller/dto/response/TicketingInfoApiResponse.java deleted file mode 100644 index 9e15a474..00000000 --- a/app/api/show-api/src/main/java/com/example/show/controller/dto/response/TicketingInfoApiResponse.java +++ /dev/null @@ -1,19 +0,0 @@ -package com.example.show.controller.dto.response; - -import java.time.LocalDateTime; -import java.util.Map; -import org.example.entity.show.info.Ticketing; - -public record TicketingInfoApiResponse( - LocalDateTime ticketOpenTime, - Map ticketingInformation -) { - - public static TicketingInfoApiResponse from(Ticketing ticketing) { - return new TicketingInfoApiResponse( - ticketing.getTicketOpenTime(), - ticketing.getTicketingInformation() - ); - } - -} diff --git a/app/api/show-api/src/main/java/com/example/show/controller/vo/TicketingApiType.java b/app/api/show-api/src/main/java/com/example/show/controller/vo/TicketingApiType.java new file mode 100644 index 00000000..8f93afa2 --- /dev/null +++ b/app/api/show-api/src/main/java/com/example/show/controller/vo/TicketingApiType.java @@ -0,0 +1,26 @@ +package com.example.show.controller.vo; + +import org.example.vo.TicketingType; + +public enum TicketingApiType { + PRE("선예매"), NORMAL("일반예매"), ADDITIONAL("추가예매"); + + TicketingApiType(String value) { + } + + public static TicketingApiType from(TicketingType ticketingType) { + return switch (ticketingType) { + case PRE -> PRE; + case NORMAL -> NORMAL; + case ADDITIONAL -> ADDITIONAL; + }; + } + + public TicketingType toTicketingType() { + return switch (this) { + case PRE -> TicketingType.PRE; + case NORMAL -> TicketingType.NORMAL; + case ADDITIONAL -> TicketingType.ADDITIONAL; + }; + } +} diff --git a/app/api/show-api/src/main/java/com/example/show/service/ShowAdminService.java b/app/api/show-api/src/main/java/com/example/show/service/ShowAdminService.java index 13936554..b6f9fda6 100644 --- a/app/api/show-api/src/main/java/com/example/show/service/ShowAdminService.java +++ b/app/api/show-api/src/main/java/com/example/show/service/ShowAdminService.java @@ -8,7 +8,7 @@ import java.util.List; import java.util.UUID; import lombok.RequiredArgsConstructor; -import org.example.dto.show.response.ShowInfoResponse; +import org.example.dto.show.response.ShowInfoDomainResponse; import org.example.entity.show.Show; import org.example.usecase.show.ShowUseCase; import org.springframework.stereotype.Service; @@ -21,26 +21,23 @@ public class ShowAdminService { private final FileUploadComponent fileUploadComponent; public void save(ShowCreateServiceRequest showCreateServiceRequest) { - String imageUrl = fileUploadComponent.uploadFile("show", showCreateServiceRequest.post()); - Show show = showCreateServiceRequest.toShowWithImageUrl(imageUrl); + String imageURL = fileUploadComponent.uploadFile("show", showCreateServiceRequest.post()); showUseCase.save( - show, - showCreateServiceRequest.artistIds(), - showCreateServiceRequest.genreIds() + showCreateServiceRequest.toDomainRequest(imageURL) ); } public List findAllShowInfos() { - List showInfoResponses = showUseCase.findAllShowInfos(); - return showInfoResponses.stream() + List showInfoDomainRespons = showUseCase.findAllShowInfos(); + return showInfoDomainRespons.stream() .map(ShowInfoServiceResponse::new) .toList(); } public ShowInfoServiceResponse findShowInfo(UUID id) { - ShowInfoResponse showInfoResponse = showUseCase.findShowInfo(id); - return new ShowInfoServiceResponse(showInfoResponse); + ShowInfoDomainResponse showInfoDomainResponse = showUseCase.findShowInfo(id); + return new ShowInfoServiceResponse(showInfoDomainResponse); } public void updateShow(UUID id, ShowUpdateServiceRequest showUpdateServiceRequest) { diff --git a/app/api/show-api/src/main/java/com/example/show/service/ShowService.java b/app/api/show-api/src/main/java/com/example/show/service/ShowService.java index 5f333e57..b8da15a0 100644 --- a/app/api/show-api/src/main/java/com/example/show/service/ShowService.java +++ b/app/api/show-api/src/main/java/com/example/show/service/ShowService.java @@ -2,9 +2,15 @@ import com.example.show.service.dto.param.ShowSearchPaginationServiceParam; import com.example.show.service.dto.request.ShowSearchPaginationServiceRequest; +import com.example.show.service.dto.response.ShowDetailServiceResponse; +import com.example.show.service.error.ShowError; import java.util.List; +import java.util.NoSuchElementException; +import java.util.UUID; import lombok.RequiredArgsConstructor; import org.example.dto.response.PaginationServiceResponse; +import org.example.dto.show.response.ShowDetailDomainResponse; +import org.example.exception.BusinessException; import org.example.usecase.show.ShowUseCase; import org.springframework.stereotype.Service; @@ -14,6 +20,17 @@ public class ShowService { private final ShowUseCase showUseCase; + public ShowDetailServiceResponse getShow(UUID id) { + ShowDetailDomainResponse showDetail; + try { + showDetail = showUseCase.findShowDetail(id); + } catch (NoSuchElementException e) { + throw new BusinessException(ShowError.DETAIL_NOT_FOUND); + } + + return ShowDetailServiceResponse.from(showDetail); + } + public PaginationServiceResponse searchShow( ShowSearchPaginationServiceRequest request ) { diff --git a/app/api/show-api/src/main/java/com/example/show/service/dto/param/ShowSearchPaginationServiceParam.java b/app/api/show-api/src/main/java/com/example/show/service/dto/param/ShowSearchPaginationServiceParam.java index 34cf9371..5f5897a4 100644 --- a/app/api/show-api/src/main/java/com/example/show/service/dto/param/ShowSearchPaginationServiceParam.java +++ b/app/api/show-api/src/main/java/com/example/show/service/dto/param/ShowSearchPaginationServiceParam.java @@ -16,7 +16,7 @@ public ShowSearchPaginationServiceParam(ShowSearchDomainResponse showSearchDomai this( showSearchDomainResponse.id(), showSearchDomainResponse.title(), - showSearchDomainResponse.date(), + showSearchDomainResponse.startDate(), showSearchDomainResponse.location(), showSearchDomainResponse.image() ); diff --git a/app/api/show-api/src/main/java/com/example/show/service/dto/param/ShowTicketingSiteServiceParam.java b/app/api/show-api/src/main/java/com/example/show/service/dto/param/ShowTicketingSiteServiceParam.java new file mode 100644 index 00000000..e391f59a --- /dev/null +++ b/app/api/show-api/src/main/java/com/example/show/service/dto/param/ShowTicketingSiteServiceParam.java @@ -0,0 +1,11 @@ +package com.example.show.service.dto.param; + +import lombok.Builder; + +@Builder +public record ShowTicketingSiteServiceParam( + String siteName, + String siteURL +) { + +} diff --git a/app/api/show-api/src/main/java/com/example/show/service/dto/request/ShowCreateServiceRequest.java b/app/api/show-api/src/main/java/com/example/show/service/dto/request/ShowCreateServiceRequest.java index 304bc586..32c9c769 100644 --- a/app/api/show-api/src/main/java/com/example/show/service/dto/request/ShowCreateServiceRequest.java +++ b/app/api/show-api/src/main/java/com/example/show/service/dto/request/ShowCreateServiceRequest.java @@ -1,14 +1,18 @@ package com.example.show.service.dto.request; import com.example.show.controller.dto.response.SeatInfoApiResponse; -import com.example.show.controller.dto.response.TicketingInfoApiResponse; +import com.example.show.controller.vo.TicketingApiType; import java.time.LocalDate; import java.util.List; +import java.util.Map; import java.util.UUID; +import java.util.stream.Collectors; import lombok.Builder; +import org.example.dto.show.request.ShowCreationDomainRequest; import org.example.entity.show.Show; -import org.example.entity.show.info.SeatPrice; -import org.example.entity.show.info.Ticketing; +import org.example.entity.show.info.SeatPrices; +import org.example.entity.show.info.TicketingSites; +import org.example.vo.TicketingType; import org.springframework.web.multipart.MultipartFile; @Builder @@ -16,40 +20,70 @@ public record ShowCreateServiceRequest( String title, String content, - LocalDate date, + LocalDate startDate, + LocalDate endDate, String location, MultipartFile post, SeatInfoApiResponse seatInfoApiResponse, - TicketingInfoApiResponse ticketingInfoApiResponse, + Map showTicketingSites, + Map showTicketingDates, List artistIds, List genreIds ) { public Show toShowWithImageUrl(String imageUrl) { + TicketingSites ticketingSites = new TicketingSites(); + showTicketingSites.forEach(ticketingSites::saveTicketingSite); + return Show.builder() .title(title) .content(content) - .date(date) + .startDate(startDate) + .endDate(endDate) .location(location) .image(imageUrl) - .seatPrice(getSeatPrice()) - .ticketing(getTicketing()) + .seatPrices(getSeatPrice()) + .ticketingSites(ticketingSites) + .build(); + } + + public ShowCreationDomainRequest toDomainRequest(String imageURL) { + return ShowCreationDomainRequest.builder() + .title(title) + .content(content) + .startDate(startDate) + .endDate(endDate) + .location(location) + .posterImageURL(imageURL) + .showSeats(getSeatPrice()) + .showTicketingSites(getTicketingSites()) + .showTicketingDates(getTicketingDates()) + .artistIds(artistIds) + .genreIds(genreIds) .build(); } - private SeatPrice getSeatPrice() { - SeatPrice seatPrice = new SeatPrice(); - seatInfoApiResponse.priceInformation().forEach(seatPrice::savePriceInformation); + private SeatPrices getSeatPrice() { + SeatPrices seatPrices = new SeatPrices(); + seatInfoApiResponse.priceInformation().forEach(seatPrices::savePriceInformation); - return seatPrice; + return seatPrices; } - private Ticketing getTicketing() { - Ticketing ticketing = new Ticketing(); - ticketing.saveTicketOpenTime(ticketingInfoApiResponse.ticketOpenTime()); - ticketingInfoApiResponse.ticketingInformation().forEach(ticketing::saveTicketingInformation); + private TicketingSites getTicketingSites() { + TicketingSites ticketingSites = new TicketingSites(); + showTicketingSites.forEach(ticketingSites::saveTicketingSite); - return ticketing; + return ticketingSites; } + private Map getTicketingDates() { + return showTicketingDates.entrySet().stream() + .collect( + Collectors.toMap( + entry -> entry.getKey().toTicketingType(), + Map.Entry::getValue + ) + ); + } } diff --git a/app/api/show-api/src/main/java/com/example/show/service/dto/request/ShowUpdateServiceRequest.java b/app/api/show-api/src/main/java/com/example/show/service/dto/request/ShowUpdateServiceRequest.java index d83e4f35..36ba02b9 100644 --- a/app/api/show-api/src/main/java/com/example/show/service/dto/request/ShowUpdateServiceRequest.java +++ b/app/api/show-api/src/main/java/com/example/show/service/dto/request/ShowUpdateServiceRequest.java @@ -1,14 +1,14 @@ package com.example.show.service.dto.request; import com.example.show.controller.dto.response.SeatInfoApiResponse; -import com.example.show.controller.dto.response.TicketingInfoApiResponse; import java.time.LocalDate; import java.util.List; +import java.util.Map; import java.util.UUID; import lombok.Builder; import org.example.entity.show.Show; -import org.example.entity.show.info.SeatPrice; -import org.example.entity.show.info.Ticketing; +import org.example.entity.show.info.SeatPrices; +import org.example.entity.show.info.TicketingSites; import org.springframework.web.multipart.MultipartFile; @Builder @@ -16,40 +16,36 @@ public record ShowUpdateServiceRequest( String title, String content, - LocalDate date, + LocalDate startDate, + LocalDate endDate, String location, MultipartFile post, SeatInfoApiResponse seatInfoApiResponse, - TicketingInfoApiResponse ticketingInfoApiResponse, + Map showTicketingSiteInfos, List artistIds, List genreIds ) { public Show toShowWithImageUrl(String imageUrl) { + TicketingSites ticketingSites = new TicketingSites(); + showTicketingSiteInfos.forEach(ticketingSites::saveTicketingSite); + return Show.builder() .title(title) .content(content) - .date(date) + .startDate(startDate) + .endDate(endDate) .location(location) .image(imageUrl) - .seatPrice(getSeatPrice()) - .ticketing(getTicketing()) + .seatPrices(getSeatPrice()) + .ticketingSites(ticketingSites) .build(); } - private SeatPrice getSeatPrice() { - SeatPrice seatPrice = new SeatPrice(); - seatInfoApiResponse.priceInformation().forEach(seatPrice::savePriceInformation); + private SeatPrices getSeatPrice() { + SeatPrices seatPrices = new SeatPrices(); + seatInfoApiResponse.priceInformation().forEach(seatPrices::savePriceInformation); - return seatPrice; + return seatPrices; } - - private Ticketing getTicketing() { - Ticketing ticketing = new Ticketing(); - ticketing.saveTicketOpenTime(ticketingInfoApiResponse.ticketOpenTime()); - ticketingInfoApiResponse.ticketingInformation().forEach(ticketing::saveTicketingInformation); - - return ticketing; - } - } diff --git a/app/api/show-api/src/main/java/com/example/show/service/dto/response/ShowArtistServiceResponse.java b/app/api/show-api/src/main/java/com/example/show/service/dto/response/ShowArtistServiceResponse.java new file mode 100644 index 00000000..2c6426b2 --- /dev/null +++ b/app/api/show-api/src/main/java/com/example/show/service/dto/response/ShowArtistServiceResponse.java @@ -0,0 +1,23 @@ +package com.example.show.service.dto.response; + +import java.util.UUID; +import lombok.Builder; +import org.example.dto.artist.response.ArtistDomainResponse; + +@Builder +public record ShowArtistServiceResponse( + UUID id, + String koreanName, + String englishName, + String image +) { + + public static ShowArtistServiceResponse from(ArtistDomainResponse artist) { + return ShowArtistServiceResponse.builder() + .id(artist.id()) + .koreanName(artist.koreanName()) + .englishName(artist.englishName()) + .image(artist.image()) + .build(); + } +} diff --git a/app/api/show-api/src/main/java/com/example/show/service/dto/response/ShowDetailServiceResponse.java b/app/api/show-api/src/main/java/com/example/show/service/dto/response/ShowDetailServiceResponse.java new file mode 100644 index 00000000..48298055 --- /dev/null +++ b/app/api/show-api/src/main/java/com/example/show/service/dto/response/ShowDetailServiceResponse.java @@ -0,0 +1,55 @@ +package com.example.show.service.dto.response; + +import com.example.show.service.dto.param.ShowTicketingSiteServiceParam; +import java.time.LocalDate; +import java.util.List; +import java.util.UUID; +import lombok.Builder; +import org.example.dto.show.response.ShowDetailDomainResponse; +import org.example.entity.show.info.TicketingSites; + +@Builder +public record ShowDetailServiceResponse( + + UUID id, + String title, + LocalDate startDate, + LocalDate endDate, + String posterImageURL, + List artists, + List genres, + ShowSeatServiceResponse seats, + List ticketingSites +) { + + public static ShowDetailServiceResponse from(ShowDetailDomainResponse show) { + TicketingSites ticketingSites = show.show().ticketingSites(); + return ShowDetailServiceResponse.builder() + .id(show.show().id()) + .title(show.show().title()) + .startDate(show.show().startDate()) + .endDate(show.show().endDate()) + .posterImageURL(show.show().image()) + .artists( + show.artists().stream() + .map(ShowArtistServiceResponse::from) + .toList() + ) + .genres( + show.genres().stream() + .map(ShowGenreServiceResponse::from) + .toList() + ) + .seats(ShowSeatServiceResponse.from(show.show().seatPrices())) + .ticketingSites( + ticketingSites.getSites().stream() + .map(site -> ShowTicketingSiteServiceParam.builder() + .siteName(site) + .siteURL(ticketingSites.getURLOrNullBy(site)) + .build() + ) + .toList() + ) + .build(); + } +} diff --git a/app/api/show-api/src/main/java/com/example/show/service/dto/response/ShowGenreServiceResponse.java b/app/api/show-api/src/main/java/com/example/show/service/dto/response/ShowGenreServiceResponse.java new file mode 100644 index 00000000..5b4dc655 --- /dev/null +++ b/app/api/show-api/src/main/java/com/example/show/service/dto/response/ShowGenreServiceResponse.java @@ -0,0 +1,19 @@ +package com.example.show.service.dto.response; + +import java.util.UUID; +import lombok.Builder; +import org.example.dto.genre.response.GenreDomainResponse; + +@Builder +public record ShowGenreServiceResponse( + UUID id, + String name +) { + + public static ShowGenreServiceResponse from(GenreDomainResponse genre) { + return ShowGenreServiceResponse.builder() + .id(genre.id()) + .name(genre.name()) + .build(); + } +} diff --git a/app/api/show-api/src/main/java/com/example/show/service/dto/response/ShowInfoServiceResponse.java b/app/api/show-api/src/main/java/com/example/show/service/dto/response/ShowInfoServiceResponse.java index 3d63ee64..d6f48cdb 100644 --- a/app/api/show-api/src/main/java/com/example/show/service/dto/response/ShowInfoServiceResponse.java +++ b/app/api/show-api/src/main/java/com/example/show/service/dto/response/ShowInfoServiceResponse.java @@ -3,40 +3,51 @@ import com.example.artist.service.dto.response.ArtistKoreanNameServiceResponse; import com.example.genre.service.dto.response.GenreNameServiceResponse; import com.example.show.controller.dto.response.SeatInfoApiResponse; -import com.example.show.controller.dto.response.TicketingInfoApiResponse; +import com.example.show.service.dto.param.ShowTicketingSiteServiceParam; import java.time.LocalDate; import java.util.List; import java.util.Set; import java.util.UUID; +import lombok.Builder; import org.example.dto.artist.response.ArtistKoreanNameResponse; import org.example.dto.genre.response.GenreNameResponse; -import org.example.dto.show.response.ShowInfoResponse; +import org.example.dto.show.response.ShowInfoDomainResponse; +@Builder public record ShowInfoServiceResponse( UUID id, String title, String content, - LocalDate date, + LocalDate startDate, + LocalDate endDate, String location, String image, SeatInfoApiResponse seatInfoApiResponse, - TicketingInfoApiResponse ticketingInfoApiResponse, + List ticketingSiteInfos, List artistKoreanNameResponses, List genreNameResponses ) { - public ShowInfoServiceResponse(ShowInfoResponse showInfoResponse) { + public ShowInfoServiceResponse(ShowInfoDomainResponse showInfo) { this( - showInfoResponse.id(), - showInfoResponse.title(), - showInfoResponse.content(), - showInfoResponse.date(), - showInfoResponse.location(), - showInfoResponse.image(), - SeatInfoApiResponse.from(showInfoResponse.seatPrice()), - TicketingInfoApiResponse.from(showInfoResponse.ticketing()), - toArtistKoreanNameServiceResponses(showInfoResponse.artistKoreanNameResponses()), - toGenreNameServiceResponses(showInfoResponse.genreNameResponses()) + showInfo.id(), + showInfo.title(), + showInfo.content(), + showInfo.startDate(), + showInfo.endDate(), + showInfo.location(), + showInfo.image(), + SeatInfoApiResponse.from(showInfo.seatPrices()), + showInfo.ticketingSites().getSites() + .stream() + .map(siteName -> + ShowTicketingSiteServiceParam.builder() + .siteName(siteName) + .siteURL(showInfo.ticketingSites().getURLOrNullBy(siteName)) + .build() + ).toList(), + toArtistKoreanNameServiceResponses(showInfo.artistKoreanNameResponses()), + toGenreNameServiceResponses(showInfo.genreNameResponses()) ); } diff --git a/app/api/show-api/src/main/java/com/example/show/service/dto/response/ShowSeatServiceResponse.java b/app/api/show-api/src/main/java/com/example/show/service/dto/response/ShowSeatServiceResponse.java new file mode 100644 index 00000000..f24de443 --- /dev/null +++ b/app/api/show-api/src/main/java/com/example/show/service/dto/response/ShowSeatServiceResponse.java @@ -0,0 +1,15 @@ +package com.example.show.service.dto.response; + +import java.util.Map; +import lombok.Builder; +import org.example.entity.show.info.SeatPrices; + +@Builder +public record ShowSeatServiceResponse( + Map priceBySeat +) { + + public static ShowSeatServiceResponse from(SeatPrices seatPrices) { + return new ShowSeatServiceResponse(seatPrices.getPriceBySeat()); + } +} diff --git a/app/api/show-api/src/main/java/com/example/show/service/error/ShowError.java b/app/api/show-api/src/main/java/com/example/show/service/error/ShowError.java new file mode 100644 index 00000000..44c0b67a --- /dev/null +++ b/app/api/show-api/src/main/java/com/example/show/service/error/ShowError.java @@ -0,0 +1,28 @@ +package com.example.show.service.error; + +import org.example.exception.BusinessError; + +public enum ShowError implements BusinessError { + + DETAIL_NOT_FOUND { + @Override + public int getHttpStatus() { + return 404; + } + + @Override + public String getErrorCode() { + return "SHW-001"; + } + + @Override + public String getClientMessage() { + return "해당 공연을 찾을 수 없습니다."; + } + + @Override + public String getLogMessage() { + return "공연 ID에 매칭되는 정보를 찾을 수 없습니다."; + } + } +} diff --git a/app/api/show-api/src/test/java/artist/fixture/dto/ArtistDtoFixture.java b/app/api/show-api/src/test/java/artist/fixture/dto/ArtistDtoFixture.java index ff82a59a..dab10726 100644 --- a/app/api/show-api/src/test/java/artist/fixture/dto/ArtistDtoFixture.java +++ b/app/api/show-api/src/test/java/artist/fixture/dto/ArtistDtoFixture.java @@ -14,7 +14,7 @@ public class ArtistDtoFixture { "image", "test_image.jpg", "image/jpeg", - "test image content".getBytes() + "test posterImageURL content".getBytes() ); diff --git a/app/api/show-api/src/test/java/show/fixture/dto/ShowDtoFixture.java b/app/api/show-api/src/test/java/show/fixture/dto/ShowDtoFixture.java index 6ccd3a3a..fad9b07b 100644 --- a/app/api/show-api/src/test/java/show/fixture/dto/ShowDtoFixture.java +++ b/app/api/show-api/src/test/java/show/fixture/dto/ShowDtoFixture.java @@ -1,11 +1,10 @@ package show.fixture.dto; import com.example.show.controller.dto.response.SeatInfoApiResponse; -import com.example.show.controller.dto.response.TicketingInfoApiResponse; +import com.example.show.controller.vo.TicketingApiType; import com.example.show.service.dto.request.ShowCreateServiceRequest; import com.example.show.service.dto.request.ShowUpdateServiceRequest; import java.time.LocalDate; -import java.time.LocalDateTime; import java.util.List; import java.util.Map; import java.util.UUID; @@ -17,18 +16,20 @@ public class ShowDtoFixture { "image", "test_image.jpg", "image/jpeg", - "test image content".getBytes() + "test posterImageURL content".getBytes() ); public static ShowCreateServiceRequest showCreateServiceRequest() { return ShowCreateServiceRequest.builder() .title("test_title") .content("test_content") - .date(LocalDate.EPOCH) + .startDate(LocalDate.EPOCH) + .endDate(LocalDate.EPOCH) .location("test_location") .post(post) .seatInfoApiResponse(getSeatInfoApiResponse()) - .ticketingInfoApiResponse(getTicketingInfoApiResponse()) + .showTicketingSites(getTicketingSites()) + .showTicketingDates(getShowTicketingDates()) .artistIds(List.of(UUID.randomUUID())) .genreIds(List.of(UUID.randomUUID())) .build(); @@ -38,11 +39,12 @@ public static ShowUpdateServiceRequest showUpdateServiceRequest() { return ShowUpdateServiceRequest.builder() .title("test_title") .content("test_content") - .date(LocalDate.EPOCH) + .startDate(LocalDate.EPOCH) + .endDate(LocalDate.EPOCH) .location("test_location") .post(post) .seatInfoApiResponse(getSeatInfoApiResponse()) - .ticketingInfoApiResponse(getTicketingInfoApiResponse()) + .showTicketingSiteInfos(getTicketingSites()) .artistIds(List.of(UUID.randomUUID())) .genreIds(List.of(UUID.randomUUID())) .build(); @@ -59,13 +61,17 @@ private static SeatInfoApiResponse getSeatInfoApiResponse() { ); } - private static TicketingInfoApiResponse getTicketingInfoApiResponse() { - return new TicketingInfoApiResponse( - LocalDateTime.MAX, - Map.of( - "YES24", "https://YES24URL", - "인터파크", "https://인터파크URL" - ) + private static Map getTicketingSites() { + return Map.of( + "YES24", "https://YES24URL", + "인터파크", "https://인터파크URL" + ); + } + + private static Map getShowTicketingDates() { + return Map.of( + TicketingApiType.PRE, LocalDate.of(2024, 10, 1), + TicketingApiType.NORMAL, LocalDate.of(2024, 10, 12) ); } } diff --git a/app/api/show-api/src/test/java/show/service/ShowAdminServiceTest.java b/app/api/show-api/src/test/java/show/service/ShowAdminServiceTest.java index dcbbaafb..cd96a21e 100644 --- a/app/api/show-api/src/test/java/show/service/ShowAdminServiceTest.java +++ b/app/api/show-api/src/test/java/show/service/ShowAdminServiceTest.java @@ -13,6 +13,7 @@ import com.example.show.service.dto.request.ShowCreateServiceRequest; import com.example.show.service.dto.request.ShowUpdateServiceRequest; import java.util.UUID; +import org.example.dto.show.request.ShowCreationDomainRequest; import org.example.entity.show.Show; import org.example.usecase.show.ShowUseCase; import org.junit.jupiter.api.DisplayName; @@ -38,12 +39,13 @@ void showCreateWithUploadedImageUrl() { showCreateServiceRequest.post() ) ).willReturn("test_imageUrl"); + ShowCreationDomainRequest request = showCreateServiceRequest.toDomainRequest("test_imageUrl"); //when showAdminService.save(showCreateServiceRequest); //then - verify(showUseCase, times(1)).save(any(Show.class), anyList(), anyList()); + verify(showUseCase, times(1)).save(any()); } @Test diff --git a/app/api/user-api/src/main/resources/templates/show_create_form.html b/app/api/user-api/src/main/resources/templates/show_create_form.html index b16c3ef1..7b52fecc 100644 --- a/app/api/user-api/src/main/resources/templates/show_create_form.html +++ b/app/api/user-api/src/main/resources/templates/show_create_form.html @@ -9,22 +9,22 @@

추가할 공연 정보

- -
- - -
-
- + +
+ + +
+ +
- - + +
@@ -74,12 +74,12 @@

추가할 공연 정보

- +
- -
+ +
- +
@@ -87,9 +87,19 @@

추가할 공연 정보

-
+
+
+ +
+
+
+ + +
+ +
- +
@@ -101,35 +111,56 @@

추가할 공연 정보

+