Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions sql/init.sql
Original file line number Diff line number Diff line change
Expand Up @@ -366,6 +366,8 @@ CREATE TABLE events
end_at DATETIME NOT NULL,
thumb_url VARCHAR(1023) NOT NULL,
app_version VARCHAR(63) NOT NULL,
button_visible BOOLEAN NOT NULL,
button_text VARCHAR(63) NULL,
created_at DATETIME NOT NULL,
updated_at DATETIME NOT NULL,
deleted_at DATETIME NULL
Expand All @@ -376,6 +378,8 @@ CREATE TABLE events_detail
id BIGINT PRIMARY KEY auto_increment,
events_id BIGINT NOT NULL UNIQUE,
routing_url VARCHAR(1023) NULL,
button_visible BOOLEAN NOT NULL,
button_text VARCHAR(63) NULL,
created_at DATETIME NOT NULL,
updated_at DATETIME NOT NULL,
deleted_at DATETIME NULL,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ public static EventsDetail toEventsDetail(
return EventsDetail.builder()
.events(events)
.routingUrl(request.routingUrl())
.buttonVisible(request.buttonVisible())
.buttonText(request.buttonText())
.build();
}

Expand All @@ -27,6 +29,8 @@ public static EventsDetailResponse fromEventsDetail(final EventsDetail eventsDet
eventsDetail.getId(),
eventsDetail.getEvents().getId(),
eventsDetail.getRoutingUrl(),
eventsDetail.getButtonVisible(),
eventsDetail.getButtonText(),
eventsDetail.getEventsDetailImgs().stream()
.map(EventsDetailImgMapper::fromEventDetailImg)
.toList()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,14 @@ public void updateEventsDetail(
eventsDetail.updateRoutingUrl(request.routingUrl());
}

if (request.buttonVisible() != null) {
eventsDetail.updateButtonVisible(request.buttonVisible());
}

if (request.buttonText() != null) {
eventsDetail.updateButtonText(request.buttonText());
}

if (request.eventsDetailImgs() != null && !request.eventsDetailImgs().isEmpty()) {
eventsDetailImgRepository.deleteAllByEventsDetail(eventsDetail);
addEventsDetailImges(eventsDetail, request.eventsDetailImgs());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,24 @@ public class EventsDetail extends BaseEntity {
@Column(name = "routing_url", length = 1023, nullable = true)
private String routingUrl;

@Column(nullable = false)
private Boolean buttonVisible;

@Column(length = 63)
private String buttonText;

@OneToMany(mappedBy = "eventsDetail", cascade = CascadeType.ALL, orphanRemoval = true)
private List<EventsDetailImg> eventsDetailImgs = new ArrayList<>();

@Builder
private EventsDetail(Events events, String routingUrl) {
private EventsDetail(Events events,
String routingUrl,
Boolean buttonVisible,
String buttonText) {
this.events = events;
this.routingUrl = routingUrl;
this.buttonVisible = buttonVisible;
this.buttonText = buttonText;
}

public void updateEvents(final Events events) {
Expand All @@ -57,4 +68,12 @@ public void updateEvents(final Events events) {
public void updateRoutingUrl(final String routingUrl) {
this.routingUrl = routingUrl;
}

public void updateButtonVisible(final boolean buttonVisible) {
this.buttonVisible = buttonVisible;
}

public void updateButtonText(final String buttonText) {
this.buttonText = buttonText;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ public List<EventsDetail> findAllWithImgs() {
return queryFactory
.selectFrom(ed)
.leftJoin(ed.eventsDetailImgs, edi).fetchJoin()
.orderBy(ed.id.asc())
.fetch();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,14 @@ public record EventsDetailCreateRequest(
@Schema(description = "라우팅 url", example = "toduck://createPost")
String routingUrl,

@NotNull(message = "버튼 표시 여부는 비어있을 수 없습니다.")
@Schema(description = "버튼 표시 여부", example = "true")
Boolean buttonVisible,

@Size(max = 63, message = "버튼 내용은 63자를 초과할 수 없습니다.")
@Schema(description = "버튼 내용", example = "당첨 확인하기")
String buttonText,
Comment thread
wafla marked this conversation as resolved.

@Schema(description = "이벤트 디테일 URL 목록", example = "[\"https://cdn.toduck.app/image1.jpg\"]")
List<String> eventsDetailImgs
) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import java.util.List;

import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.Size;
import lombok.Builder;

@Builder
Expand All @@ -14,6 +15,13 @@ public record EventsDetailUpdateRequest(
@Schema(description = "연결 URL", example = "toduck://createPost")
String routingUrl,

@Schema(description = "버튼 표시 여부", example = "true")
Boolean buttonVisible,

@Size(max = 63, message = "버튼 내용은 63자를 초과할 수 없습니다.")
@Schema(description = "버튼 내용", example = "당첨 확인하기")
String buttonText,

@Schema(description = "변경된 이미지 URL 목록", example = "[\"https://cdn.app/image1.jpg\"]")
List<String> eventsDetailImgs
) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,12 @@ public record EventsDetailResponse(
@Schema(description = "연결 url", example = "toduck://createPost")
String routingUrl,

@Schema(description = "버튼 표시 여부", example = "true")
Boolean buttonVisible,

@Schema(description = "버튼 내용", example = "당첨 확인하기")
String buttonText,

@Schema(description = "이벤트 디테일 이미지 url 목록", example = "[\"https://cdn.toduck.app/image1.jpg\"]")
List<String> eventsDetailImgUrl
) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,9 @@ public static EventsResponse fromEvents(final Events events) {
events.getStartAt(),
events.getEndAt(),
events.getThumbUrl(),
events.getAppVersion()
events.getAppVersion(),
events.getButtonVisible(),
events.getButtonText()
);
}

Expand All @@ -33,6 +35,8 @@ public static Events toEvents(final EventsCreateRequest request) {
.endAt(request.endAt())
.thumbUrl(request.thumbUrl())
.appVersion(request.appVersion())
.buttonVisible(request.buttonVisible())
.buttonText(request.buttonText())
.build();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,12 @@ public void updateEvents(final Events events, final EventsUpdateRequest request)
if (request.appVersion() != null) {
events.updateAppVersion(request.appVersion());
}
if (request.buttonVisible() != null) {
events.updateButtonVisible(request.buttonVisible());
}
if (request.buttonText() != null) {
events.updateButtonText(request.buttonText());
}
}

@Transactional
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,17 +42,27 @@ public class Events extends BaseEntity {
@Column(length = 63, nullable = false)
private String appVersion;

@Column(nullable = false)
private Boolean buttonVisible;

@Column(length = 63)
private String buttonText;

@Builder
private Events(String eventName,
LocalDateTime startAt,
LocalDateTime endAt,
String thumbUrl,
String appVersion) {
String appVersion,
Boolean buttonVisible,
String buttonText) {
this.eventName = eventName;
this.startAt = startAt;
this.endAt = endAt;
this.thumbUrl = thumbUrl;
this.appVersion = appVersion;
this.buttonVisible = buttonVisible;
this.buttonText = buttonText;
}

public void updateEventName(final String eventName) {
Expand All @@ -74,4 +84,12 @@ public void updateThumbUrl(final String thumbUrl) {
public void updateAppVersion(final String appVersion) {
this.appVersion = appVersion;
}

public void updateButtonVisible(final boolean buttonVisible) {
this.buttonVisible = buttonVisible;
}

public void updateButtonText(final String buttonText) {
this.buttonText = buttonText;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,18 @@ public record EventsCreateRequest(
@Schema(description = "썸네일 url", example = "https://asdf.jpg")
String thumbUrl,

@NotNull(message = "최소 앱버전은 비어있을 수 없습니다.")
@Size(max = 63, message = "앱버전은 63자를 초과할 수 없습니다.")
@Schema(description = "최소 앱버전", example = "1.0.1")
String appVersion
@NotNull(message = "최소 앱 버전은 비어있을 수 없습니다.")
@Size(max = 63, message = "최소 앱 버전은 63자를 초과할 수 없습니다.")
@Schema(description = "최소 앱 버전", example = "1.0.1")
String appVersion,

@NotNull(message = "버튼 표시 여부는 비어있을 수 없습니다.")
@Schema(description = "버튼 표시 여부", example = "true")
Boolean buttonVisible,

@Size(max = 63, message = "버튼 내용은 63자를 초과할 수 없습니다.")
@Schema(description = "버튼 내용", example = "당첨 확인하기")
String buttonText
Comment thread
wafla marked this conversation as resolved.
) {

}
Original file line number Diff line number Diff line change
Expand Up @@ -2,26 +2,42 @@

import java.time.LocalDateTime;

import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.datatype.jsr310.deser.LocalDateTimeDeserializer;

import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.Size;
import lombok.Builder;

@Builder
@Schema(description = "이벤트 수정 요청 DTO")
public record EventsUpdateRequest(
@Size(max = 63, message = "이벤트 이름은 63자를 초과할 수 없습니다.")
@Schema(description = "이벤트 이름", example = "출석 이벤트")
String eventName,

@JsonDeserialize(using = LocalDateTimeDeserializer.class)
@Schema(description = "이벤트 시작 일시", example = "2025-09-21T12:00:00")
LocalDateTime startAt,

@JsonDeserialize(using = LocalDateTimeDeserializer.class)
@Schema(description = "이벤트 종료 일시", example = "2025-09-30T23:59:59")
LocalDateTime endAt,

@Schema(description = "썸네일 URL", example = "https://example.com/thumb.png")
@Size(max = 1023, message = "썸네일 url은 1023자를 초과할 수 없습니다.")
@Schema(description = "썸네일 url", example = "https://example.com/thumb.png")
String thumbUrl,

@Schema(description = "앱 버전", example = "1.0.0")
String appVersion
@Size(max = 63, message = "최소 앱 버전은 63자를 초과할 수 없습니다.")
@Schema(description = "최소 앱 버전", example = "1.0.0")
String appVersion,

@Schema(description = "버튼 표시 여부", example = "true")
Boolean buttonVisible,

@Size(max = 63, message = "버튼 내용은 63자를 초과할 수 없습니다.")
@Schema(description = "버튼 내용", example = "당첨 확인하기")
String buttonText
) {

}
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,13 @@ public record EventsResponse(
String thumbUrl,

@Schema(description = "앱 버전", example = "1.0.1")
String appVersion
String appVersion,

@Schema(description = "버튼 표시 여부", example = "true")
Boolean isButtonVisible,

@Schema(description = "버튼 내용", example = "당첨 확인하기")
String buttonText
Comment thread
wafla marked this conversation as resolved.
) {
public static List<EventsResponse> toEventsCheckResponse(List<Events> eventsList) {
return eventsList.stream()
Expand All @@ -45,6 +51,8 @@ public static List<EventsResponse> toEventsCheckResponse(List<Events> eventsList
.endAt(e.getEndAt())
.thumbUrl(e.getThumbUrl())
.appVersion(e.getAppVersion())
.isButtonVisible(e.getButtonVisible())
.buttonText(e.getButtonText())
.build())
.toList();
}
Expand Down
Loading