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 @@ -14,6 +14,9 @@ public class TravelResponse {
@JsonProperty("travel_id")
private Long id;

@JsonProperty("schedule_day_id")
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TravelResponse DTO에 scheduleDayId 필드가 추가되었습니다. @JsonProperty 어노테이션을 사용하여 JSON 응답 시 필드명을 schedule_day_id로 변환하는 것이 적절한지 확인해야 합니다. 카멜 케이스(scheduleDayId)를 사용하는 것이 더 나은 선택일 수 있습니다. 또한, scheduleDayId 필드의 null 가능성을 고려하여 Long 대신 Long 타입을 사용하는 것이 좋습니다. 필드에 대한 자세한 설명(Javadoc)을 추가하는 것을 고려해 보세요.

private Long scheduleDayId;

@JsonProperty("id")
private String kakaomapId;

Expand All @@ -36,6 +39,7 @@ public class TravelResponse {
public static TravelResponse from(TravelEntity travelEntity) {
return TravelResponse.builder()
.id(travelEntity.getId())
.scheduleDayId(travelEntity.getScheduleDay().getId())
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TravelResponse 객체 생성 시 scheduleDayId 필드에 travelEntity.getScheduleDay().getId() 값을 할당합니다. travelEntity.getScheduleDay()가 null일 가능성을 고려하여 null 체크를 추가해야 합니다. NullPointerException을 방지하기 위해 Optional을 사용하거나, if문으로 null 체크를 추가하는 것을 추천합니다. 예를 들어, Optional.ofNullable(travelEntity.getScheduleDay()).map(ScheduleDay::getId).orElse(null) 과 같이 처리할 수 있습니다. 또는, travelEntity.getScheduleDay()가 null일 경우 어떤 값을 할당할지 명확하게 정의해야 합니다.

.kakaomapId(travelEntity.getKakaomapId())
.location(travelEntity.getLocation())
.category(travelEntity.getCategory())
Expand Down