Skip to content
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import lombok.Builder;

import java.time.LocalDate;
import java.util.Objects;

@Builder
public record ReadTodoDetailResponse(
Expand All @@ -15,9 +16,17 @@ public record ReadTodoDetailResponse(
LocalDate endDate,
String todoStatus,
String todoLink,
String todoPic
String todoPic,
String todoPicName
) {
public static ReadTodoDetailResponse from(Todo todo) {

// todoPic은 업로드 시 항상 "_"를 포함한 형식으로 저장됨 (예: "12345_filename.jpg")
String todoPicName = todo.getTodoPic();
if (Objects.nonNull(todoPicName) && !todoPicName.isEmpty()) {
todoPicName = todoPicName.split("_")[1];
}

return ReadTodoDetailResponse.builder()
.todoId(todo.getTodoId())
.goalTitle(todo.getGoal().getGoalTitle())
Expand All @@ -28,6 +37,7 @@ public static ReadTodoDetailResponse from(Todo todo) {
.todoStatus(todo.getTodoStatus())
.todoLink(todo.getTodoLink())
.todoPic(todo.getTodoPic())
.todoPicName(todoPicName)
.build();
}
}
Loading