-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #235 from MOONSHOT-Team/develop
[Deploy] 운영서버 v1.0.1 배포
- Loading branch information
Showing
11 changed files
with
153 additions
and
95 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
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
18 changes: 18 additions & 0 deletions
18
moonshot-api/src/main/java/org/moonshot/log/service/validator/LogValidator.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,18 @@ | ||
package org.moonshot.log.service.validator; | ||
|
||
import org.moonshot.exception.log.InvalidLogValueException; | ||
import org.moonshot.log.model.LogState; | ||
|
||
public class LogValidator { | ||
|
||
public static void validateLogNum(Long requestNum, Long originNum) { | ||
if (requestNum.equals(originNum)) { | ||
throw new InvalidLogValueException(); | ||
} | ||
} | ||
|
||
public static boolean isCreateLog(LogState state) { | ||
return state == LogState.CREATE; | ||
} | ||
|
||
} |
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
18 changes: 6 additions & 12 deletions
18
moonshot-api/src/main/java/org/moonshot/objective/service/validator/ObjectiveValidator.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,28 +1,22 @@ | ||
package org.moonshot.objective.service.validator; | ||
|
||
import org.moonshot.exception.global.auth.AccessDeniedException; | ||
import org.moonshot.exception.objective.ObjectiveInvalidIndexException; | ||
import org.moonshot.exception.objective.ObjectiveNumberExceededException; | ||
|
||
public class ObjectiveValidator { | ||
|
||
public static void validateUserAuthorization(Long userEntityId, Long userId) { | ||
if (!userEntityId.equals(userId)) { | ||
throw new AccessDeniedException(); | ||
} | ||
} | ||
private static final int ACTIVE_OBJECTIVE_NUMBER = 10; | ||
|
||
public static void validateIndexWithInRange(final Long objectiveCount, final int idx) { | ||
if ((objectiveCount <= idx) || (idx < 0)) { | ||
throw new ObjectiveInvalidIndexException(); | ||
} | ||
} | ||
|
||
public static boolean isSameIndex(final int prevIdx, final int idx) { | ||
return prevIdx == idx; | ||
} | ||
|
||
public static boolean isIndexIncreased(final int prevIdx, final int idx) { | ||
return prevIdx < idx; | ||
public static void validateActiveObjectiveSizeExceeded(final int objListSize) { | ||
if (objListSize >= ACTIVE_OBJECTIVE_NUMBER) { | ||
throw new ObjectiveNumberExceededException(); | ||
} | ||
} | ||
|
||
} |
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
34 changes: 34 additions & 0 deletions
34
moonshot-api/src/main/java/org/moonshot/task/service/validator/TaskValidator.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 org.moonshot.task.service.validator; | ||
|
||
import org.moonshot.exception.task.TaskInvalidIndexException; | ||
import org.moonshot.exception.task.TaskNumberExceededException; | ||
|
||
public class TaskValidator { | ||
|
||
private static final int ACTIVE_TASK_NUMBER = 3; | ||
|
||
public static void validateTaskIndex(final int index, final int requestIndex) { | ||
if (index != requestIndex) { | ||
throw new TaskInvalidIndexException(); | ||
} | ||
} | ||
|
||
public static void validateActiveTaskSizeExceeded(final int taskListSize) { | ||
if (taskListSize >= ACTIVE_TASK_NUMBER) { | ||
throw new TaskNumberExceededException(); | ||
} | ||
} | ||
|
||
public static void validateIndexUnderMaximum(final int requestIndex, final int totalTaskListSize) { | ||
if (requestIndex > totalTaskListSize) { | ||
throw new TaskInvalidIndexException(); | ||
} | ||
} | ||
|
||
public static void validateIndex(final Long taskCount, final Integer requestIndex) { | ||
if (taskCount <= requestIndex || requestIndex < 0) { | ||
throw new TaskInvalidIndexException(); | ||
} | ||
} | ||
|
||
} |
Oops, something went wrong.