Skip to content

Refactor/S-02 #165 : 스케줄 blockColor null 반환 버그 수정 및 리팩토링#166

Merged
hellonaeunkim merged 1 commit into
developfrom
refactor/S-02
Apr 13, 2025
Merged

Refactor/S-02 #165 : 스케줄 blockColor null 반환 버그 수정 및 리팩토링#166
hellonaeunkim merged 1 commit into
developfrom
refactor/S-02

Conversation

@hellonaeunkim
Copy link
Copy Markdown
Member

🔘 Part

  • BE
  • Infra

🔎 PR Type

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

🔧 작업 내용 상세 작성

  • [REFACTOR] S-02 #165

  • ScheduleEntity.of, updateSchedule 메서드 내 blockColor 관련 로직 수정

  • DataInitializer 내 테스트 데이터 초기화 시 blockColor 누락되지 않도록 수정

  • Response에 스케줄 블럭 색상(blockColor) 값이 정상적으로 포함되도록 개선

✔️ PR Checklist

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

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

@hellonaeunkim hellonaeunkim added the fix 기능 수정 label Apr 13, 2025
@hellonaeunkim hellonaeunkim self-assigned this Apr 13, 2025
@hellonaeunkim hellonaeunkim linked an issue Apr 13, 2025 that may be closed by this pull request
2 tasks
.scheduleTitle(scheduleRequest.getScheduleTitle())
.startDate(scheduleRequest.getStartDate())
.endDate(scheduleRequest.getEndDate())
.blockColor(scheduleRequest.getBlockColor())
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

ScheduleEntity 생성자에 blockColor 설정 로직이 추가되었습니다. scheduleRequest 객체가 null일 경우 예외처리가 필요합니다. NullPointerException을 방지하기 위해 Objects.requireNonNull(scheduleRequest) 와 같은 null 체크를 추가하는 것을 권장합니다. 또한, scheduleRequest.getBlockColor() 가 null 또는 유효하지 않은 값을 반환할 가능성도 고려해야 합니다. 예외 처리 또는 유효성 검증 로직을 추가하는 것이 좋습니다.

this.scheduleTitle = scheduleRequest.getScheduleTitle();
this.startDate = scheduleRequest.getStartDate();
this.endDate = scheduleRequest.getEndDate();
this.blockColor = scheduleRequest.getBlockColor();
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

ScheduleEntity의 blockColor 필드에 값을 할당하는 로직이 추가되었습니다. 위와 마찬가지로 scheduleRequestscheduleRequest.getBlockColor() 의 null 또는 유효성 검증이 필요합니다. NullPointerException 및 예외 상황을 처리해야 합니다. setter 메서드를 사용하는 것이 더 나은 객체 지향적인 설계일 수 있습니다.

.scheduleTitle("테스트 일정 제목")
.startDate(LocalDate.now())
.endDate(LocalDate.now().plusDays(2))
.blockColor("#FF5733")
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

DataInitializer에서 blockColor에 "#FF5733" 값을 하드코딩했습니다. 이 값은 설정 파일이나 다른 곳에서 가져오는 것이 더 유지보수성이 좋습니다. 하드코딩된 값을 수정해야 할 때 코드 여러 곳을 수정해야하는 불편함이 생길 수 있습니다. 설정 파일 또는 상수 클래스를 사용하여 관리하는 것을 권장합니다.

@hellonaeunkim hellonaeunkim merged commit 2bd67ce into develop Apr 13, 2025
1 check passed
@hellonaeunkim hellonaeunkim deleted the refactor/S-02 branch April 13, 2025 12:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

fix 기능 수정

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[REFACTOR] S-02

1 participant