[refactor] 유저 엔티티 (장애유형,이동보조수단) 복수 선택 가능을 위한 리팩토링 진행 #86
Conversation
[chore] 유저 인증 관련 로직을 Auth 폴더로 분리
Walkthrough
Changes
Sequence Diagram(s)sequenceDiagram
participant DTO as UserInfoRegister/UpdateRequestDto
participant Controller
participant Entity as User Entity
participant Converter as StringListConverter
participant DB
DTO->>Controller: disabilityType, mobilityAid as List<String>
Controller->>Entity: setDisabilityType(List<String>), setMobilityAid(List<String>)
Entity->>Converter: convertToDatabaseColumn(List<String>)
Converter->>DB: JSON String 저장
DB->>Converter: JSON String 로드
Converter->>Entity: convertToEntityAttribute(String) → List<String>
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~15 minutes Assessment against linked issues
Assessment against linked issues: Out-of-scope changes
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)
✨ 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.
Actionable comments posted: 0
🧹 Nitpick comments (2)
src/main/java/com/wayble/server/common/converter/StringListConverter.java (2)
13-13: ObjectMapper를 static으로 선언하여 성능 최적화ObjectMapper는 스레드 안전하고 생성 비용이 높으므로 static 필드로 선언하는 것이 더 효율적입니다.
- private final ObjectMapper objectMapper = newObjectMapper(); + private static final ObjectMapper objectMapper = new ObjectMapper();
16-32: 예외 처리 시 로깅 추가 고려현재 모든 예외를 무시하고 기본값을 반환하고 있어 직렬화/역직렬화 오류를 디버깅하기 어려울 수 있습니다. 로깅을 추가하여 문제 상황을 추적할 수 있도록 개선을 고려해보세요.
+import lombok.extern.slf4j.Slf4j; + +@Slf4j @Converter public class StringListConverter implements AttributeConverter<List<String>, String> {public String convertToDatabaseColumn(List<String> list) { try { return list == null ? "[]" : objectMapper.writeValueAsString(list); } catch (Exception e) { + log.warn("Failed to convert list to JSON string: {}", list, e); return "[]"; } }public List<String> convertToEntityAttribute(String json) { try { if (json == null || json.isBlank()) return Collections.emptyList(); return objectMapper.readValue(json, new TypeReference<List<String>>() {}); } catch (Exception e) { + log.warn("Failed to convert JSON string to list: {}", json, e); return Collections.emptyList(); } }
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (5)
src/main/java/com/wayble/server/common/converter/StringListConverter.java(1 hunks)src/main/java/com/wayble/server/user/controller/UserController.java(0 hunks)src/main/java/com/wayble/server/user/dto/UserInfoRegisterRequestDto.java(2 hunks)src/main/java/com/wayble/server/user/dto/UserInfoUpdateRequestDto.java(1 hunks)src/main/java/com/wayble/server/user/entity/User.java(3 hunks)
💤 Files with no reviewable changes (1)
- src/main/java/com/wayble/server/user/controller/UserController.java
🧰 Additional context used
🧠 Learnings (1)
src/main/java/com/wayble/server/user/entity/User.java (1)
Learnt from: seung-in-Yoo
PR: #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 없이 사용 가능하다.
🔇 Additional comments (8)
src/main/java/com/wayble/server/common/converter/StringListConverter.java (1)
11-33: 구현이 올바르게 되어있습니다JPA AttributeConverter 인터페이스를 올바르게 구현했고, List과 JSON 문자열 간의 변환을 적절히 처리합니다. null 입력 처리와 안전한 기본값 반환도 잘 구현되어 있습니다.
src/main/java/com/wayble/server/user/dto/UserInfoRegisterRequestDto.java (2)
11-11: 올바른 import 추가List 타입 사용을 위한 import가 적절히 추가되었습니다.
28-29: 다중 선택을 위한 필드 타입 변경이 적절합니다
disabilityType과mobilityAid필드를String에서List<String>으로 변경하여 여러 값을 선택할 수 있도록 개선되었습니다. 필드 주석도 명확하게 작성되어 있습니다.src/main/java/com/wayble/server/user/dto/UserInfoUpdateRequestDto.java (2)
7-7: 일관된 import 추가register DTO와 동일하게 List 타입 사용을 위한 import가 추가되었습니다.
15-16: 일관된 필드 타입 변경register DTO와 동일하게
disabilityType과mobilityAid필드가List<String>타입으로 변경되어 일관성이 유지되고 있습니다. 업데이트 DTO의 nullable 특성도 적절히 유지되었습니다.src/main/java/com/wayble/server/user/entity/User.java (3)
3-3: 컨버터 사용을 위한 import 추가StringListConverter 사용을 위한 import가 적절히 추가되었습니다.
62-69: 엔티티 필드의 다중 선택 지원 구현이 올바릅니다
@Convert(converter = StringListConverter.class)어노테이션을 통해List<String>타입 필드의 데이터베이스 저장/조회가 올바르게 구현되었습니다. JSON 직렬화/역직렬화가 자동으로 처리됩니다.
124-126: setter 메서드가 새로운 필드 타입에 맞게 업데이트되었습니다
disabilityType과mobilityAidsetter 메서드가List<String>타입을 받도록 올바르게 수정되어 필드 타입과 일관성이 유지되었습니다.
✔️ 연관 이슈
📝 작업 내용
스크린샷 (선택)
유저 정보 등록
유저 정보 수정
💬 리뷰 요청 사항(선택)
Summary by CodeRabbit
신규 기능
버그 수정