Skip to content

Commit

Permalink
Merge pull request #197 from themoment-team/develop
Browse files Browse the repository at this point in the history
v20241011.0
  • Loading branch information
tlsgmltjd authored Oct 10, 2024
2 parents 0132df2 + a52e1d4 commit 55044b7
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 14 deletions.
Original file line number Diff line number Diff line change
@@ -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
) {
}
Original file line number Diff line number Diff line change
@@ -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
) {
}
Original file line number Diff line number Diff line change
@@ -1,15 +1,13 @@
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;
import team.themoment.hellogsmv3.domain.oneseo.dto.request.AptitudeEvaluationScoreReqDto;
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;

Expand All @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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) && (
Expand Down

0 comments on commit 55044b7

Please sign in to comment.