-
Notifications
You must be signed in to change notification settings - Fork 4
[feat] 회원가입 필드 추가 및 커뮤니티 로직/연관관계 개선 #105
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
442ac44
ddb31c8
ee403db
38a2633
af05b8f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -70,10 +70,17 @@ private static String requireUrl(String url) { | |||||||||||
|
|
||||||||||||
| @Transactional | ||||||||||||
| public CommunityDetailResponse readAndIncreaseView(Long id) { | ||||||||||||
| communityRepository.increaseViewCount(id); | ||||||||||||
| if (!communityRepository.existsById(id)) { | ||||||||||||
| throw BaseException.from(ErrorCode.COMMUNITY_NOT_FOUND); | ||||||||||||
| } | ||||||||||||
|
|
||||||||||||
| int updated = communityRepository.increaseViewCount(id); | ||||||||||||
|
||||||||||||
| int updated = communityRepository.increaseViewCount(id); | |
| int updated = communityRepository.increaseViewCount(id); | |
| if (updated == 0) { | |
| throw BaseException.from(ErrorCode.COMMUNITY_NOT_FOUND); | |
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -6,6 +6,7 @@ | |
| import com.arom.with_travel.domain.chat.model.ChatPart; | ||
| import com.arom.with_travel.domain.community.Community; | ||
| import com.arom.with_travel.domain.community_reply.CommunityReply; | ||
| import com.arom.with_travel.domain.community_reply.CommunityReplyLike; | ||
| import com.arom.with_travel.domain.image.Image; | ||
| import com.arom.with_travel.domain.likes.Likes; | ||
| import com.arom.with_travel.domain.shorts.Shorts; | ||
|
|
@@ -38,6 +39,7 @@ | |
| private String oauthId; | ||
|
|
||
| private String email; | ||
| @Column(length = 255) private String password; | ||
|
||
|
|
||
| private LocalDate birth; | ||
| @Enumerated(EnumType.STRING) private Gender gender; | ||
|
|
@@ -105,6 +107,9 @@ | |
| @OneToMany(mappedBy = "member") | ||
| private List<Community> communities = new ArrayList<>(); | ||
|
|
||
| @OneToMany(mappedBy = "member", orphanRemoval = true) | ||
| private List<CommunityReplyLike> replyLikes = new ArrayList<>(); | ||
|
|
||
| @OneToMany(mappedBy = "member") | ||
| private List<CommunityReply> communityReplies = new ArrayList<>(); | ||
|
|
||
|
|
@@ -125,15 +130,16 @@ | |
| private Image image; | ||
|
|
||
| @Builder | ||
| public Member(Long id, String oauthId, String email, String name, LocalDate birth, Gender gender, | ||
| String phone, LoginType loginType, String nickname, String introduction, | ||
| TravelType travelType, Role role) { | ||
| public Member(Long id, String oauthId, String email, String password, String name, | ||
|
Check warning on line 133 in src/main/java/com/arom/with_travel/domain/member/Member.java
|
||
| LocalDate birth, Gender gender, String phone, LoginType loginType, | ||
| String nickname, String introduction, TravelType travelType, Role role) { | ||
| this.id = id; | ||
| this.oauthId = oauthId; | ||
| this.email = email; | ||
| this.password = password; | ||
| this.name = name; | ||
| this.birth = birth; | ||
| this.gender = gender; | ||
| this.name = name; | ||
| this.phone = phone; | ||
| this.loginType = loginType; | ||
| this.nickname = nickname; | ||
|
|
@@ -179,4 +185,23 @@ | |
| public void setSurvey(Survey survey) { | ||
| this.survey = survey; | ||
| } | ||
|
|
||
| public void addCommunity(Community community) { | ||
| if (community == null) return; | ||
| community.changeMember(this); | ||
| } | ||
|
|
||
| public void addReply(CommunityReply reply) { | ||
| this.communityReplies.add(reply); | ||
| if (reply.getMember() != this) { | ||
| reply.setMember(this); | ||
| } | ||
| } | ||
|
|
||
| public void addReplyLike(CommunityReplyLike like) { | ||
| this.replyLikes.add(like); | ||
| if (like.getMember() != this) { | ||
| like.setMember(this); | ||
| } | ||
| } | ||
| } | ||
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -3,9 +3,7 @@ | |||||
| import com.arom.with_travel.domain.member.Member.Gender; | ||||||
| import com.fasterxml.jackson.annotation.JsonFormat; | ||||||
| import io.swagger.v3.oas.annotations.media.Schema; | ||||||
| import jakarta.validation.constraints.NotBlank; | ||||||
| import jakarta.validation.constraints.NotEmpty; | ||||||
| import jakarta.validation.constraints.NotNull; | ||||||
| import jakarta.validation.constraints.*; | ||||||
| import lombok.Getter; | ||||||
| import lombok.Setter; | ||||||
|
|
||||||
|
|
@@ -32,4 +30,23 @@ public class MemberSignupRequestDto { | |||||
| @NotEmpty(message = "자기소개란을 작성해주세요") | ||||||
| @Schema(description = "짧은 자기소개", example = "안녕하세요") | ||||||
| private String introduction; | ||||||
|
|
||||||
| @NotBlank(message = "이메일을 입력해주세요.") | ||||||
| @Email(message = "올바른 이메일 형식이 아닙니다.") | ||||||
| @Schema(description = "로그인용 이메일", example = "pikachu@example.com") | ||||||
| private String email; | ||||||
|
|
||||||
| @NotBlank(message = "비밀번호를 입력해주세요.") | ||||||
| @Size(min = 8, max = 64, message = "비밀번호는 8~64자여야 합니다.") | ||||||
| @Schema(description = "로그인 비밀번호(서버에서 해시 저장)", example = "pika1234!") | ||||||
| private String password; | ||||||
|
|
||||||
| @NotBlank(message = "이름(실명)을 입력해주세요.") | ||||||
| @Schema(description = "이름(실명)", example = "한지우") | ||||||
| private String name; | ||||||
|
|
||||||
| @NotBlank(message = "전화번호를 입력해주세요.") | ||||||
| @Pattern(regexp = "^[0-9\\-]{8,15}$", message = "전화번호 형식이 올바르지 않습니다.") | ||||||
|
||||||
| @Pattern(regexp = "^[0-9\\-]{8,15}$", message = "전화번호 형식이 올바르지 않습니다.") | |
| @Pattern(regexp = "^\\+?[0-9\\-\\s\\(\\)]{8,20}$", message = "전화번호 형식이 올바르지 않습니다.") |
There was a problem hiding this comment.
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.