-
Notifications
You must be signed in to change notification settings - Fork 1
[refactor] 유저 장애유형,이동보조수단 enum 처리 및 유저 이미지 등록 관련 로직 주석 처리 #93
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
Conversation
Walkthrough
Changes
Sequence Diagram(s)sequenceDiagram
participant Client
participant Controller
participant UserInfoService
participant User(Entity)
participant DB
Client->>Controller: 사용자 정보 등록/수정 요청 (DTO에 enum 리스트 포함)
Controller->>UserInfoService: registerUserInfo/updateUserInfo(dto)
UserInfoService->>User(Entity): enum 리스트로 필드 설정
User(Entity)->>DB: Enum 리스트를 별도 테이블로 저장/갱신
UserInfoService-->>Controller: 처리 결과 반환
Controller-->>Client: 응답 반환
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~15 minutes Possibly related PRs
Suggested reviewers
Poem
Note ⚡️ Unit Test Generation is now available in beta!Learn more here, or try it out under "Finishing Touches" below. 📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
✨ Finishing Touches
🧪 Generate unit tests
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 2
🔭 Outside diff range comments (1)
src/main/java/com/wayble/server/user/entity/User.java (1)
3-3: 불필요한 import 제거 필요
StringListConverter가 더 이상 사용되지 않으므로 import를 제거해야 합니다.-import com.wayble.server.common.converter.StringListConverter;
🧹 Nitpick comments (3)
src/main/java/com/wayble/server/user/entity/DisabilityType.java (1)
3-8: 잘 정의된 장애유형 enum입니다.장애유형을 명확한 enum 상수로 정의하고 한국어 주석을 추가하여 가독성을 높였습니다. 각 상수명도 직관적이고 적절합니다.
향후 새로운 장애유형이 추가될 가능성을 고려하여, 데이터베이스 마이그레이션 전략을 미리 계획해두시기 바랍니다.
src/main/java/com/wayble/server/user/dto/UserInfoRegisterRequestDto.java (1)
36-39: 주석 처리된 코드에 대한 명확한 관리 필요프로필 이미지 관련 코드가 주석 처리되어 있습니다. 향후 사용 계획이 있다면 TODO 주석이나 이슈 트래킹을 통해 명확히 관리하는 것이 좋겠습니다.
다음과 같이 개선해보세요:
- /* 유저 이미지 등록 관련 (추후에 사용할 수도 있어서 주석처리) + /* TODO: 유저 이미지 등록 관련 - Issue #XX 참조 @Pattern(regexp = "^(https?://).*", message = "올바른 URL 형식이어야 합니다.") private String profileImageUrl; */src/main/java/com/wayble/server/user/entity/User.java (1)
62-72: 성능 최적화 고려사항
@ElementCollection은 기본적으로FetchType.LAZY를 사용하고 있어 좋습니다. 다만 이 필드들이 자주 함께 조회된다면@BatchSize어노테이션 추가를 고려해보세요.성능 최적화가 필요한 경우:
+import org.hibernate.annotations.BatchSize; + +@BatchSize(size = 10) @ElementCollection(fetch = FetchType.LAZY)
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (7)
src/main/java/com/wayble/server/user/dto/UserInfoRegisterRequestDto.java(2 hunks)src/main/java/com/wayble/server/user/dto/UserInfoResponseDto.java(2 hunks)src/main/java/com/wayble/server/user/dto/UserInfoUpdateRequestDto.java(2 hunks)src/main/java/com/wayble/server/user/entity/DisabilityType.java(1 hunks)src/main/java/com/wayble/server/user/entity/MobilityAid.java(1 hunks)src/main/java/com/wayble/server/user/entity/User.java(2 hunks)src/main/java/com/wayble/server/user/service/UserInfoService.java(3 hunks)
🧰 Additional context used
🧠 Learnings (1)
📚 Learning: java에서 같은 패키지 내의 클래스들은 import 구문 없이 서로를 참조할 수 있다. com.wayble.server.user.entity 패키지 내의 클래스들은 명시적인 im...
Learnt from: seung-in-Yoo
PR: Wayble-Project/wayble-spring#37
File: src/main/java/com/wayble/server/user/entity/User.java:61-62
Timestamp: 2025-07-13T15:08:59.318Z
Learning: Java에서 같은 패키지 내의 클래스들은 import 구문 없이 서로를 참조할 수 있다. com.wayble.server.user.entity 패키지 내의 클래스들은 명시적인 import 없이 사용 가능하다.
Applied to files:
src/main/java/com/wayble/server/user/dto/UserInfoUpdateRequestDto.javasrc/main/java/com/wayble/server/user/entity/User.javasrc/main/java/com/wayble/server/user/entity/DisabilityType.javasrc/main/java/com/wayble/server/user/dto/UserInfoRegisterRequestDto.javasrc/main/java/com/wayble/server/user/dto/UserInfoResponseDto.java
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
- GitHub Check: run-docker-image-on-ec2
🔇 Additional comments (12)
src/main/java/com/wayble/server/user/entity/MobilityAid.java (1)
3-8: 이동보조수단 enum이 잘 정의되었습니다.다양한 이동보조수단을 적절하게 분류하였고, NONE 옵션을 포함하여 모든 경우를 처리할 수 있도록 했습니다. 각 상수명과 주석도 명확합니다.
src/main/java/com/wayble/server/user/service/UserInfoService.java (3)
42-42: 프로필 이미지 로직 주석 처리가 적절합니다.프론트엔드 팀과의 논의에 따라 우선순위가 낮아진 기능을 임시로 비활성화한 것으로 이해됩니다. 추후 활성화를 위한 주석도 명확합니다.
84-88: 주석 처리된 프로필 이미지 수정 로직입니다.일관되게 프로필 이미지 관련 기능을 주석 처리했습니다. 블록 주석 형태로 정리되어 있어 향후 재활성화 시 쉽게 찾을 수 있습니다.
121-121: 응답 DTO에서도 프로필 이미지 URL이 적절히 주석 처리되었습니다.다른 메서드들과 일관되게 프로필 이미지 관련 로직이 주석 처리되어 전체적인 일관성을 유지했습니다.
src/main/java/com/wayble/server/user/dto/UserInfoUpdateRequestDto.java (3)
3-3: 새로운 enum 타입에 대한 import가 적절히 추가되었습니다.DisabilityType과 MobilityAid enum 사용을 위한 필수 import가 추가되었습니다.
Also applies to: 5-5
18-19: 필드 타입이 enum으로 적절히 변경되었습니다.String 리스트에서 강타입 enum 리스트로 변경하여 타입 안전성과 코드 가독성이 향상되었습니다. 복수 선택이 가능하도록 List 타입을 유지한 것도 적절합니다.
20-23: 프로필 이미지 필드가 일관되게 주석 처리되었습니다.서비스 레이어와 동일하게 프로필 이미지 관련 기능이 주석 처리되어 전체적인 일관성을 유지했습니다. 검증 어노테이션도 함께 주석 처리되어 완전성을 확보했습니다.
src/main/java/com/wayble/server/user/dto/UserInfoResponseDto.java (3)
3-3: enum 타입 import가 적절히 추가되었습니다.다른 DTO 클래스들과 일관되게 DisabilityType과 MobilityAid enum에 대한 import가 추가되었습니다.
Also applies to: 5-5
19-20: 응답 DTO의 필드 타입이 enum으로 올바르게 변경되었습니다.요청 DTO들과 일관되게 String 리스트에서 강타입 enum 리스트로 변경되어 API 응답의 타입 안전성이 향상되었습니다. 복수 선택 가능하다는 주석도 명확합니다.
21-21: 프로필 이미지 URL 필드가 일관되게 주석 처리되었습니다.전체 레이어(서비스, 요청/응답 DTO)에서 일관되게 프로필 이미지 관련 기능이 비활성화되어 일관성을 유지했습니다.
src/main/java/com/wayble/server/user/dto/UserInfoRegisterRequestDto.java (1)
4-4: enum import 추가 승인!
DisabilityType과MobilityAidenum을 사용하도록 변경한 것은 타입 안전성을 높이는 좋은 개선사항입니다.Also applies to: 6-6
src/main/java/com/wayble/server/user/entity/User.java (1)
127-127: setter 메소드 타입 변경 승인enum 리스트를 받도록 setter 메소드가 적절히 업데이트되었습니다.
Also applies to: 129-129
| private List<String> disabilityType; // 장애 유형, (userType == DISABLED만 값 존재) | ||
|
|
||
| private List<String> mobilityAid; // 이동보조수단, (userType == DISABLED만 값 존재) | ||
| private List<DisabilityType> disabilityType; // 장애 유형, (userType == DISABLED만 값 존재) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💡 Verification agent
🧩 Analysis chain
강타입 enum 사용으로 개선됨
List<String>에서 List<DisabilityType>, List<MobilityAid>로 변경하여 타입 안전성이 향상되었습니다. 다만 validation 검증이 필요합니다.
다음 스크립트로 enum 값들이 올바르게 정의되어 있는지 확인해주세요:
Also applies to: 34-34
🏁 Script executed:
#!/bin/bash
# enum 정의 확인
ast-grep --pattern 'enum DisabilityType {
$$$
}'
ast-grep --pattern 'enum MobilityAid {
$$$
}'Length of output: 102
다음 스크립트로 Java 소스 전체에서 enum 정의를 다시 확인해주세요.
(이전 ast-grep 결과가 없었으므로 ripgrep으로 재검증)
🏁 Script executed:
#!/bin/bash
# Java 파일에서 enum 정의 위치와 내용을 확인
rg -n "enum\s+DisabilityType" -C2 --glob="*.java"
rg -n "enum\s+MobilityAid" -C2 --glob="*.java"Length of output: 990
강타입 enum 정의 검증 완료 — Validation 로직 추가 필요
- src/main/java/com/wayble/server/user/entity/DisabilityType.java
• DEVELOPMENTAL, VISUAL - src/main/java/com/wayble/server/user/entity/MobilityAid.java
• GUIDE_DOG, CANE
위 enum 정의가 정상 확인되었습니다.
따라서 DTO(src/main/java/com/wayble/server/user/dto/UserInfoRegisterRequestDto.java, 32·34)에서 List<DisabilityType> · List<MobilityAid> 사용은 안전합니다.
다만 아래 사항을 검증하는 Validation 로직을 추가해주세요:
userType == DISABLED일 때만 값이 전달되는지- null 또는 빈 리스트를 허용할지 여부
- 리스트 요소에 대해 유효한 enum 값인지
🤖 Prompt for AI Agents
In src/main/java/com/wayble/server/user/dto/UserInfoRegisterRequestDto.java
around line 32, add validation logic to ensure that the List<DisabilityType> and
List<MobilityAid> fields are only populated when userType equals DISABLED.
Implement checks to allow or disallow null or empty lists based on requirements,
and validate that each element in these lists corresponds to a valid enum value.
This can be done using custom validation annotations or manual validation in the
DTO or service layer.
| @ElementCollection(fetch = FetchType.LAZY) | ||
| @CollectionTable(name = "user_disability_type", joinColumns = @JoinColumn(name = "user_id")) | ||
| @Enumerated(EnumType.STRING) | ||
| @Column(name = "disability_type") | ||
| private List<String> disabilityType; // 장애 유형 (발달장애,시각장애,지체장애,청각장애) | ||
|
|
||
| private List<DisabilityType> disabilityType = new ArrayList<>(); // 장애 유형 (발달장애,시각장애,지체장애,청각장애) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💡 Verification agent
🧩 Analysis chain
JPA @ElementCollection 매핑으로 개선됨
@Convert 어노테이션에서 @ElementCollection으로 변경하여 JPA 표준을 따르는 더 나은 매핑 방식으로 개선되었습니다. 별도 테이블로 관리되어 정규화도 향상되었습니다.
기존 데이터가 있다면 마이그레이션 스크립트가 필요할 수 있습니다. 다음 스크립트로 관련 마이그레이션 파일을 확인해주세요:
Also applies to: 68-72
🏁 Script executed:
#!/bin/bash
# 마이그레이션 파일 확인
fd -e sql . | xargs grep -l "user_disability_type\|user_mobility_aid" 2>/dev/null || echo "마이그레이션 파일을 찾을 수 없습니다"Length of output: 122
DB 마이그레이션 스크립트 누락 확인 및 불필요한 import 제거 필요
user_disability_type,user_mobility_aid테이블 생성용 SQL 마이그레이션 파일이 없습니다.
→ Liquibase/Flyway XML 혹은 .sql 스크립트, 또는 Java 기반 마이그레이션 코드가 있는지 확인하고 없으면 추가해주세요.src/main/java/com/wayble/server/user/entity/User.java에 남아 있는StringListConverterimport를 제거하세요.@ElementCollection매핑 시 대량 조회 시 N+1 문제나 성능 이슈가 발생할 수 있으므로, 페치 전략(FetchType),@BatchSize설정 등을 검토해주세요.
🤖 Prompt for AI Agents
In src/main/java/com/wayble/server/user/entity/User.java around lines 62 to 66,
first verify if there are Liquibase, Flyway, or Java migration scripts that
create the user_disability_type and user_mobility_aid tables; if missing, add
appropriate migration files to create these tables. Next, remove the unused
import of StringListConverter from the User.java file. Finally, review the
@ElementCollection mapping for disabilityType to address potential N+1 query
issues by adjusting the fetch strategy or adding @BatchSize annotations to
optimize performance during bulk fetches.
✔️ 연관 이슈
📝 작업 내용
스크린샷 (선택)
리뷰요구사항
Summary by CodeRabbit
신규 기능
리팩터링
기타