Skip to content

Conversation

@seung-in-Yoo
Copy link
Member

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

작업내용

현재 구현되어있지 않는 유저 엔티티의 연관관계를 정의하고, 이메일 중복방지 로직을 추가하였습니다.
장애 관련 (매핑 포함) 엔티티 설계를 완료하였습니다.

Summary by CodeRabbit

  • 신규 기능

    • 사용자 등록 시 필요한 정보를 담는 새로운 데이터 구조가 추가되었습니다.
    • 장애 유형 및 사용자-장애 매핑을 위한 엔티티가 도입되었습니다.
    • 사용자 프로필 이미지 URL 필드가 추가되었습니다.
    • 이메일 중복 확인 및 이메일로 사용자 조회 기능이 추가되었습니다.
  • 버그 수정

    • 사용자 이메일이 이제 고유하게 저장됩니다.
    • 비밀번호 필드에 필수 입력 조건이 명확히 적용되었습니다.

@seung-in-Yoo seung-in-Yoo self-assigned this Jul 16, 2025
@seung-in-Yoo seung-in-Yoo added 💡 feature 기능 구현 및 개발 🔧 refactor 코드 리팩토링 labels Jul 16, 2025
@coderabbitai
Copy link

coderabbitai bot commented Jul 16, 2025

Walkthrough

사용자 등록과 관련된 DTO와 엔티티 구조가 전면적으로 개편되었습니다. 불필요한 빈 DTO가 삭제되고, 실제 사용자 등록 요청을 위한 DTO와 장애 정보 관리용 엔티티, 사용자-장애 매핑 엔티티가 추가되었습니다. User 엔티티와 레포지토리에도 필드, 관계, 쿼리 메소드가 확장되었습니다.

Changes

파일/경로 요약 변경 내용 요약
.../user/dto/UserRegisterDto.java 빈 UserRegisterDto 레코드 삭제
.../user/dto/UserRegisterRequestDto.java 사용자 등록 요청 필드를 담은 UserRegisterRequestDto 레코드 신설
.../user/entity/Disability.java
.../user/entity/UserDisabilityMapping.java
장애 정보(Disability) 및 사용자-장애 매핑(UserDisabilityMapping) JPA 엔티티 신설
.../user/entity/User.java 이메일 유니크 제약 추가, 패스워드 not-null, loginType/userType 컬럼명 명시, 프로필 이미지 URL/장애 매핑 필드 추가
.../user/repository/UserRepository.java 이메일로 유저 조회/존재 확인 메소드 추가

Sequence Diagram(s)

sequenceDiagram
    participant Client
    participant Controller
    participant UserRepository
    participant DisabilityRepository

    Client->>Controller: UserRegisterRequestDto 전송
    Controller->>UserRepository: 이메일 중복 확인 (existsByEmail)
    UserRepository-->>Controller: 중복 여부 반환
    alt 중복 아님
        Controller->>UserRepository: User 엔티티 저장
        Controller->>DisabilityRepository: 장애 정보 매핑 저장 (필요 시)
        DisabilityRepository-->>Controller: 저장 완료
    end
    Controller-->>Client: 등록 결과 반환
Loading

Possibly related PRs

  • Wayble-Project/wayble-spring#10: 초기 도메인 클래스 및 빈 DTO(UserRegisterDto 포함) 도입과 관련, 이번 PR의 DTO/엔티티 구조 개편과 직접적으로 연결됨.

Suggested reviewers

  • hyoinYang
  • zyovn

Poem

🐇
새 DTO와 엔티티, 토끼가 깡총깡총
장애 정보도 담고, 필드도 풍성!
중복 이메일은 이제 걱정 마,
레포지토리에서 바로 확인하자.
깔끔해진 구조에 토끼도 웃음 짓네!
🥕

✨ Finishing Touches
  • 📝 Generate Docstrings

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 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 16, 2025 that may be closed by this pull request
8 tasks
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

🧹 Nitpick comments (3)
src/main/java/com/wayble/server/user/entity/Disability.java (1)

22-23: 주석의 표기 수정이 필요합니다.

주석의 장애 유형 예시에서 "발달장애"를 "발달장애"로 표기하는 것이 적절합니다.

-    private String name; // ex: 발달장애,시각장애,지체장애,청각장애
+    private String name; // ex: 발달장애, 시각장애, 지체장애, 청각장애
src/main/java/com/wayble/server/user/entity/User.java (2)

36-38: 비밀번호 암호화 구현이 필요합니다.

TODO 주석으로 표시된 비밀번호 암호화가 보안상 중요합니다.

Spring Security의 BCryptPasswordEncoder를 사용한 비밀번호 암호화 구현을 도와드릴 수 있습니다. 새로운 이슈를 생성하여 이를 추적하시겠습니까?


55-56: 프로필 이미지 URL 검증을 고려해보세요.

profileImageUrl 필드에 URL 형식 검증을 추가하는 것을 권장합니다.

+import jakarta.validation.constraints.Pattern;
+
+@Pattern(regexp = "^https?://.*\\.(jpg|jpeg|png|gif|webp)$", message = "유효한 이미지 URL이 아닙니다")
 @Column(name = "profile_image_url")
 private String profileImageUrl;
📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 460fef8 and 4b58cb1.

📒 Files selected for processing (6)
  • src/main/java/com/wayble/server/user/dto/UserRegisterDto.java (0 hunks)
  • src/main/java/com/wayble/server/user/dto/UserRegisterRequestDto.java (1 hunks)
  • src/main/java/com/wayble/server/user/entity/Disability.java (1 hunks)
  • src/main/java/com/wayble/server/user/entity/User.java (2 hunks)
  • src/main/java/com/wayble/server/user/entity/UserDisabilityMapping.java (1 hunks)
  • src/main/java/com/wayble/server/user/repository/UserRepository.java (1 hunks)
💤 Files with no reviewable changes (1)
  • src/main/java/com/wayble/server/user/dto/UserRegisterDto.java
🧰 Additional context used
🧠 Learnings (4)
src/main/java/com/wayble/server/user/repository/UserRepository.java (1)
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.288Z
Learning: Java에서 같은 패키지 내의 클래스들은 import 구문 없이 서로를 참조할 수 있다. com.wayble.server.user.entity 패키지 내의 클래스들은 명시적인 import 없이 사용 가능하다.
src/main/java/com/wayble/server/user/entity/Disability.java (1)
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.288Z
Learning: Java에서 같은 패키지 내의 클래스들은 import 구문 없이 서로를 참조할 수 있다. com.wayble.server.user.entity 패키지 내의 클래스들은 명시적인 import 없이 사용 가능하다.
src/main/java/com/wayble/server/user/entity/User.java (1)
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.288Z
Learning: Java에서 같은 패키지 내의 클래스들은 import 구문 없이 서로를 참조할 수 있다. com.wayble.server.user.entity 패키지 내의 클래스들은 명시적인 import 없이 사용 가능하다.
src/main/java/com/wayble/server/user/entity/UserDisabilityMapping.java (1)
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.288Z
Learning: Java에서 같은 패키지 내의 클래스들은 import 구문 없이 서로를 참조할 수 있다. com.wayble.server.user.entity 패키지 내의 클래스들은 명시적인 import 없이 사용 가능하다.
🔇 Additional comments (5)
src/main/java/com/wayble/server/user/entity/Disability.java (1)

25-26: 연관관계 설정이 적절합니다.

cascade = CascadeType.ALL과 orphanRemoval = true 설정이 적절하며, 장애 엔티티가 삭제될 때 관련 매핑도 함께 정리됩니다.

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

11-12: 유니크 제약조건 설정이 적절합니다.

사용자와 장애 유형의 조합에 대한 유니크 제약조건으로 중복 매핑을 효과적으로 방지합니다.


20-22: 지연 로딩 설정이 적절합니다.

FetchType.LAZY 사용으로 불필요한 데이터 로딩을 방지하여 성능을 최적화했습니다.

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

33-34: 이메일 유니크 제약조건 추가가 적절합니다.

중복 이메일 방지를 위한 unique = true 설정이 적절하며, UserRepository의 existsByEmail 메소드와 잘 연동됩니다.


61-62: 장애 관련 연관관계 설정이 적절합니다.

UserDisabilityMapping과의 OneToMany 관계 설정이 올바르며, cascade와 orphanRemoval 옵션이 적절합니다.

Comment on lines +9 to +18
public record UserRegisterRequestDto(
String nickname,
String username,
String email,
String password,
LocalDate birthDate,
Gender gender,
LoginType loginType,
UserType userType
) {}
Copy link

@coderabbitai coderabbitai bot Jul 16, 2025

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

입력 검증 어노테이션 추가가 필요합니다.

회원가입 요청 DTO에 Bean Validation 어노테이션을 추가하여 데이터 무결성을 보장해야 합니다.

다음과 같이 검증 어노테이션을 추가하세요:

