diff --git a/src/main/java/team/themoment/hellogsmv3/domain/oneseo/dto/request/AptitudeEvaluationScoreReqDto.java b/src/main/java/team/themoment/hellogsmv3/domain/oneseo/dto/request/AptitudeEvaluationScoreReqDto.java index e70c187b..cdd7ca0d 100644 --- a/src/main/java/team/themoment/hellogsmv3/domain/oneseo/dto/request/AptitudeEvaluationScoreReqDto.java +++ b/src/main/java/team/themoment/hellogsmv3/domain/oneseo/dto/request/AptitudeEvaluationScoreReqDto.java @@ -1,11 +1,15 @@ package team.themoment.hellogsmv3.domain.oneseo.dto.request; +import jakarta.validation.constraints.DecimalMax; +import jakarta.validation.constraints.DecimalMin; import jakarta.validation.constraints.NotNull; import java.math.BigDecimal; public record AptitudeEvaluationScoreReqDto( @NotNull + @DecimalMin(value = "0.0", message = "0점 이상이여야 합니다.") + @DecimalMax(value = "100.0", message = "100점 이하여야 합니다.") BigDecimal aptitudeEvaluationScore ) { } diff --git a/src/main/java/team/themoment/hellogsmv3/domain/oneseo/dto/request/InterviewScoreReqDto.java b/src/main/java/team/themoment/hellogsmv3/domain/oneseo/dto/request/InterviewScoreReqDto.java index 900c8c1c..43a99045 100644 --- a/src/main/java/team/themoment/hellogsmv3/domain/oneseo/dto/request/InterviewScoreReqDto.java +++ b/src/main/java/team/themoment/hellogsmv3/domain/oneseo/dto/request/InterviewScoreReqDto.java @@ -1,11 +1,15 @@ package team.themoment.hellogsmv3.domain.oneseo.dto.request; +import jakarta.validation.constraints.DecimalMax; +import jakarta.validation.constraints.DecimalMin; import jakarta.validation.constraints.NotNull; import java.math.BigDecimal; public record InterviewScoreReqDto( @NotNull + @DecimalMin(value = "0.0", message = "0점 이상이여야 합니다.") + @DecimalMax(value = "100.0", message = "100점 이하여야 합니다.") BigDecimal interviewScore ) { } diff --git a/src/main/java/team/themoment/hellogsmv3/domain/oneseo/service/ModifyAptitudeEvaluationScoreService.java b/src/main/java/team/themoment/hellogsmv3/domain/oneseo/service/ModifyAptitudeEvaluationScoreService.java index dbc09239..4d88582b 100644 --- a/src/main/java/team/themoment/hellogsmv3/domain/oneseo/service/ModifyAptitudeEvaluationScoreService.java +++ b/src/main/java/team/themoment/hellogsmv3/domain/oneseo/service/ModifyAptitudeEvaluationScoreService.java @@ -1,7 +1,6 @@ package team.themoment.hellogsmv3.domain.oneseo.service; import lombok.RequiredArgsConstructor; -import org.springframework.http.HttpStatus; import org.springframework.stereotype.Service; import team.themoment.hellogsmv3.domain.member.entity.Member; import team.themoment.hellogsmv3.domain.member.service.MemberService; @@ -9,7 +8,6 @@ import team.themoment.hellogsmv3.domain.oneseo.entity.EntranceTestResult; import team.themoment.hellogsmv3.domain.oneseo.entity.Oneseo; import team.themoment.hellogsmv3.domain.oneseo.repository.EntranceTestResultRepository; -import team.themoment.hellogsmv3.global.exception.error.ExpectedException; import java.math.BigDecimal; @@ -29,8 +27,6 @@ public void execute(Long memberId, AptitudeEvaluationScoreReqDto aptitudeEvaluat OneseoService.isBeforeSecondTest(entranceTestResult.getSecondTestPassYn()); BigDecimal aptitudeEvaluationScore = aptitudeEvaluationScoreReqDto.aptitudeEvaluationScore(); - OneseoService.validateEvaluationScore(aptitudeEvaluationScore); - entranceTestResult.modifyAptitudeEvaluationScore(aptitudeEvaluationScore); entranceTestResultRepository.save(entranceTestResult); diff --git a/src/main/java/team/themoment/hellogsmv3/domain/oneseo/service/ModifyInterviewScoreService.java b/src/main/java/team/themoment/hellogsmv3/domain/oneseo/service/ModifyInterviewScoreService.java index 1a443a51..1f1c01df 100644 --- a/src/main/java/team/themoment/hellogsmv3/domain/oneseo/service/ModifyInterviewScoreService.java +++ b/src/main/java/team/themoment/hellogsmv3/domain/oneseo/service/ModifyInterviewScoreService.java @@ -29,9 +29,8 @@ public void execute(Long memberId, InterviewScoreReqDto reqDto) { OneseoService.isBeforeSecondTest(entranceTestResult.getSecondTestPassYn()); BigDecimal interviewScore = reqDto.interviewScore(); - OneseoService.validateEvaluationScore(interviewScore); - entranceTestResult.modifyInterviewScore(interviewScore); + entranceTestResultRepository.save(entranceTestResult); } diff --git a/src/main/java/team/themoment/hellogsmv3/domain/oneseo/service/OneseoService.java b/src/main/java/team/themoment/hellogsmv3/domain/oneseo/service/OneseoService.java index 569d262c..10c30311 100644 --- a/src/main/java/team/themoment/hellogsmv3/domain/oneseo/service/OneseoService.java +++ b/src/main/java/team/themoment/hellogsmv3/domain/oneseo/service/OneseoService.java @@ -63,14 +63,6 @@ public static void isBeforeSecondTest(YesNo yn) { } } - public static void validateEvaluationScore(BigDecimal aptitudeEvaluationScore) { - BigDecimal minValue = BigDecimal.ZERO; - BigDecimal maxValue = new BigDecimal(100); - if (aptitudeEvaluationScore.compareTo(minValue) < 0 || aptitudeEvaluationScore.compareTo(maxValue) > 0) { - throw new ExpectedException("0부터 100사이의 값만 할당할 수 있습니다.", HttpStatus.BAD_REQUEST); - } - } - public static void isValidMiddleSchoolInfo(OneseoReqDto reqDto) { if ( reqDto.graduationType().equals(CANDIDATE) && (