Skip to content
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

⚡️ Improve: 유저 회원가입 시 유효성 검사 #135

Merged
merged 1 commit into from
Sep 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
plugins {
id 'java'
id 'org.springframework.boot' version '3.1.11'
id 'io.spring.dependency-management' version '1.1.4'
id 'io.spring.dependency-management' version '1.1.6'
}

group = 'treehouse'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@ public static class checkName {

@Getter
public static class registerUser {
@NotBlank(message = "전화번호를 입력해주세요.")
private String phoneNumber;
@NotBlank(message = "유저이름(고유)을 입력해주세요.")
private String userName;
}

Expand Down
12 changes: 12 additions & 0 deletions src/main/java/treehouse/server/global/entity/User/User.java
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@ public class User extends BaseDateTimeEntity {
private Integer activeRate = 0; //활동량
@Builder.Default
private Integer invitationCount = 3; //남아있는 초대장의 개수
@Builder.Default
private Integer invitationCreatedCount = 0; //초대장 생성 횟수


// 탈퇴일자 필요한지 확인하기
Expand Down Expand Up @@ -76,5 +78,15 @@ public boolean updatePushAgree(boolean pushAgree){

public void reduceInvitationCount() {
this.invitationCount--;
this.invitationCreatedCount++; // 초대장 생성 횟수 증가
checkAndIncreaseInvitationCount(); // 3회마다 invitationCount 증가
}

// 초대 횟수가 3번째일 때만 invitationCount 1 증가
private void checkAndIncreaseInvitationCount() {
if (this.invitationCreatedCount == 3) {
this.invitationCount++; // 3번째일 때만 증가
this.invitationCreatedCount = 0; // 카운트 초기화
}
}
}
Loading