[feat] 회원가입 필드 추가 및 커뮤니티 로직/연관관계 개선#105
Conversation
There was a problem hiding this comment.
Pull Request Overview
This PR adds essential fields for transitioning from social login to native authentication and improves community-related domain logic with better data consistency and object-oriented relationship management.
- Adds required signup fields (name, phone, email, password) to support native authentication
- Improves community view count logic with existence validation and data consistency
- Establishes bidirectional mappings with convenience methods for Community, CommunityReply, and Member relationships
Reviewed Changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| MemberSignupRequestDto.java | Adds email, password, name, and phone fields with validation for native signup |
| Member.java | Adds password field and convenience methods for managing bidirectional relationships |
| CommunityReplyLike.java | Adds @Setter annotation to support bidirectional relationship management |
| CommunityReply.java | Adds likes collection and convenience method for managing reply likes |
| CommunityService.java | Improves view count logic with existence validation before increment |
| Community.java | Removes null checks in update method and adds relationship management methods |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
| private String name; | ||
|
|
||
| @NotBlank(message = "전화번호를 입력해주세요.") | ||
| @Pattern(regexp = "^[0-9\\-]{8,15}$", message = "전화번호 형식이 올바르지 않습니다.") |
There was a problem hiding this comment.
The phone number regex pattern ^[0-9\\-]{8,15}$ is too restrictive and may not accommodate international phone number formats. Consider using a more flexible pattern that supports parentheses, spaces, and plus signs for international numbers.
| @Pattern(regexp = "^[0-9\\-]{8,15}$", message = "전화번호 형식이 올바르지 않습니다.") | |
| @Pattern(regexp = "^\\+?[0-9\\-\\s\\(\\)]{8,20}$", message = "전화번호 형식이 올바르지 않습니다.") |
| private String oauthId; | ||
|
|
||
| private String email; | ||
| @Column(length = 255) private String password; |
There was a problem hiding this comment.
Storing passwords as plain text is a security vulnerability. The password field should be annotated to indicate it will store hashed values, and the application should ensure passwords are properly hashed before storage.
| throw BaseException.from(ErrorCode.COMMUNITY_NOT_FOUND); | ||
| } | ||
|
|
||
| int updated = communityRepository.increaseViewCount(id); |
There was a problem hiding this comment.
The updated variable is assigned but never used. Either remove this variable or add validation to ensure the update was successful (e.g., if (updated == 0) throw exception).
| int updated = communityRepository.increaseViewCount(id); | |
| int updated = communityRepository.increaseViewCount(id); | |
| if (updated == 0) { | |
| throw BaseException.from(ErrorCode.COMMUNITY_NOT_FOUND); | |
| } |
| this.title = title; | ||
| this.content = content; | ||
| this.continent = continent; | ||
| this.country = country; | ||
| this.city = city; |
There was a problem hiding this comment.
Removing null checks in the update method could lead to unintended data loss if null values are passed. Consider either restoring the null checks or documenting that all parameters must be non-null, and add validation at the service layer.
이슈
구현 기능
변경 사항
회원가입
커뮤니티 조회수 증가 로직 개선
커뮤니티 게시글 수정
커뮤니티 관련 양방향 매핑
변경 이유
소셜 로그인에서 자체 로그인 전환을 위해 회원가입 시 필수 필드 추가
일관성 있는 데이터 처리
-> 커뮤니티 게시글 존재 검증 로직 추가 및 흐름 명확화
커뮤니티 게시글 수정 시, 요청 DTO에 담긴 값으로 엔티티 필드를 그대로 갱신하도록 일관화
객체 지향적 연관관계 관리