Skip to content

Commit dc95b8b

Browse files
committed
feat: 간단한 공연 정보 일정에 자동 반영
1 parent abbdfe9 commit dc95b8b

6 files changed

Lines changed: 187 additions & 62 deletions

File tree

src/main/java/com/back/web7_9_codecrete_be/domain/plans/dto/response/PlanDetailResponse.java

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,21 @@ public static class ScheduleInfo {
8686
private Integer distance;
8787
@Schema(description = "교통 수단 타입 (TRANSPORT 타입일 때)", example = "SUBWAY")
8888
private Schedule.TransportType transportType;
89+
@Schema(description = "메인 이벤트(콘서트) 여부", example = "true")
90+
private Boolean isMainEvent;
91+
// 아래 공연 정보들은 isMainEvent가 true인 경우 필요
92+
@Schema(description = "공연 ID", example = "1")
93+
private Long concertId;
94+
@Schema(description = "공연 이름", example = "2024 봄 콘서트")
95+
private String concertName;
96+
@Schema(description = "공연 포스터 URL", example = "https://example.com/poster.jpg")
97+
private String concertPosterUrl;
98+
@Schema(description = "공연 장소 이름", example = "올림픽공원 올림픽홀")
99+
private String concertPlaceName;
100+
@Schema(description = "공연 최저가", example = "50000")
101+
private Integer concertMinPrice;
102+
@Schema(description = "공연 최고가", example = "150000")
103+
private Integer concertMaxPrice;
89104
@Schema(description = "생성 일시", example = "2024-12-01T10:00:00")
90105
private LocalDateTime createdDate;
91106
@Schema(description = "수정 일시", example = "2024-12-01T10:00:00")

src/main/java/com/back/web7_9_codecrete_be/domain/plans/dto/response/ScheduleResponse.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,14 @@ public class ScheduleResponse {
2727
private Double endPlaceLon;
2828
private Integer distance;
2929
private Schedule.TransportType transportType;
30+
private Boolean isMainEvent;
31+
// 공연 정보 (isMainEvent가 true인 경우)
32+
private Long concertId;
33+
private String concertName;
34+
private String concertPosterUrl;
35+
private String concertPlaceName;
36+
private Integer concertMinPrice;
37+
private Integer concertMaxPrice;
3038
private LocalDateTime createdDate;
3139
private LocalDateTime modifiedDate;
3240
}

src/main/java/com/back/web7_9_codecrete_be/domain/plans/entity/Schedule.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,10 @@ public class Schedule {
8282
@Column(name = "modified_date", nullable = false)
8383
private LocalDateTime modifiedDate;
8484

85+
// 메인 이벤트(콘서트) 여부 - true인 경우 삭제 불가
86+
@Column(name = "is_main_event", nullable = false)
87+
private Boolean isMainEvent = false;
88+
8589

8690
@Builder
8791
public Schedule(Plan plan, ScheduleType scheduleType, String title,
@@ -90,7 +94,8 @@ public Schedule(Plan plan, ScheduleType scheduleType, String title,
9094
Integer estimatedCost, String details,
9195
Double startPlaceLat, Double startPlaceLon,
9296
Double endPlaceLat, Double endPlaceLon,
93-
Integer distance, TransportType transportType) {
97+
Integer distance, TransportType transportType,
98+
Boolean isMainEvent) {
9499
this.plan = plan;
95100
this.scheduleType = scheduleType;
96101
this.title = title;
@@ -107,6 +112,7 @@ public Schedule(Plan plan, ScheduleType scheduleType, String title,
107112
this.endPlaceLon = endPlaceLon;
108113
this.distance = distance;
109114
this.transportType = transportType;
115+
this.isMainEvent = isMainEvent != null ? isMainEvent : false;
110116
}
111117

112118
public void update(ScheduleType scheduleType, String title,
Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package com.back.web7_9_codecrete_be.domain.plans.repository;
22

33
import com.back.web7_9_codecrete_be.domain.plans.entity.Schedule;
4+
import org.springframework.data.jpa.repository.EntityGraph;
45
import org.springframework.data.jpa.repository.JpaRepository;
56
import org.springframework.stereotype.Repository;
67

@@ -12,16 +13,16 @@ public interface ScheduleRepository extends JpaRepository<Schedule, Long> {
1213

1314
/**
1415
* 특정 Plan의 모든 일정을 시작 시간 순서대로 조회
16+
* Plan, Concert, ConcertPlace까지 조인 (메인 이벤트의 Concert 정보 포함)
1517
*/
18+
@EntityGraph(attributePaths = {"plan", "plan.concert", "plan.concert.concertPlace"})
1619
List<Schedule> findByPlan_PlanIdOrderByStartAtAsc(Long planId);
1720

18-
/**
19-
* 특정 Plan에 속한 Schedule의 개수 조회 (다음 순서 계산용)
20-
*/
21-
long countByPlan_PlanId(Long planId);
22-
2321
/**
2422
* 특정 Plan과 ID로 일정 조회
23+
* Plan, Concert, ConcertPlace까지 조인 (메인 이벤트의 Concert 정보 포함)
2524
*/
25+
@EntityGraph(attributePaths = {"plan", "plan.concert", "plan.concert.concertPlace"})
2626
Optional<Schedule> findByScheduleIdAndPlan_PlanId(Long scheduleId, Long planId);
27-
}
27+
28+
}

0 commit comments

Comments
 (0)