Skip to content

Refactor/S-01 #171 : TravelResponse 값에 scheduleDayId 누락으로 인한 CURD 오류 수정#173

Merged
hellonaeunkim merged 1 commit into
developfrom
refactor/S-01
Apr 14, 2025
Merged

Refactor/S-01 #171 : TravelResponse 값에 scheduleDayId 누락으로 인한 CURD 오류 수정#173
hellonaeunkim merged 1 commit into
developfrom
refactor/S-01

Conversation

@hellonaeunkim
Copy link
Copy Markdown
Member

🔘 Part

  • BE
  • Infra

🔎 PR Type

  • 새로운 기능 추가
  • 버그 수정
  • 주요 코드 리팩토링(성능 최적화 등)
  • 간단 코드 리팩토링(주석, 코드 컨벤션, 오타 수정 등)
  • 기타 (기타 사항 기입)

🔧 작업 내용 상세 작성

✔️ PR Checklist

  • 커밋 메세지를 컨벤션에 맞게 잘 적용 하였나요?

  • 테스트 코드 작성 / 단위 테스트 or 통합 테스트 진행 하셨나요?

@hellonaeunkim hellonaeunkim added the bug 버그 관련 label Apr 14, 2025
@hellonaeunkim hellonaeunkim self-assigned this Apr 14, 2025
@hellonaeunkim hellonaeunkim linked an issue Apr 14, 2025 that may be closed by this pull request
2 tasks
@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)을 추가하는 것을 고려해 보세요.

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일 경우 어떤 값을 할당할지 명확하게 정의해야 합니다.

@hellonaeunkim hellonaeunkim merged commit c0dd7c5 into develop Apr 14, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug 버그 관련

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[REFACTOR] S-01

1 participant