Skip to content

Conversation

@seung-in-Yoo
Copy link
Member

@seung-in-Yoo seung-in-Yoo commented Aug 1, 2025

✔️ 연관 이슈

📝 작업 내용

  • 유저 엔티티에 있는 장애유형(disabilityType), 이동보조수단(mobilityAid)을 String 타입으로 받던걸 enum으로 변경하고 관련 로직들을 수정했습니다. (현재 해당 필드들은 유형이 딱 정해져있기때문에 그냥 String보다 enum이 적합하다고 생각하였습니다.)
  • 프론트분과 의논결과, 이미지 관련 로직은 후순위라고 하셔서 일단 로직에서 주석처리 하였습니다.
  • 장애유형, 이동보조수단은 복수선택이 가능하도록 리스트로 만들고, 해당 필드들은 등록한 유저와 매핑하여 매핑테이블에 저장됩니다.

스크린샷 (선택)

리뷰요구사항

프론트분이 오늘 작업하고 있는 부분이라 바로 main으로 넘기겠습니다.

Summary by CodeRabbit

  • 신규 기능

    • 다양한 장애 유형과 이동 보조 수단을 선택할 수 있도록 장애 유형(DisabilityType) 및 이동 보조 수단(MobilityAid) 항목이 추가되었습니다.
  • 리팩터링

    • 사용자 정보 내 장애 유형과 이동 보조 수단 필드가 문자열 리스트에서 명확한 분류(enum) 타입 리스트로 변경되어, 선택 항목이 더욱 명확하게 표시됩니다.
  • 기타

    • 프로필 이미지 관련 기능이 추후 제공을 위해 비활성화되었습니다.

@seung-in-Yoo seung-in-Yoo self-assigned this Aug 1, 2025
@coderabbitai
Copy link

coderabbitai bot commented Aug 1, 2025

Walkthrough

disabilityTypemobilityAid 필드가 기존의 List<String>에서 각각 List<DisabilityType>, List<MobilityAid>로 변경되었습니다. 이를 위해 두 enum이 새로 추가되었고, 엔티티와 DTO, 서비스 코드가 이에 맞게 수정되었습니다. 일부 프로필 이미지 관련 코드는 주석 처리되었습니다.

Changes

Cohort / File(s) Change Summary
DTO 필드 타입 변경
src/main/java/com/wayble/server/user/dto/UserInfoRegisterRequestDto.java, src/main/java/com/wayble/server/user/dto/UserInfoResponseDto.java, src/main/java/com/wayble/server/user/dto/UserInfoUpdateRequestDto.java
disabilityTypemobilityAid 필드 타입을 List<String>에서 각각 List<DisabilityType>, List<MobilityAid>로 변경. 관련 import 추가 및 프로필 이미지 관련 주석 처리.
User 엔티티 Enum 컬렉션화
src/main/java/com/wayble/server/user/entity/User.java
disabilityType, mobilityAid 필드를 enum 리스트(List<DisabilityType>, List<MobilityAid>)로 변경. JPA의 @ElementCollection@Enumerated(EnumType.STRING) 활용해 별도 테이블 매핑. 관련 setter 메서드 시그니처 수정.
Enum 신규 추가
src/main/java/com/wayble/server/user/entity/DisabilityType.java, src/main/java/com/wayble/server/user/entity/MobilityAid.java
장애 유형(DisabilityType), 이동 보조기구(MobilityAid)에 대한 enum 클래스 신규 생성.
서비스 내 프로필 이미지 코드 주석 처리
src/main/java/com/wayble/server/user/service/UserInfoService.java
프로필 이미지 관련 등록, 수정, 응답 코드 전체 주석 처리. 기능적 변화 없음.

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: 응답 반환
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~15 minutes

Possibly related PRs

Suggested reviewers

  • KiSeungMin

Poem

🐰
필드가 문자열에서 enum으로,
장애와 보조기구, 타입이 또렷해졌네.
테이블도 분리되어 깔끔하게,
프로필 이미지는 잠시 쉼표.
코드 속 토끼도 깡충,
더 튼튼한 데이터로 한 걸음!
🦽✨

Note

⚡️ Unit Test Generation is now available in beta!

Learn more here, or try it out under "Finishing Touches" below.


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 95ef08d and c8cd113.

📒 Files selected for processing (1)
  • src/main/java/com/wayble/server/user/entity/User.java (2 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/main/java/com/wayble/server/user/entity/User.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
✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feature/seungin

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.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need 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)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai generate unit tests to generate unit tests for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@seung-in-Yoo seung-in-Yoo added 🔧 refactor 코드 리팩토링 🛠️ fix 기능 오류 및 코드 개선이 필요한 곳 수정 labels Aug 1, 2025
Copy link

@coderabbitai coderabbitai bot left a 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

📥 Commits

Reviewing files that changed from the base of the PR and between e8c10f4 and 95ef08d.

📒 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.java
  • src/main/java/com/wayble/server/user/entity/User.java
  • src/main/java/com/wayble/server/user/entity/DisabilityType.java
  • src/main/java/com/wayble/server/user/dto/UserInfoRegisterRequestDto.java
  • src/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 추가 승인!

DisabilityTypeMobilityAid enum을 사용하도록 변경한 것은 타입 안전성을 높이는 좋은 개선사항입니다.

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만 값 존재)
Copy link

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.

Comment on lines +62 to +66
@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<>(); // 장애 유형 (발달장애,시각장애,지체장애,청각장애)
Copy link

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에 남아 있는 StringListConverter import를 제거하세요.
  • @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.

@seung-in-Yoo seung-in-Yoo merged commit 16db652 into main Aug 1, 2025
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

🛠️ fix 기능 오류 및 코드 개선이 필요한 곳 수정 🔧 refactor 코드 리팩토링

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[FEAT] iOS 연동: 인증, 유저, 웨이블존 (목록,리뷰,장소) 관련 프론트 API 통신

2 participants