Skip to content

[feat] 유저 정보 등록 API 구현 #72

Merged
seung-in-Yoo merged 7 commits into
developfrom
feature/seungin
Jul 26, 2025
Merged

[feat] 유저 정보 등록 API 구현 #72
seung-in-Yoo merged 7 commits into
developfrom
feature/seungin

Conversation

@seung-in-Yoo

@seung-in-Yoo seung-in-Yoo commented Jul 26, 2025

Copy link
Copy Markdown
Member

#️⃣ 연관된 이슈

#69

📝 작업 내용

  • 유저 정보 등록 API(/api/v1/users/info) 신규 구현했습니다.
  • 정보 등록 시 사용자는 자신에게 맞는 닉네임, 생년월일, 성별, 유저 타입, 장애유형, 이동보조수단 을 입력합니다.
  • 기존 회원가입 시점엔 이메일/비밀번호/로그인타입만 입력하고, 나머지 정보는 등록 API에서 별도로 저장합니다.
  • 와이어프레임에 따라 User 엔티티에 disabilityType(장애 유형), mobilityAid(이동 보조 수단) 컬럼을 추가하였습니다.
  • 기존 회원가입 로직이 이메일,비밀번호로만 가입되게 로직이 바뀌면서 로그인쪽도 필수 기입이던 닉네임 필드를 제거하였습니다.
  • 유저 정보 등록은 최초 1회만 등록 가능하며, 이후에 정보를 수정해야한다면 유저 정보 수정 API를 하나 더 구현해서 수정 할 수 있도록 할 예정입니다.

스크린샷 (선택)

유저 정보 등록 성공

내정보등록성공(1)

유저 정보 등록 실패 (이메일,비밀번호 이외에 닉네임,성별,생년월일,유저타입 등 하나라도 등록이 되어있으면 400 처리)

유저정보등록실패(1)

💬 리뷰 요구사항 (선택)

아직 얘기가 나오진 않았지만 유저 정보 등록 이후에 해당 정보를 수정할 수 있는 유저 정보 수정 API가 필요해서 해당 API를 구현할 계획입니다.

Summary by CodeRabbit

  • 신규 기능
    • 사용자가 상세 정보를 한 번만 등록할 수 있는 신규 등록 엔드포인트가 추가되었습니다.
    • 사용자 정보 등록 시 장애 유형 및 보조기구 정보 입력이 가능해졌습니다. (해당되는 경우)
  • 버그 수정
    • 로그인 시 더 이상 이름(닉네임) 입력이 필요하지 않습니다.
  • 기타
    • 이미 등록된 정보가 있을 경우 관련 오류 메시지가 추가되었습니다.
    • 생년월일 형식 오류에 대한 메시지가 추가되었습니다.

@seung-in-Yoo seung-in-Yoo self-assigned this Jul 26, 2025
@seung-in-Yoo seung-in-Yoo added 💡 feature 기능 구현 및 개발 🛠️ fix 기능 오류 및 코드 개선이 필요한 곳 수정 labels Jul 26, 2025
@coderabbitai

coderabbitai Bot commented Jul 26, 2025

Copy link
Copy Markdown

"""

Walkthrough

사용자 상세 정보를 최초 1회 등록할 수 있는 새로운 POST /info 엔드포인트가 추가되었습니다. 이를 위해 DTO, 서비스, 엔티티 필드, 예외 케이스가 신설 및 확장되었고, 기존 로그인 요청 DTO에서 이름 필드가 제거되었습니다.

Changes

파일/경로 요약 변경 내용 요약
.../user/controller/UserController.java /info 등록용 POST 엔드포인트 및 서비스 의존성 추가
.../user/dto/UserInfoRegisterRequestDto.java 사용자 정보 등록용 DTO 신설, 필드 및 검증 어노테이션 포함
.../user/dto/UserLoginRequestDto.java 로그인 DTO에서 name 필드 제거
.../user/entity/User.java 장애 유형, 보조기구 필드 및 setter 추가, 기존 필드 setter 추가
.../user/exception/UserErrorCase.java USER_INFO_ALREADY_EXISTS, INVALID_BIRTH_DATE 예외 케이스 추가
.../user/service/UserInfoService.java 사용자 정보 등록 서비스 신설, 등록 로직 구현

Sequence Diagram(s)

sequenceDiagram
    participant Client
    participant UserController
    participant UserInfoService
    participant UserRepository
    participant User

    Client->>UserController: POST /info (UserInfoRegisterRequestDto)
    UserController->>UserInfoService: registerUserInfo(userId, dto)
    UserInfoService->>UserRepository: findById(userId)
    UserRepository-->>UserInfoService: User entity 반환
    UserInfoService->>User: 정보 등록/수정 (setter 호출)
    UserInfoService->>UserRepository: save(User)
    UserInfoService-->>UserController: 완료/예외 반환
    UserController-->>Client: 응답 반환
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~15–20 minutes

Suggested reviewers

  • KiSeungMin

Poem

🐇
새로운 정보 한 번만,
토끼도 입력해볼까!
장애와 보조기구,
꼼꼼히 적어두고,
로그인은 더 간단히,
오늘도 hop! hop!
개발의 들판을 달려요!

"""

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 de40911 and de51266.

