Fix/#186 calendar event 권한 오류 해결 및 colorchip enum 생성#201
Fix/#186 calendar event 권한 오류 해결 및 colorchip enum 생성#201yeongsinkeem merged 3 commits intodev_tempfrom
Conversation
- 프론트엔드와 협의 후 기존 헥사 코드로 주고 받도록 구현되어있던 colorChip을 enum으로 리팩토링했습니다. - @JsonCreator와 @jsonvalue를 활용해 프론트엔드에서는 소문자로, 백엔드에서는 대문자로 관리해도 자동 변환되도록 했습니다.
Summary of ChangesHello @tishakong, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! 이 Pull Request는 Tackit 애플리케이션의 핵심 사용자 및 조직 관리 모델을 대대적으로 개편하여 멀티 프로필 기능을 지원하고, 이를 기반으로 새로운 이벤트 및 투표 기능을 추가합니다. 기존 시스템의 여러 컴포넌트가 새로운 MemberOrg 중심의 구조에 맞춰 재설계되었으며, 이는 향후 확장성과 유연성을 크게 향상시킬 것으로 기대됩니다. 또한, 이전 작업에서 발생했던 권한 관련 문제를 해결하고, 사용자 경험을 개선하기 위한 ColorChip Enum을 도입했습니다. Highlights
Changelog
Activity
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Code Review
이 PR은 EventService에서 MemberOrgValidator와 memberOrgId를 올바르게 사용하여 권한 문제를 해결했습니다. 또한, 문자열 기반의 색상 코드를 ColorChip 열거형으로 대체하여 타입 안정성과 유지보수성을 향상시켰습니다. 전반적으로 변경 사항이 잘 적용되었습니다. 몇 가지 개선 사항을 제안합니다. 새로 추가된 ColorChip 열거형의 성능 최적화와 EventCreateReqDto에서 더 적절한 유효성 검사 어노테이션을 사용하는 것에 대한 제안입니다.
src/main/java/org/example/tackit/domain/event/dto/EventCreateReqDto.java
Outdated
Show resolved
Hide resolved
| // 프론트엔드 -> 백엔드 역직렬화 용 | ||
| @JsonCreator | ||
| public static ColorChip from(String value) { | ||
| for (ColorChip color : ColorChip.values()) { | ||
| if (color.getColorName().equalsIgnoreCase(value)) { | ||
| return color; | ||
| } | ||
| } | ||
| throw new IllegalArgumentException("지원하지 않는 컬러칩 색상입니다: " + value); | ||
| } |
There was a problem hiding this comment.
성능 향상을 위해 from 메서드를 최적화하는 것을 제안합니다. 현재 구현은 from 메서드가 호출될 때마다 ColorChip.values()를 순회하여 O(N)의 시간 복잡도를 가집니다. Enum의 값이 많아지면 성능에 영향을 줄 수 있습니다.
정적 Map을 사용하여 색상 이름을 키로 ColorChip 인스턴스를 저장하면 O(1) 시간 복잡도로 조회가 가능합니다.
아래와 같이 수정할 수 있습니다. 이 변경을 적용하려면 파일 상단에 java.util.Map, java.util.stream.Stream, java.util.stream.Collectors, java.util.function.Function을 임포트해야 합니다.
private static final Map<String, ColorChip> nameMap = Stream.of(values())
.collect(Collectors.toMap(color -> color.colorName.toLowerCase(), Function.identity()));
// 프론트엔드 -> 백엔드 역직렬화 용
@JsonCreator
public static ColorChip from(String value) {
if (value == null) {
throw new IllegalArgumentException("ColorChip 이름은 null일 수 없습니다.");
}
ColorChip result = nameMap.get(value.toLowerCase());
if (result == null) {
throw new IllegalArgumentException("지원하지 않는 컬러칩 색상입니다: " + value);
}
return result;
}
이슈 번호
작업 내용