diff --git a/family/src/main/java/com/oing/domain/Family.java b/family/src/main/java/com/oing/domain/Family.java index f441a954..329e8281 100644 --- a/family/src/main/java/com/oing/domain/Family.java +++ b/family/src/main/java/com/oing/domain/Family.java @@ -19,7 +19,7 @@ public class Family extends BaseEntity { @Column(name = "family_id", columnDefinition = "CHAR(26)", nullable = false) private String id; - @Column(name = "family_name", columnDefinition = "CHAR(10)") + @Column(name = "family_name", columnDefinition = "CHAR(9)") private String familyName; @Column(name = "family_name_editor_id", columnDefinition = "CHAR(26)") @@ -49,14 +49,6 @@ public void subtractNewPostScore() { subtractScore(NEW_POST_SCORE); } - public void addAllFamilyMembersPostsUploadedScore() { - addScore(ALL_FAMILY_MEMBERS_POSTS_UPLOADED_SCORE); - } - - public void subtractAllFamilyMembersPostsUploadedScore() { - subtractScore(ALL_FAMILY_MEMBERS_POSTS_UPLOADED_SCORE); - } - public void addNewCommentScore() { addScore(NEW_COMMENT_SCORE); } @@ -93,19 +85,16 @@ public void resetScore() { this.score = 0; } - public void updateFamilyName(String familyName, String loginFamilyId) { - if (familyName == null) { - this.familyName = null; - this.familyNameEditorId = null; - } else { + public void updateFamilyName(String familyName, String familyNameEditorId) { + if (familyName != null) { validateFamilyName(familyName); - this.familyName = familyName; - this.familyNameEditorId = loginFamilyId; } + this.familyName = familyName; + this.familyNameEditorId = familyNameEditorId; } private void validateFamilyName(String familyName) { - if ((familyName.codePoints().count() > 10) || familyName.isBlank()) { + if ((familyName.codePoints().count() > 9) || familyName.isBlank()) { throw new InvalidParameterException(); } } diff --git a/family/src/main/java/com/oing/dto/request/UpdateFamilyNameRequest.java b/family/src/main/java/com/oing/dto/request/UpdateFamilyNameRequest.java index 2343a880..7b340615 100644 --- a/family/src/main/java/com/oing/dto/request/UpdateFamilyNameRequest.java +++ b/family/src/main/java/com/oing/dto/request/UpdateFamilyNameRequest.java @@ -6,7 +6,7 @@ @Schema(description = "가족 이름 수정 요청") public record UpdateFamilyNameRequest( - @Size(max = 10) + @Size(max = 9) @Schema(description = "가족 이름", example = "오잉") String familyName ) { diff --git a/family/src/test/java/com/oing/service/FamilyServiceTest.java b/family/src/test/java/com/oing/service/FamilyServiceTest.java index e2f81c6f..9b0faa1d 100644 --- a/family/src/test/java/com/oing/service/FamilyServiceTest.java +++ b/family/src/test/java/com/oing/service/FamilyServiceTest.java @@ -51,9 +51,9 @@ public class FamilyServiceTest { } @Test - void 열_자_초과_가족_이름_수정_예외_검증() { + void 아홉_자_초과_가족_이름_수정_예외_검증() { // given - String newName = "wrong-length-name"; + String newName = "wrong-length-nam"; String memberId = "1"; String familyId = "1"; diff --git a/gateway/src/main/resources/V202406261718__alter_family_name_column_type.sql b/gateway/src/main/resources/V202406261718__alter_family_name_column_type.sql new file mode 100644 index 00000000..2bd6fed5 --- /dev/null +++ b/gateway/src/main/resources/V202406261718__alter_family_name_column_type.sql @@ -0,0 +1 @@ +ALTER TABLE `family` MODIFY `family_name` VARCHAR(9);