📒 Files selected for processing (4)
  • src/main/java/com/wayble/server/user/controller/UserController.java (4 hunks)
  • src/main/java/com/wayble/server/user/dto/UserInfoRegisterRequestDto.java (1 hunks)
  • src/main/java/com/wayble/server/user/exception/UserErrorCase.java (1 hunks)
  • src/main/java/com/wayble/server/user/service/UserInfoService.java (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (4)
  • src/main/java/com/wayble/server/user/service/UserInfoService.java
  • src/main/java/com/wayble/server/user/exception/UserErrorCase.java
  • src/main/java/com/wayble/server/user/controller/UserController.java
  • src/main/java/com/wayble/server/user/dto/UserInfoRegisterRequestDto.java
✨ 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 linked an issue Jul 26, 2025 that may be closed by this pull request
4 tasks

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 3

🧹 Nitpick comments (3)
src/main/java/com/wayble/server/user/dto/UserInfoRegisterRequestDto.java (2)

15-16: 생년월일 형식 검증 추가를 고려해보세요.

현재 birthDate는 단순 문자열로 정의되어 있고 주석으로만 형식이 명시되어 있습니다. @Pattern 어노테이션을 사용하여 YYYY-MM-DD 형식을 강제하는 것을 고려해보세요.

 @NotBlank(message = "생년월일은 필수입니다.")
+@Pattern(regexp = "^\\d{4}-\\d{2}-\\d{2}$", message = "생년월일은 YYYY-MM-DD 형식이어야 합니다.")
 private String birthDate; // YYYY-MM-DD

24-25: 장애 정보 조건부 검증 로직 추가를 고려해보세요.

현재 userTypeDISABLED일 때 disabilityTypemobilityAid가 필수인지 선택사항인지 명확하지 않습니다. 비즈니스 요구사항에 따라 커스텀 밸리데이션을 추가하는 것을 고려해보세요.

src/main/java/com/wayble/server/user/entity/User.java (1)

61-62: 장애 관련 필드의 데이터 타입 검토를 고려해보세요.

현재 disabilityTypemobilityAid가 자유 텍스트 String으로 정의되어 있습니다. 주석에 명시된 고정된 값들(발달장애, 시각장애 등)을 고려하면, 데이터 일관성을 위해 enum 타입 사용을 고려해볼 수 있습니다.

// 예시
public enum DisabilityType {
    DEVELOPMENTAL, VISUAL, PHYSICAL, HEARING
}

public enum MobilityAid {
    GUIDE_DOG, CANE, COMPANION, WHEELCHAIR
}

Also applies to: 64-65

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 082715d and de40911.

📒 Files selected for processing (6)
  • src/main/java/com/wayble/server/user/controller/UserController.java (3 hunks)
  • src/main/java/com/wayble/server/user/dto/UserInfoRegisterRequestDto.java (1 hunks)
  • src/main/java/com/wayble/server/user/dto/UserLoginRequestDto.java (0 hunks)
  • src/main/java/com/wayble/server/user/entity/User.java (2 hunks)
  • src/main/java/com/wayble/server/user/exception/UserErrorCase.java (1 hunks)
  • src/main/java/com/wayble/server/user/service/UserInfoService.java (1 hunks)
💤 Files with no reviewable changes (1)
  • src/main/java/com/wayble/server/user/dto/UserLoginRequestDto.java
🔇 Additional comments (6)
src/main/java/com/wayble/server/user/exception/UserErrorCase.java (1)

18-19: 새로운 에러 케이스 추가가 적절합니다.

USER_INFO_ALREADY_EXISTS 에러 케이스가 올바르게 추가되었습니다. HTTP 상태 코드 400과 에러 코드 1009가 적절하고, 메시지도 명확합니다.

src/main/java/com/wayble/server/user/controller/UserController.java (1)

119-137: 새로운 사용자 정보 등록 엔드포인트가 잘 구현되었습니다.

인증 처리, 요청 검증, 서비스 호출이 적절하게 구현되어 있고, Swagger 문서화도 완전합니다. Authentication에서 userId를 안전하게 추출하는 로직도 올바릅니다.

src/main/java/com/wayble/server/user/service/UserInfoService.java (2)

36-43: 장애 정보 설정 로직이 적절합니다.

UserType.DISABLED일 때만 장애 관련 필드를 설정하고, 그렇지 않을 때는 null로 초기화하는 로직이 올바르게 구현되어 있습니다.


26-29: 프로필 중복 등록 검증 로직 검토 필요

User 엔티티(src/main/java/com/wayble/server/user/entity/User.java)에는 아래와 같이 프로필 관련 필드가 존재합니다:

  • nickname
  • birthDate
  • gender
  • userType

현재 UserInfoService.java(26–29행)에서는 nicknamenull 여부로 중복 등록을 판단하고 있는데, 비즈니스 요건상 다음을 검토해 주세요:

  • 닉네임만으로 ‘이미 등록된 정보’ 판단이 충분한지
  • birthDate, gender, userType 등 나머지 프로필 필드도 함께 non-null인지 검증해야 하는지

필요 시 검증 로직을 보완해 주세요.

src/main/java/com/wayble/server/user/entity/User.java (2)

61-65: 새로운 장애 관련 필드들이 적절하게 추가되었습니다.

disabilityTypemobilityAid 필드가 올바른 컬럼 매핑과 명확한 주석과 함께 추가되었습니다. 필드명과 컬럼명 모두 일관성 있게 작성되었습니다.


98-112: 새로운 setter 메서드들이 올바르게 구현되었습니다.

사용자 정보 등록을 위한 모든 필요한 setter 메서드들이 적절하게 추가되었습니다. 메서드명과 매개변수 타입이 일관성 있게 작성되었습니다.

Comment thread src/main/java/com/wayble/server/user/controller/UserController.java Outdated
Comment thread src/main/java/com/wayble/server/user/service/UserInfoService.java Outdated
@seung-in-Yoo
seung-in-Yoo merged commit 9ce7f3a into develop Jul 26, 2025
1 check passed

@KiSeungMin KiSeungMin left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

수고 많으셨습니다!!!

user.setGender(dto.getGender());
user.setUserType(dto.getUserType());

if (dto.getUserType() == UserType.DISABLED) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

dto의 userType은 String이고 UserType.DISABLED는 구조체값인데 둘이 == 비교 연산이 가능한지 궁금합니다..!
둘의 타입을 다르게 할 거라면 UserType.DISABLED.name()로 String 값 구한 뒤, equals() 연산하는게 맞을 것 같아요..!
(제가 잘못 알고 있을 수도 있습니다!)

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

현재 UserInfoRegisterRequestDto의 userType 필드는 UserType에서 enum 타입이라서 == 비교를 써도 되는거 같다고 생각했는데 혹시 제가 잘못 생각한거일까요!? 추가로 궁금해서 찾아봤더니 만약에 프론트에서 "DISABLED" 같은 String 값이 넘어온다면, 컨트롤러에서 UserType userType으로 받으면 Spring이 알아서 변환해준다고 하는데 그렇다면 이 코드를 고쳐야하는지 그대로 둬도 되는지도 궁금합니다!

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

아 제가 잘못봤네요! register dto에서 disabilityType이 String인데, userType이 String으로 저장된 걸로 잘못 봤어요 ㅎㅎ

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

💡 feature 기능 구현 및 개발 🛠️ fix 기능 오류 및 코드 개선이 필요한 곳 수정

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[FEAT] 내 정보 등록 API 추가 구현

2 participants