Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[fix] #243 - 공연 생성 및 수정 시 performancePeriod, scheduleNumber 부여 로직 추가 #244

Merged
merged 7 commits into from
Nov 18, 2024

Conversation

hyerinhwang-sailin
Copy link
Collaborator

@hyerinhwang-sailin hyerinhwang-sailin commented Nov 4, 2024

Related issue 🛠

Work Description ✏️

  • 공연 생성, 수정 시 request body의 schduleList의 회차날짜를 기준으로 performancePeriod를 생성하고, schduleNumber를 부여하도록 코드를 수정했습니다.
  • 생성과 수정 모두에 사용되는 코드이기에 재사용을 위해 performance에 update 비즈니스 로직을 작성했습니다.

Trouble Shooting ⚽️

Related ScreenShot 📷

공연 생성

image
  • performanceDate들을 이용해 performancePeriod가 2024.11.10~2024.11.21로 정상적으로 부여된 것을 확인했습니다.
  • request에서 schduleNumber를 잘못 작성한 경우에도 schduleNumber가 다시 정상적으로 부여된 것을 확인했습니다.

공연 수정

image
  • 수정된 performanceDate들을 이용해 performancePeriod가 2024.11.06~2024.12.31로 정상적으로 부여된 것을 확인했습니다.
  • 수정된 회차 날짜에 맞게 schduleNumber가 다시 정상적으로 부여된 것을 확인했습니다.

Uncompleted Tasks 😅

To Reviewers 📢

Copy link
Member

@hoonyworld hoonyworld left a comment

Choose a reason for hiding this comment

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

고생하셨습니다 혜린님!

리뷰내용 반영하고 develop에 머지한 후 prod에 v1.1.1로 배포하면 될 것 같습니다

@@ -79,7 +79,7 @@ public PerformanceResponse createPerformance(Long memberId, PerformanceRequest r
request.performanceTeamName(),
request.performanceVenue(),
request.performanceContact(),
request.performancePeriod(),
" ",
Copy link
Member

Choose a reason for hiding this comment

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

image

period를 request로 받을 필요가 없어서, 빈문자열 처리를 하신 것 같습니다!

그런데, request DTO에서 주지 않도록 개선하는 방향이 더 깔끔할 것 같아요
클라이언트 측이랑 얘기해보고 클라이언트에서 보내지 않아도 상관없다고 하면 DTO를 수정하는게 좋아보입니다!

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

1차 스프린트에 해당되는 내용이라 우선 dto 변경없이 하되, 2차 스프린트에 반영하도록 하겠습니다! 주석으로도 남겨두겠습니다.

Comment on lines 194 to 200
if (startDate.toLocalDate().equals(endDate.toLocalDate())) {
return startDate.toLocalDate().toString().replace("-", ".");
} else {
return startDate.toLocalDate().toString().replace("-", ".")
+ "~" + endDate.toLocalDate().toString().replace("-", ".");
}
}
Copy link
Member

Choose a reason for hiding this comment

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

얼리 리턴으로 바꾸면, indent 1을 줄일 수 있을 것 같습니다!!

Comment on lines 204 to 208
for (int i = 0; i < schedules.size(); i++) {
ScheduleNumber scheduleNumber = ScheduleNumber.values()[i];
schedules.get(i).setScheduleNumber(scheduleNumber);
}
}
Copy link
Member

Choose a reason for hiding this comment

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

이 부분도 배열을 사용하는 것 보다 컬렉션(LIst)자료형을 사용하는게 나을 것 같아요!
(우테코 피드백 중 하나: 배열을 사용을 지양하고 컬렉션을 사용하라)

public void assignScheduleNumbers(List<Schedule> schedules) {
      List<ScheduleNumber> scheduleNumbers = List.of(ScheduleNumber.values());
            schedules.sort(Comparator.comparing(Schedule::getPerformanceDate));
      
      for (int i = 0; i < schedules.size(); i++) {
          if (i < scheduleNumbers.size()) {
              schedules.get(i).setScheduleNumber(scheduleNumbers.get(i));
          }
      }
  }

이렇게 코드를 짜봤는데, 로컬환경에서 한 번 더 돌려보셔서 제대로 작동하는 지 봐주시면 감사할 것 같아요!

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

배열 사용 지양하는 것이 좋군요! 배워갑니다 :)
로컬 테스트 결과 코드 이상 없습니다!

@@ -8,22 +8,25 @@
@Getter
@RequiredArgsConstructor
public enum PerformanceErrorCode implements BaseErrorCode {
Copy link
Member

Choose a reason for hiding this comment

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

저는 지금 보니 ErrorCode를 관리할 때 주석을 다는게 좋아보이네요! (가독성)

/* 400 BadRequest */
MESSAGE()

이제부터 적용하는거에 대해서는 어떻게 생각하시나요?

Copy link
Collaborator Author

@hyerinhwang-sailin hyerinhwang-sailin Nov 18, 2024

Choose a reason for hiding this comment

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

좋습니다! 모든 코드에 적용하겠습니다~

@hyerinhwang-sailin hyerinhwang-sailin merged commit bafef36 into develop Nov 18, 2024
1 check passed
@hoonyworld hoonyworld deleted the bug/#243 branch November 19, 2024 17:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[bug] 공연 회차 수정 시 performancePeriod에 반영하도록 수정
2 participants