Skip to content

Commit

Permalink
[FO-897] 프로필 전체 페이지 검증 API 재작성
Browse files Browse the repository at this point in the history
  • Loading branch information
sinkyoungdeok committed Feb 4, 2024
1 parent 928afc6 commit 128d41b
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import com.fone.profile.presentation.dto.ValidateProfileDto
import com.fone.user.domain.repository.UserRepository
import org.hibernate.validator.internal.constraintvalidators.hv.URLValidator
import org.springframework.stereotype.Service
import java.time.LocalDate

@Service
class ValidateProfileService(
Expand Down Expand Up @@ -32,6 +33,18 @@ class ValidateProfileService(
email: String,
request: ValidateProfileDto.DetailPageValidation,
) {
if (request.birthday != null) {
if (request.birthday.year < 1920) {
throw RequestValidationException("100세 이상의 나이는 입력할 수 없습니다.")
}
}

if (request.birthday != null) {
if (request.birthday.isAfter(LocalDate.now())) {
throw RequestValidationException("미래의 날짜를 입력할 수 없습니다.")
}
}

if (request.gender == null) {
throw RequestValidationException("성별을 선택해 주세요.")
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ class ValidateJobOpeningControllerTest(client: WebTestClient) : CustomDescribeSp
null,
null,
Salary.HOURLY,
null
-2
)
client.doPost("$url/project-details", request, accessToken)
.expectStatus().isOk.expectBody()
Expand All @@ -70,7 +70,7 @@ class ValidateJobOpeningControllerTest(client: WebTestClient) : CustomDescribeSp
null,
null,
Salary.HOURLY,
null
-2
)
client.doPost("$url/project-details", request, accessToken).expectStatus().isBadRequest.expectBody()
.consumeWith { println(it) }.jsonPath("$.result").isEqualTo("FAIL")
Expand Down

0 comments on commit 128d41b

Please sign in to comment.