This repository has been archived by the owner on Jul 29, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* fix: 카테고리 이름 중복 문제 해결 * fix: '기본' 카테고리 이름 삭제 버그 수정 -> isDefault 필드 추가 '기본'이라는 이름의 카테고리를 기본으로 정의하여 '기본' 이름의 카테고리가 삭제되지 않았었다. 그래서 '기본'이라는 이름을 기본이라고 하지 않고, 기본인 필드값이 있을 경우 기본이라고 판단하는게 나아보여서 추가했다. * fix: 카테고리 이름과 관련된 서비스 예외 처리 추가 카테고리 이름의 경우 대부분 유저에게 넘어오는 값이기 때문에 서비스 계층에서 예외를 검증해주었다. * refactor: Basic 카테고리 이름 통일 * refactor: isBasic 필드 제거 및 리뷰 반영
- Loading branch information
Showing
10 changed files
with
209 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 2 additions & 2 deletions
4
...end/src/main/java/org/donggle/backend/application/service/request/CategoryAddRequest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,9 @@ | ||
package org.donggle.backend.application.service.request; | ||
|
||
import jakarta.validation.constraints.NotNull; | ||
import jakarta.validation.constraints.NotBlank; | ||
|
||
public record CategoryAddRequest( | ||
@NotNull(message = "카테고리 이름을 입력해주세요.") | ||
@NotBlank(message = "카테고리 이름을 입력해주세요.") | ||
String categoryName | ||
) { | ||
} |
4 changes: 3 additions & 1 deletion
4
.../src/main/java/org/donggle/backend/application/service/request/CategoryModifyRequest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,6 @@ | ||
package org.donggle.backend.application.service.request; | ||
|
||
public record CategoryModifyRequest(String categoryName, Long nextCategoryId) { | ||
public record CategoryModifyRequest( | ||
String categoryName, | ||
Long nextCategoryId) { | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
28 changes: 28 additions & 0 deletions
28
.../src/main/java/org/donggle/backend/exception/business/DuplicateCategoryNameException.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
package org.donggle.backend.exception.business; | ||
|
||
import org.springframework.http.HttpStatus; | ||
|
||
public class DuplicateCategoryNameException extends BusinessException { | ||
private static final String MESSAGE = "이미 존재하는 카테고리 이름입니다."; | ||
private final String categoryName; | ||
|
||
public DuplicateCategoryNameException(final String categoryName) { | ||
super(MESSAGE); | ||
this.categoryName = categoryName; | ||
} | ||
|
||
public DuplicateCategoryNameException(final String categoryName, final Throwable cause) { | ||
super(MESSAGE, cause); | ||
this.categoryName = categoryName; | ||
} | ||
|
||
@Override | ||
public String getHint() { | ||
return "이미 존재하는 카테고리 이름입니다. 입력한 이름: " + categoryName; | ||
} | ||
|
||
@Override | ||
public int getErrorCode() { | ||
return HttpStatus.BAD_REQUEST.value(); | ||
} | ||
} |
25 changes: 25 additions & 0 deletions
25
backend/src/main/java/org/donggle/backend/exception/business/EmptyCategoryNameException.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
package org.donggle.backend.exception.business; | ||
|
||
import org.springframework.http.HttpStatus; | ||
|
||
public class EmptyCategoryNameException extends BusinessException { | ||
private static final String MESSAGE = "카테고리 이름은 빈 값이 될 수 없습니다."; | ||
|
||
public EmptyCategoryNameException() { | ||
super(MESSAGE); | ||
} | ||
|
||
public EmptyCategoryNameException(final Throwable cause) { | ||
super(MESSAGE, cause); | ||
} | ||
|
||
@Override | ||
public String getHint() { | ||
return "카테고리 이름은 빈 값이 될 수 없습니다."; | ||
} | ||
|
||
@Override | ||
public int getErrorCode() { | ||
return HttpStatus.BAD_REQUEST.value(); | ||
} | ||
} |
25 changes: 25 additions & 0 deletions
25
...src/main/java/org/donggle/backend/exception/business/OverLengthCategoryNameException.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
package org.donggle.backend.exception.business; | ||
|
||
import org.springframework.http.HttpStatus; | ||
|
||
public class OverLengthCategoryNameException extends BusinessException { | ||
private static final String MESSAGE = "카테고리 이름은 30자를 넘을 수 없습니다."; | ||
|
||
public OverLengthCategoryNameException() { | ||
super(MESSAGE); | ||
} | ||
|
||
public OverLengthCategoryNameException(final Throwable cause) { | ||
super(MESSAGE, cause); | ||
} | ||
|
||
@Override | ||
public String getHint() { | ||
return "카테고리 이름은 30자를 넘을 수 없습니다."; | ||
} | ||
|
||
@Override | ||
public int getErrorCode() { | ||
return HttpStatus.BAD_REQUEST.value(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters