Skip to content

Commit

Permalink
[#188] rename: 공연 관련 dto 패키지 정리 및 파일 이름 수정
Browse files Browse the repository at this point in the history
  • Loading branch information
hyerinhwang-sailin committed Aug 24, 2024
1 parent c31fc31 commit ba2127a
Show file tree
Hide file tree
Showing 17 changed files with 120 additions and 115 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@

import com.beat.domain.performance.application.PerformanceManagementService;
import com.beat.domain.performance.application.PerformanceModifyService;
import com.beat.domain.performance.application.dto.BookingPerformanceDetailResponse;
import com.beat.domain.performance.application.dto.MakerPerformanceResponse;
import com.beat.domain.performance.application.dto.PerformanceDetailResponse;
import com.beat.domain.performance.application.dto.PerformanceEditResponse;
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.modify.PerformanceModifyRequest;
Expand Down Expand Up @@ -74,10 +74,10 @@ public ResponseEntity<SuccessResponse<PerformanceModifyResponse>> updatePerforma

@Operation(summary = "공연 수정 페이지 정보 조회 API", description = "공연 정보를 조회하는 GET API입니다.")
@GetMapping("/{performanceId}")
public ResponseEntity<SuccessResponse<PerformanceEditResponse>> getPerformanceForEdit(
public ResponseEntity<SuccessResponse<PerformanceModifyDetailResponse>> getPerformanceForEdit(
@CurrentMember Long memberId,
@PathVariable Long performanceId) {
PerformanceEditResponse response = performanceService.getPerformanceEdit(memberId, performanceId);
PerformanceModifyDetailResponse response = performanceService.getPerformanceEdit(memberId, performanceId);
return ResponseEntity.ok(SuccessResponse.of(PerformanceSuccessCode.PERFORMANCE_MODIFY_PAGE_SUCCESS, response));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
import com.beat.domain.member.dao.MemberRepository;
import com.beat.domain.member.domain.Member;
import com.beat.domain.member.exception.MemberErrorCode;
import com.beat.domain.performance.application.dto.*;
import com.beat.domain.performance.application.dto.bookingPerformanceDetail.BookingPerformanceDetailResponse;
import com.beat.domain.performance.application.dto.bookingPerformanceDetail.BookingPerformanceDetailScheduleResponse;
import com.beat.domain.performance.application.dto.create.CastResponse;
import com.beat.domain.performance.application.dto.create.PerformanceImageResponse;
import com.beat.domain.performance.application.dto.create.ScheduleResponse;
Expand All @@ -13,6 +14,10 @@
import com.beat.domain.performance.application.dto.home.HomePromotionDetail;
import com.beat.domain.performance.application.dto.home.HomeRequest;
import com.beat.domain.performance.application.dto.home.HomeResponse;
import com.beat.domain.performance.application.dto.makerPerformance.MakerPerformanceDetailResponse;
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.performanceDetail.*;
import com.beat.domain.performance.dao.PerformanceImageRepository;
import com.beat.domain.performance.dao.PerformanceRepository;
import com.beat.domain.performance.domain.Performance;
Expand Down Expand Up @@ -64,11 +69,11 @@ public PerformanceDetailResponse getPerformanceDetail(Long performanceId) {
Performance performance = performanceRepository.findById(performanceId)
.orElseThrow(() -> new NotFoundException(PerformanceErrorCode.PERFORMANCE_NOT_FOUND));

List<PerformanceDetailSchedule> scheduleList = scheduleRepository.findByPerformanceId(performanceId).stream()
List<PerformanceDetailScheduleResponse> scheduleList = scheduleRepository.findByPerformanceId(performanceId).stream()
.map(schedule -> {
int dueDate = scheduleService.calculateDueDate(schedule);
scheduleService.updateBookingStatus(schedule);
return PerformanceDetailSchedule.of(
return PerformanceDetailScheduleResponse.of(
schedule.getId(),
schedule.getPerformanceDate(),
schedule.getScheduleNumber().name(),
Expand All @@ -79,24 +84,24 @@ public PerformanceDetailResponse getPerformanceDetail(Long performanceId) {

int minDueDate = scheduleService.getMinDueDate(scheduleRepository.findAllByPerformanceId(performanceId));

List<PerformanceDetailCast> castList = castRepository.findByPerformanceId(performanceId).stream()
.map(cast -> PerformanceDetailCast.of(
List<PerformanceDetailCastResponse> castList = castRepository.findByPerformanceId(performanceId).stream()
.map(cast -> PerformanceDetailCastResponse.of(
cast.getId(),
cast.getCastName(),
cast.getCastRole(),
cast.getCastPhoto()
)).collect(Collectors.toList());

List<PerformanceDetailStaff> staffList = staffRepository.findByPerformanceId(performanceId).stream()
.map(staff -> PerformanceDetailStaff.of(
List<PerformanceDetailStaffResponse> staffList = staffRepository.findByPerformanceId(performanceId).stream()
.map(staff -> PerformanceDetailStaffResponse.of(
staff.getId(),
staff.getStaffName(),
staff.getStaffRole(),
staff.getStaffPhoto()
)).collect(Collectors.toList());

List<PerformanceDetailImage> performanceImageList = performanceImageRepository.findAllByPerformanceId(performanceId).stream()
.map(image -> PerformanceDetailImage.of(
List<PerformanceDetailImageResponse> performanceImageList = performanceImageRepository.findAllByPerformanceId(performanceId).stream()
.map(image -> PerformanceDetailImageResponse.of(
image.getId(),
image.getPerformanceImage()
))
Expand Down Expand Up @@ -129,11 +134,11 @@ public BookingPerformanceDetailResponse getBookingPerformanceDetail(Long perform
Performance performance = performanceRepository.findById(performanceId)
.orElseThrow(() -> new NotFoundException(PerformanceErrorCode.PERFORMANCE_NOT_FOUND));

List<BookingPerformanceDetailSchedule> scheduleList = scheduleRepository.findByPerformanceId(performanceId).stream()
List<BookingPerformanceDetailScheduleResponse> scheduleList = scheduleRepository.findByPerformanceId(performanceId).stream()
.map(schedule -> {
scheduleService.updateBookingStatus(schedule);
int dueDate = scheduleService.calculateDueDate(schedule);
return BookingPerformanceDetailSchedule.of(
return BookingPerformanceDetailScheduleResponse.of(
schedule.getId(),
schedule.getPerformanceDate(),
schedule.getScheduleNumber().name(),
Expand Down Expand Up @@ -234,12 +239,12 @@ public MakerPerformanceResponse getMemberPerformances(Long memberId) {

List<Performance> performances = performanceRepository.findByUsersId(user.getId());

List<MakerPerformanceDetail> performanceDetails = performances.stream()
List<MakerPerformanceDetailResponse> performanceDetails = performances.stream()
.map(performance -> {
List<Schedule> schedules = scheduleRepository.findByPerformanceId(performance.getId());
int minDueDate = scheduleService.getMinDueDate(schedules);

return MakerPerformanceDetail.of(
return MakerPerformanceDetailResponse.of(
performance.getId(),
performance.getGenre().name(),
performance.getPerformanceTitle(),
Expand All @@ -251,15 +256,15 @@ public MakerPerformanceResponse getMemberPerformances(Long memberId) {
.collect(Collectors.toList());

// 양수 minDueDate 정렬
List<MakerPerformanceDetail> positiveDueDates = performanceDetails.stream()
List<MakerPerformanceDetailResponse> positiveDueDates = performanceDetails.stream()
.filter(detail -> detail.minDueDate() >= 0)
.sorted(Comparator.comparingInt(MakerPerformanceDetail::minDueDate))
.sorted(Comparator.comparingInt(MakerPerformanceDetailResponse::minDueDate))
.collect(Collectors.toList());

// 음수 minDueDate 정렬
List<MakerPerformanceDetail> negativeDueDates = performanceDetails.stream()
List<MakerPerformanceDetailResponse> negativeDueDates = performanceDetails.stream()
.filter(detail -> detail.minDueDate() < 0)
.sorted(Comparator.comparingInt(MakerPerformanceDetail::minDueDate).reversed())
.sorted(Comparator.comparingInt(MakerPerformanceDetailResponse::minDueDate).reversed())
.collect(Collectors.toList());

// 병합된 리스트
Expand All @@ -270,7 +275,7 @@ public MakerPerformanceResponse getMemberPerformances(Long memberId) {


@Transactional
public PerformanceEditResponse getPerformanceEdit(Long memberId, Long performanceId) {
public PerformanceModifyDetailResponse getPerformanceEdit(Long memberId, Long performanceId) {
Member member = memberRepository.findById(memberId)
.orElseThrow(() -> new NotFoundException(MemberErrorCode.MEMBER_NOT_FOUND));

Expand All @@ -295,7 +300,7 @@ public PerformanceEditResponse getPerformanceEdit(Long memberId, Long performanc
return mapToPerformanceEditResponse(performance, schedules, casts, staffs, performanceImages, isBookerExist);
}

private PerformanceEditResponse mapToPerformanceEditResponse(Performance performance, List<Schedule> schedules, List<Cast> casts, List<Staff> staffs, List<PerformanceImage> performanceImages, boolean isBookerExist) {
private PerformanceModifyDetailResponse mapToPerformanceEditResponse(Performance performance, List<Schedule> schedules, List<Cast> casts, List<Staff> staffs, List<PerformanceImage> performanceImages, boolean isBookerExist) {
List<ScheduleResponse> scheduleResponses = schedules.stream()
.map(schedule -> ScheduleResponse.of(
schedule.getId(),
Expand Down Expand Up @@ -331,7 +336,7 @@ private PerformanceEditResponse mapToPerformanceEditResponse(Performance perform
))
.collect(Collectors.toList());

return PerformanceEditResponse.of(
return PerformanceModifyDetailResponse.of(
performance.getUsers().getId(),
performance.getId(),
performance.getPerformanceTitle(),
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
package com.beat.domain.performance.application.dto;
package com.beat.domain.performance.application.dto.bookingPerformanceDetail;

import java.util.List;

public record BookingPerformanceDetailResponse(
Long performanceId,
String performanceTitle,
String performancePeriod,
List<BookingPerformanceDetailSchedule> scheduleList,
List<BookingPerformanceDetailScheduleResponse> scheduleList,
int ticketPrice,
String genre,
String posterImage,
Expand All @@ -20,7 +20,7 @@ public static BookingPerformanceDetailResponse of(
Long performanceId,
String performanceTitle,
String performancePeriod,
List<BookingPerformanceDetailSchedule> scheduleList,
List<BookingPerformanceDetailScheduleResponse> scheduleList,
int ticketPrice,
String genre,
String posterImage,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
package com.beat.domain.performance.application.dto.bookingPerformanceDetail;

import java.time.LocalDateTime;

public record BookingPerformanceDetailScheduleResponse(
Long scheduleId,
LocalDateTime performanceDate,
String scheduleNumber,
int availableTicketCount,
boolean isBooking,
int dueDate
) {
public static BookingPerformanceDetailScheduleResponse of(Long scheduleId, LocalDateTime performanceDate, String scheduleNumber, int availableTicketCount, boolean isBooking, int dueDate) {
return new BookingPerformanceDetailScheduleResponse(scheduleId, performanceDate, scheduleNumber, availableTicketCount, isBooking, dueDate);
}

}
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
package com.beat.domain.performance.application.dto;
package com.beat.domain.performance.application.dto.makerPerformance;

public record MakerPerformanceDetail(
public record MakerPerformanceDetailResponse(
Long performanceId,
String genre,
String performanceTitle,
String posterImage,
String performancePeriod,
int minDueDate
) {
public static MakerPerformanceDetail of(
public static MakerPerformanceDetailResponse of(
Long performanceId,
String genre,
String performanceTitle,
String posterImage,
String performancePeriod,
int minDueDate) { // minDueDate 매개변수 추가
return new MakerPerformanceDetail(performanceId, genre, performanceTitle, posterImage, performancePeriod, minDueDate);
return new MakerPerformanceDetailResponse(performanceId, genre, performanceTitle, posterImage, performancePeriod, minDueDate);
}
}
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
package com.beat.domain.performance.application.dto;
package com.beat.domain.performance.application.dto.makerPerformance;

import java.util.List;

public record MakerPerformanceResponse(
Long userId,
List<MakerPerformanceDetail> performances
List<MakerPerformanceDetailResponse> performances
) {
public static MakerPerformanceResponse of(
Long userId,
List<MakerPerformanceDetail> performances) {
List<MakerPerformanceDetailResponse> performances) {
return new MakerPerformanceResponse(userId, performances);
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.beat.domain.performance.application.dto;
package com.beat.domain.performance.application.dto.modify;

import com.beat.domain.performance.application.dto.create.CastResponse;
import com.beat.domain.performance.application.dto.create.PerformanceImageResponse;
Expand All @@ -9,7 +9,7 @@

import java.util.List;

public record PerformanceEditResponse(
public record PerformanceModifyDetailResponse(
Long userId,
Long performanceId,
String performanceTitle,
Expand All @@ -33,7 +33,7 @@ public record PerformanceEditResponse(
List<StaffResponse> staffList,
List<PerformanceImageResponse> performanceImageList
) {
public static PerformanceEditResponse of(
public static PerformanceModifyDetailResponse of(
Long userId,
Long performanceId,
String performanceTitle,
Expand All @@ -57,7 +57,7 @@ public static PerformanceEditResponse of(
List<StaffResponse> staffList,
List<PerformanceImageResponse> performanceImageList
) {
return new PerformanceEditResponse(
return new PerformanceModifyDetailResponse(
userId,
performanceId,
performanceTitle,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package com.beat.domain.performance.application.dto.performanceDetail;

public record PerformanceDetailCastResponse(
Long castId,
String castName,
String castRole,
String castPhoto
) {
public static PerformanceDetailCastResponse of(Long castId, String castName, String castRole, String castPhoto) {
return new PerformanceDetailCastResponse(castId, castName, castRole, castPhoto);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
package com.beat.domain.performance.application.dto.performanceDetail;

public record PerformanceDetailImageResponse(
Long performanceImageId,
String performanceImage
) {
public static PerformanceDetailImageResponse of(Long performanceImageId, String performanceImage) {
return new PerformanceDetailImageResponse(performanceImageId, performanceImage);
}
}
Loading

0 comments on commit ba2127a

Please sign in to comment.