+import jakarta.validation.constraints.*;
+
 public record UserRegisterRequestDto(
+        @NotBlank(message = "닉네임은 필수입니다")
+        @Size(max = 8, message = "닉네임은 8자 이하여야 합니다")
         String nickname,
+        @NotBlank(message = "사용자명은 필수입니다")
         String username,
+        @NotBlank(message = "이메일은 필수입니다")
+        @Email(message = "유효한 이메일 형식이 아닙니다")
         String email,
+        @NotBlank(message = "비밀번호는 필수입니다")
+        @Size(min = 8, message = "비밀번호는 8자 이상이어야 합니다")
         String password,
+        @NotNull(message = "생년월일은 필수입니다")
+        @Past(message = "생년월일은 과거 날짜여야 합니다")
         LocalDate birthDate,
+        @NotNull(message = "성별은 필수입니다")
         Gender gender,
+        @NotNull(message = "로그인 타입은 필수입니다")
         LoginType loginType,
+        @NotNull(message = "사용자 타입은 필수입니다")
         UserType userType
 ) {}
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
public record UserRegisterRequestDto(
String nickname,
String username,
String email,
String password,
LocalDate birthDate,
Gender gender,
LoginType loginType,
UserType userType
) {}
import jakarta.validation.constraints.*;
public record UserRegisterRequestDto(
@NotBlank(message = "닉네임은 필수입니다")
@Size(max = 8, message = "닉네임은 8자 이하여야 합니다")
String nickname,
@NotBlank(message = "사용자명은 필수입니다")
String username,
@NotBlank(message = "이메일은 필수입니다")
@Email(message = "유효한 이메일 형식이 아닙니다")
String email,
@NotBlank(message = "비밀번호는 필수입니다")
@Size(min = 8, message = "비밀번호는 8자 이상이어야 합니다")
String password,
@NotNull(message = "생년월일은 필수입니다")
@Past(message = "생년월일은 과거 날짜여야 합니다")
LocalDate birthDate,
@NotNull(message = "성별은 필수입니다")
Gender gender,
@NotNull(message = "로그인 타입은 필수입니다")
LoginType loginType,
@NotNull(message = "사용자 타입은 필수입니다")
UserType userType
) {}
🤖 Prompt for AI Agents
In src/main/java/com/wayble/server/user/dto/UserRegisterRequestDto.java around
lines 9 to 18, the UserRegisterRequestDto record lacks Bean Validation
annotations to ensure input data integrity. Add appropriate validation
annotations such as @NotBlank for strings like nickname, username, email, and
password, @Email for the email field, @NotNull for birthDate, gender, loginType,
and userType fields to enforce non-null constraints. This will guarantee that
incoming user registration data meets the required validation rules.

Copy link
Member Author

Choose a reason for hiding this comment

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

이것도 이제 구현하려고 했는데 알려줘서 고마워~

Copy link

Choose a reason for hiding this comment

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

@seung-in-Yoo 도움이 되어서 기쁩니다! 검증 로직을 미리 제안할 수 있어서 다행이네요. 구현하실 때 추가로 궁금한 점이 있으시면 언제든 말씀해 주세요! 🐰

    /|   /|  
   ( :v:  )
    |(_)|
    |   |
   /     \

🧠 Learnings used
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.288Z
Learning: Java에서 같은 패키지 내의 클래스들은 import 구문 없이 서로를 참조할 수 있다. com.wayble.server.user.entity 패키지 내의 클래스들은 명시적인 import 없이 사용 가능하다.

Comment on lines +10 to +12
Optional<User> findByEmail(String email);

boolean existsByEmail(String email);
Copy link

@coderabbitai coderabbitai bot Jul 16, 2025

Choose a reason for hiding this comment

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

💡 Verification agent

🧩 Analysis chain

이메일 관련 메소드 구현이 적절합니다.

Spring Data JPA 메소드 네이밍 컨벤션을 잘 따르고 있으며, Optional을 사용한 안전한 반환값 처리가 좋습니다.

다음 스크립트로 이메일 중복 검사 로직이 실제로 서비스 레이어에서 올바르게 사용되는지 확인해보겠습니다:


🏁 Script executed:

#!/bin/bash
# 이메일 중복 검사 로직 사용처 확인
rg -A 10 "existsByEmail|findByEmail" --type java

Length of output: 412


서비스 계층에서 이메일 중복 검사 로직 미사용 확인

서비스 계층(예: UserService)의 회원 가입/이메일 검증 로직에 existsByEmail(또는 findByEmail) 호출이 없습니다. 해당 로직을 호출하도록 구현을 추가해주세요.

• 대상 위치

  • src/main/java/com/wayble/server/user/service/UserService.java (또는 회원 가입을 처리하는 유사 서비스 클래스)
  • 회원 가입 메소드(register 등) 내에 existsByEmail(email) 호출 및 예외 처리/에러 응답 로직 추가
🤖 Prompt for AI Agents
In src/main/java/com/wayble/server/user/service/UserService.java around the user
registration method (e.g., register), add a call to UserRepository's
existsByEmail(email) to check for duplicate emails before proceeding with
registration. If existsByEmail returns true, throw an appropriate exception or
return an error response to prevent duplicate user creation. This ensures the
service layer properly validates email uniqueness using the repository method.

Copy link
Member Author

Choose a reason for hiding this comment

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

이제 구현할거야

Copy link

Choose a reason for hiding this comment

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

@seung-in-Yoo 네, 좋습니다! 이메일 중복 검사 로직을 서비스 계층에 구현하시면 됩니다. existsByEmail 메소드를 활용해서 회원가입 시 이메일 중복을 방지하는 로직을 추가해주세요. 구현하시면서 궁금한 점이 있으시면 언제든지 말씀해주세요!


🧠 Learnings used
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.288Z
Learning: Java에서 같은 패키지 내의 클래스들은 import 구문 없이 서로를 참조할 수 있다. com.wayble.server.user.entity 패키지 내의 클래스들은 명시적인 import 없이 사용 가능하다.

@seung-in-Yoo seung-in-Yoo merged commit 8d8c7b9 into develop Jul 16, 2025
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

💡 feature 기능 구현 및 개발 🔧 refactor 코드 리팩토링

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[FEAT] JWT 기반 로그인 및 회원가입 구현

2 participants