From 618a680317fac3b304a5541d980e41be62148c38 Mon Sep 17 00:00:00 2001 From: koojun99 Date: Mon, 23 Sep 2024 18:59:03 +0900 Subject: [PATCH] =?UTF-8?q?=E2=9A=A1=EF=B8=8F=20Improve:=20=EC=9C=A0?= =?UTF-8?q?=EC=A0=80=20=ED=9A=8C=EC=9B=90=EA=B0=80=EC=9E=85=20=EC=8B=9C=20?= =?UTF-8?q?=EC=9C=A0=ED=9A=A8=EC=84=B1=20=EA=B2=80=EC=82=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- build.gradle | 2 +- .../api/user/presentation/dto/UserRequestDTO.java | 2 ++ .../treehouse/server/global/entity/User/User.java | 12 ++++++++++++ 3 files changed, 15 insertions(+), 1 deletion(-) diff --git a/build.gradle b/build.gradle index 770e43e..4f04f41 100644 --- a/build.gradle +++ b/build.gradle @@ -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' diff --git a/src/main/java/treehouse/server/api/user/presentation/dto/UserRequestDTO.java b/src/main/java/treehouse/server/api/user/presentation/dto/UserRequestDTO.java index dfde95f..cc3c808 100644 --- a/src/main/java/treehouse/server/api/user/presentation/dto/UserRequestDTO.java +++ b/src/main/java/treehouse/server/api/user/presentation/dto/UserRequestDTO.java @@ -14,7 +14,9 @@ public static class checkName { @Getter public static class registerUser { + @NotBlank(message = "전화번호를 입력해주세요.") private String phoneNumber; + @NotBlank(message = "유저이름(고유)을 입력해주세요.") private String userName; } diff --git a/src/main/java/treehouse/server/global/entity/User/User.java b/src/main/java/treehouse/server/global/entity/User/User.java index 66c8d16..1e9bb7b 100644 --- a/src/main/java/treehouse/server/global/entity/User/User.java +++ b/src/main/java/treehouse/server/global/entity/User/User.java @@ -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; //초대장 생성 횟수 // 탈퇴일자 필요한지 확인하기 @@ -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; // 카운트 초기화 + } } } \ No newline at end of file