Skip to content

Commit

Permalink
Merge pull request #153 from MUIT-UMC/develop
Browse files Browse the repository at this point in the history
[merge] 250220 / 41th deploy
  • Loading branch information
yhi9839 authored Feb 20, 2025
2 parents aa19095 + d3efa27 commit fa37b57
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 11 deletions.
27 changes: 22 additions & 5 deletions src/main/java/muit/backend/converter/AmateurConverter.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

import java.util.Collections;
import java.util.List;
import java.util.Objects;
import java.util.stream.Collectors;
import java.util.stream.IntStream;

Expand Down Expand Up @@ -114,7 +115,6 @@ public static AmateurShowResponseDTO toResponseDTO(AmateurShow show) {
return AmateurShowResponseDTO.builder()
.id(show.getId())
.name(show.getName())
.posterImgUrl(show.getPosterImgUrl())
.place(show.getPlace())
.schedule(show.getSchedule())
.age(show.getAge())
Expand All @@ -128,18 +128,35 @@ public static AmateurShowResponseDTO toResponseDTO(AmateurShow show) {
.runtime(show.getRuntime())
.amateurStatus(show.getAmateurStatus().toString())
.castings(toCastingDTO(show.getAmateurCastingList()))
.notice(toNoticeDTO(show.getAmateurNotice()))
.noticeContent(show.getAmateurNotice().getContent())
.tickets(toTicketDTO(show.getAmateurTicketList()))
.staff(toStaffDTO(show.getAmateurStaffList()))
.summaries(toSummaryDTO(show.getAmateurSummary()))
.summaryContent(show.getAmateurSummary().getContent())
.posterImage(show.getPosterImgUrl())
.castingImages(extractCastingImages(show.getAmateurCastingList()))
.noticeImages(extractNoticeImages(show.getAmateurNotice()))
.build();
}

private static List<String> extractCastingImages(List<AmateurCasting> castingList) {
if (castingList == null) return Collections.emptyList();
return castingList.stream()
.map(AmateurCasting::getImageUrl) // 이미지 URL 필드가 있다고 가정
.filter(Objects::nonNull)
.collect(Collectors.toList());
}

private static List<String> extractNoticeImages(AmateurNotice notice) {
if (notice == null || notice.getNoticeImageUrls() == null) return Collections.emptyList();
return notice.getNoticeImageUrls();
}


private static List<AmateurShowResponseDTO.AmateurCastingDTO> toCastingDTO(List<AmateurCasting> castings) {
if (castings == null) return null;
return castings.stream()
.map(casting -> new AmateurShowResponseDTO.AmateurCastingDTO(
casting.getImageUrl(),
//casting.getImageUrl(),
casting.getActorName(),
casting.getCastingName()
))
Expand All @@ -159,7 +176,7 @@ private static List<AmateurShowResponseDTO.AmateurTicketDTO> toTicketDTO(List<Am
return tickets.stream()
.map(ticket -> new AmateurShowResponseDTO.AmateurTicketDTO(
ticket.getTicketName(),
ticket.getTicketType().toString(),
// ticket.getTicketType().toString(),
String.valueOf(ticket.getPrice())
))
.collect(Collectors.toList());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,12 @@
public class AmateurShowResponseDTO {
private Long id;
private String name;
private String posterImgUrl;
private String place;
private String schedule;
private String age;
private String starring;
private int totalTicket;
private int soldTicket;
// private int soldTicket;
private String timeInfo;
private String account;
private String contact;
Expand All @@ -28,17 +27,20 @@ public class AmateurShowResponseDTO {
private String amateurStatus;

private List<AmateurCastingDTO> castings;
private AmateurNoticeDTO notice;
private String noticeContent;
private List<AmateurTicketDTO> tickets;
private List<AmateurStaffDTO> staff;
private AmateurSummaryDTO summaries;
private String summaryContent;
private String posterImage;
private List<String> castingImages;
private List<String> noticeImages;

@Builder
@AllArgsConstructor
@NoArgsConstructor
@Getter
public static class AmateurCastingDTO {
private String imgUrl;
//private String imgUrl; // 이미지 따로 뺌
private String actorName;
private String castingName;
}
Expand All @@ -58,7 +60,7 @@ public static class AmateurNoticeDTO {
@Getter
public static class AmateurTicketDTO {
private String ticketName;
private String ticketType;
// private String ticketType; // 티켓 타입 없음
private String price;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ public static class MyPageTicketDTO {
private ReservationStatus reservationStatus;
private LocalDateTime reservationDate;
private String place;
private String cancelDate;
private String schedule;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,7 @@ public TicketResponseDTO.MyPageTicketDTO getMyTicket(Member member,Long memberTi
.place(amateurShow.getPlace())
.schedule(amateurShow.getSchedule())
.reservationStatus(memberTicket.getReservationStatus())
.cancelDate(amateurShow.getSchedule())
.build();
}

Expand All @@ -190,6 +191,7 @@ public TicketResponseDTO.MyPageTicketListDTO getMyTicketList(Member member, Rese
.schedule(ticket.getAmateurTicket().getAmateurShow().getSchedule())
.place(ticket.getAmateurTicket().getAmateurShow().getPlace())
.quantity(ticket.getQuantity())
.cancelDate(ticket.getAmateurTicket().getAmateurShow().getSchedule())
.reservationStatus(ticket.getReservationStatus())
.build())
.collect(Collectors.toList());
Expand Down

0 comments on commit fa37b57

Please sign in to comment.