Skip to content

[feat] 회원가입 필드 추가 및 커뮤니티 로직/연관관계 개선#105

Merged
iamseojin merged 5 commits intowith-travel:developfrom
iamseojin:refactor/issue-#102
Aug 29, 2025
Merged

[feat] 회원가입 필드 추가 및 커뮤니티 로직/연관관계 개선#105
iamseojin merged 5 commits intowith-travel:developfrom
iamseojin:refactor/issue-#102

Conversation

@iamseojin
Copy link
Copy Markdown
Contributor

이슈

구현 기능

변경 사항

회원가입

  • MemberSignupRequestDto: 이름(name), 전화번호(phone), 이메일(email), 비밀번호(password) 필드 추가
  • Member 엔티티: password 필드 추가 및 Builder 생성자 보강

커뮤니티 조회수 증가 로직 개선

  • 조회수 증가 시 커뮤니티 게시글 존재 검증을 선행하고, 최신 viewCount가 반영되도록 로직 수정

커뮤니티 게시글 수정

  • Community.update() 메서드에서 null 체크 제거 → 수정 하도록 전달된 값으로 전체 필드 일괄 갱신

커뮤니티 관련 양방향 매핑

  • Community ↔ Member, Community ↔ CommunityReply, CommunityReply ↔ CommunityReplyLike 간 양방향 매핑 및 편의 메서드 추가

변경 이유

소셜 로그인에서 자체 로그인 전환을 위해 회원가입 시 필수 필드 추가

  • 이름, 전화번호, 이메일, 비밀번호 필드 추가

일관성 있는 데이터 처리

  • 조회수 증가 시 존재하지 않는 엔티티에 update가 발생하는 문제 예방
    -> 커뮤니티 게시글 존재 검증 로직 추가 및 흐름 명확화

커뮤니티 게시글 수정 시, 요청 DTO에 담긴 값으로 엔티티 필드를 그대로 갱신하도록 일관화

  • update 메서드의 불필요한 null 체크를 제거하고, API 호출 시 전달된 DTO 값으로 전체 필드를 명확히 덮어쓰도록 변경

객체 지향적 연관관계 관리

  • 양방향 매핑 및 편의 메서드 추가로 양쪽 관계 동기화 보장

@iamseojin iamseojin requested a review from Copilot August 27, 2025 07:49
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

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 = "전화번호 형식이 올바르지 않습니다.")
Copy link

Copilot AI Aug 27, 2025

Choose a reason for hiding this comment

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

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.

Suggested change
@Pattern(regexp = "^[0-9\\-]{8,15}$", message = "전화번호 형식이 올바르지 않습니다.")
@Pattern(regexp = "^\\+?[0-9\\-\\s\\(\\)]{8,20}$", message = "전화번호 형식이 올바르지 않습니다.")

Copilot uses AI. Check for mistakes.
private String oauthId;

private String email;
@Column(length = 255) private String password;
Copy link

Copilot AI Aug 27, 2025

Choose a reason for hiding this comment

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

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.

Copilot uses AI. Check for mistakes.
throw BaseException.from(ErrorCode.COMMUNITY_NOT_FOUND);
}

int updated = communityRepository.increaseViewCount(id);
Copy link

Copilot AI Aug 27, 2025

Choose a reason for hiding this comment

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

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

Suggested change
int updated = communityRepository.increaseViewCount(id);
int updated = communityRepository.increaseViewCount(id);
if (updated == 0) {
throw BaseException.from(ErrorCode.COMMUNITY_NOT_FOUND);
}

Copilot uses AI. Check for mistakes.
Comment on lines +84 to +88
this.title = title;
this.content = content;
this.continent = continent;
this.country = country;
this.city = city;
Copy link

Copilot AI Aug 27, 2025

Choose a reason for hiding this comment

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

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.

Copilot uses AI. Check for mistakes.
@iamseojin iamseojin merged commit 075ce98 into with-travel:develop Aug 29, 2025
5 of 6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants