Skip to content

Commit

Permalink
Merge pull request #135 from Team-Shaka/refactor/133
Browse files Browse the repository at this point in the history
⚡️ Improve: 유저 회원가입 시 유효성 검사
  • Loading branch information
koojun99 authored Sep 23, 2024
2 parents 0be59aa + 618a680 commit fa3e3e3
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 1 deletion.
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; // 카운트 초기화
}
}
}

0 comments on commit fa3e3e3

Please sign in to comment.