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

[Feat#65] 안건 순서 수정 기능 개발 #66

Merged
merged 3 commits into from
Feb 21, 2024
Merged

Conversation

FacerAin
Copy link
Collaborator

🔗 Linked Issue

resolved: #65

🛠 개발 기능

  • 안건 순서를 수정할 수 있도록 하였습니다.

🧩 해결 방법

  • 안건 생성시 (안건 개수 + 1)인 orderNum을 부여받습니다.
  • 안건 조회시 orderNum에 따라 정렬됩니다.
  • 안건 순서 수정 컨트롤러를 통해 요청으로 들어온 agendaIds에 맞게 orderNum이 재배치됩니다.

🔍 리뷰 포인트

  • 안건 순서 수정시 빠진 예외 처리가 없을지 확인부탁드려요!


📋 Code Review Priority Guideline

  • 🚨 P1: Request Change
    • 필수 반영: 꼭 반영해주시고, 적극적으로 고려해주세요 (수용 혹은 토론).
  • 💬 P2: Comment
    • 권장 반영: 웬만하면 반영해주세요.
  • 👍 P3: Approve
    • 선택 반영: 반영해도 좋고 넘어가도 좋습니다. 그냥 사소한 의견입니다.

Copy link
Collaborator

@Starlight258 Starlight258 left a comment

Choose a reason for hiding this comment

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

기능 구현 잘 해주셨네요! 고생많으셨습니다 😄

Comment on lines +160 to +163
if (agendaList.size() != agendaIds.stream().distinct().count()) {
throw new BadRequestError(BadRequestError.ErrorCode.VALIDATION_FAILED,
Collections.singletonMap("AgendaIds", "Agenda Ids are not unique"));
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

예외 처리 좋습니다 👍

Comment on lines +165 to +174
for (int i = 0; i < agendaIds.size(); i++) {
Long agendaId = agendaIds.get(i);
Agenda agenda = agendaList.stream()
.filter(a -> a.getId().equals(agendaId))
.findFirst()
.orElseThrow(() -> new NotFoundError(ErrorCode.RESOURCE_NOT_FOUND,
Collections.singletonMap("AgendaId", "Agenda Id " + agendaId + " not found")));
agenda.setOrderNum(i + 1);
}
agendaList.sort(Comparator.comparing(Agenda::getOrderNum));
Copy link
Collaborator

Choose a reason for hiding this comment

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

로직 잘 짜여졌네요 !!

Comment on lines +160 to +163
if (agendaList.size() != agendaIds.size()) {
throw new BadRequestError(BadRequestError.ErrorCode.VALIDATION_FAILED,
Collections.singletonMap("AgendaIds", "Agenda Ids size is not matched"));
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

예외 처리 다 잘 진행되었네요 :)

@Starlight258 Starlight258 merged commit b563cdc into dev Feb 21, 2024
1 check passed
@Starlight258 Starlight258 deleted the feat/agenda-order branch March 18, 2024 00:37
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.

2 participants