-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
feat - 앱 관련 유효성 체크
- Loading branch information
Showing
6 changed files
with
116 additions
and
12 deletions.
There are no files selected for viewing
6 changes: 6 additions & 0 deletions
6
src/main/java/sopt/org/HMH/domain/app/domain/AppConstants.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,6 @@ | ||
package sopt.org.HMH.domain.app.domain; | ||
|
||
public abstract class AppConstants { | ||
public static final Long MINIMUM_APP_TIME = 0L; | ||
public static final Long MAXIMUM_APP_TIME = 3659000L; | ||
} |
34 changes: 34 additions & 0 deletions
34
src/main/java/sopt/org/HMH/domain/app/domain/exception/AppError.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,34 @@ | ||
package sopt.org.HMH.domain.app.domain.exception; | ||
|
||
import lombok.AllArgsConstructor; | ||
import org.springframework.http.HttpStatus; | ||
import sopt.org.HMH.global.common.exception.base.ErrorBase; | ||
|
||
@AllArgsConstructor | ||
public enum AppError implements ErrorBase { | ||
|
||
APP_NOT_FOUND(HttpStatus.NOT_FOUND, "앱을 찾을 수 없습니다."), | ||
APP_EXIST_ALREADY(HttpStatus.CONFLICT, "이미 추가된 앱입니다."), | ||
INVALID_APP_CODE_NULL(HttpStatus.BAD_REQUEST, "앱 코드 값이 비어있습니다"), | ||
INVALID_TIME_RANGE(HttpStatus.BAD_REQUEST, "앱 시간의 범위가 유효한지 확인해주세요"), | ||
INVALID_TIME_NULL(HttpStatus.BAD_REQUEST, "앱 시간을 입력해주세요"), | ||
; | ||
|
||
private final HttpStatus status; | ||
private final String errorMessage; | ||
|
||
@Override | ||
public int getHttpStatusCode() { | ||
return status.value(); | ||
} | ||
|
||
@Override | ||
public HttpStatus getHttpStatus() { | ||
return this.status; | ||
} | ||
|
||
@Override | ||
public String getErrorMessage() { | ||
return this.errorMessage; | ||
} | ||
} |
10 changes: 10 additions & 0 deletions
10
src/main/java/sopt/org/HMH/domain/app/domain/exception/AppException.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,10 @@ | ||
package sopt.org.HMH.domain.app.domain.exception; | ||
|
||
import sopt.org.HMH.global.common.exception.base.ExceptionBase; | ||
|
||
public class AppException extends ExceptionBase { | ||
|
||
public AppException(AppError error) { | ||
super(error); | ||
} | ||
} |
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
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