Skip to content

Commit

Permalink
[refact] 홈페이지 수정사항 반영 (#159)
Browse files Browse the repository at this point in the history
* [fix] 시간 단위 수정 및 테스트 코드 작성

* [fix] 서류합격 validation 수정

* [fix] Type 변경
  • Loading branch information
suhhyun524 authored Nov 8, 2023
1 parent 3886759 commit e5dcc1c
Show file tree
Hide file tree
Showing 7 changed files with 68 additions and 62 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package ceos.backend.domain.application.validator;

import static ceos.backend.domain.application.domain.Pass.PASS;

import ceos.backend.domain.application.domain.Application;
import ceos.backend.domain.application.domain.ApplicationQuestion;
Expand Down Expand Up @@ -119,7 +120,7 @@ public void validateInterviewTimeExist(String uuid, String email) {
() -> {
throw ApplicantNotFound.EXCEPTION;
});
if (application.getInterviewDatetime() == null) {
if (application.getDocumentPass() == PASS && application.getInterviewDatetime() == null) {
throw NotSetInterviewTime.EXCEPTION;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.NotEmpty;
import jakarta.validation.constraints.NotNull;
import jakarta.validation.constraints.Positive;
import jakarta.validation.constraints.PositiveOrZero;
import java.time.LocalDate;
import lombok.Builder;
import lombok.Getter;
Expand Down Expand Up @@ -56,7 +56,7 @@ public class ApplicantInfoVo {

@Schema(defaultValue = "99999999", description = "지원자 남은 학기 수")
@NotNull(message = "지원자 남은 학기 수를 입력해주세요")
@Positive
@PositiveOrZero
private int semestersLeftNumber;

@Builder
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,17 +33,17 @@ public class Recruitment extends BaseEntity {

@NotNull private String devStudyUrl;

@NotNull private LocalDate startDateDoc;
@NotNull private LocalDateTime startDateDoc;

@NotNull private LocalDate endDateDoc;
@NotNull private LocalDateTime endDateDoc;

@NotNull private LocalDate resultDateDoc;
@NotNull private LocalDateTime resultDateDoc;

@NotNull private LocalDate startDateInterview;
@NotNull private LocalDateTime startDateInterview;

@NotNull private LocalDate endDateInterview;
@NotNull private LocalDateTime endDateInterview;

@NotNull private LocalDate resultDateFinal;
@NotNull private LocalDateTime resultDateFinal;

@NotNull private String openChatUrl;

Expand All @@ -64,12 +64,12 @@ private Recruitment(
String prodStudyUrl,
String designStudyUrl,
String devStudyUrl,
LocalDate startDateDoc,
LocalDate endDateDoc,
LocalDate resultDateDoc,
LocalDate startDateInterview,
LocalDate endDateInterview,
LocalDate resultDateFinal,
LocalDateTime startDateDoc,
LocalDateTime endDateDoc,
LocalDateTime resultDateDoc,
LocalDateTime startDateInterview,
LocalDateTime endDateInterview,
LocalDateTime resultDateFinal,
String openChatUrl,
LocalDate otDate,
LocalDate ideathonDate,
Expand Down Expand Up @@ -123,7 +123,7 @@ public void validateGeneration(int generation) {
}
}

public void validateBetweenStartDateDocAndEndDateDoc(LocalDate now) {
public void validateBetweenStartDateDocAndEndDateDoc(LocalDateTime now) {
if (now.compareTo(this.getStartDateDoc()) < 0) {
throw NotApplicationDuration.EXCEPTION;
}
Expand All @@ -132,7 +132,7 @@ public void validateBetweenStartDateDocAndEndDateDoc(LocalDate now) {
}
}

public void validateFinalResultAbleDuration(LocalDate now) {
public void validateFinalResultAbleDuration(LocalDateTime now) {
if (now.compareTo(this.resultDateFinal.plusDays(5)) >= 0) {
throw NotFinalResultCheckDuration.EXCEPTION;
}
Expand All @@ -141,7 +141,7 @@ public void validateFinalResultAbleDuration(LocalDate now) {
}
}

public void validateBetweenStartDateDocAndResultDateDoc(LocalDate now) {
public void validateBetweenStartDateDocAndResultDateDoc(LocalDateTime now) {
if (now.compareTo(this.startDateDoc) < 0) {
throw NotDocumentPassDuration.EXCEPTION;
}
Expand All @@ -150,7 +150,7 @@ public void validateBetweenStartDateDocAndResultDateDoc(LocalDate now) {
}
}

public void validateBetweenResultDateDocAndResultDateFinal(LocalDate now) {
public void validateBetweenResultDateDocAndResultDateFinal(LocalDateTime now) {
if (now.compareTo(this.resultDateDoc) < 0) {
throw NotFinalPassDuration.EXCEPTION;
}
Expand All @@ -159,13 +159,13 @@ public void validateBetweenResultDateDocAndResultDateFinal(LocalDate now) {
}
}

public void validateBeforeStartDateDoc(LocalDate now) {
public void validateBeforeStartDateDoc(LocalDateTime now) {
if (now.compareTo(this.startDateDoc) >= 0) {
throw AlreadyApplicationDuration.EXCEPTION;
}
}

public void validAmenablePeriod(LocalDate now) {
public void validAmenablePeriod(LocalDateTime now) {
if (now.compareTo(this.startDateDoc) >= 0 && now.compareTo(this.resultDateFinal) <= 0) {
throw NotAllowedToModify.EXCEPTION;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

import ceos.backend.domain.recruitment.domain.Recruitment;
import java.time.LocalDate;
import java.time.LocalDateTime;
import lombok.Builder;
import lombok.Getter;

Expand All @@ -12,12 +13,12 @@ public class RecruitmentDTO {
private String prodStudyUrl;
private String designStudyUrl;
private String devStudyUrl;
private LocalDate startDateDoc;
private LocalDate endDateDoc;
private LocalDate resultDateDoc;
private LocalDate startDateInterview;
private LocalDate endDateInterview;
private LocalDate resultDateFinal;
private LocalDateTime startDateDoc;
private LocalDateTime endDateDoc;
private LocalDateTime resultDateDoc;
private LocalDateTime startDateInterview;
private LocalDateTime endDateInterview;
private LocalDateTime resultDateFinal;
private String openChatUrl;
private LocalDate otDate;
private LocalDate ideathonDate;
Expand All @@ -30,12 +31,12 @@ public RecruitmentDTO(
String prodStudyUrl,
String designStudyUrl,
String devStudyUrl,
LocalDate startDateDoc,
LocalDate endDateDoc,
LocalDate resultDateDoc,
LocalDate startDateInterview,
LocalDate endDateInterview,
LocalDate resultDateFinal,
LocalDateTime startDateDoc,
LocalDateTime endDateDoc,
LocalDateTime resultDateDoc,
LocalDateTime startDateInterview,
LocalDateTime endDateInterview,
LocalDateTime resultDateFinal,
String openChatUrl,
LocalDate otDate,
LocalDate ideathonDate,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

import ceos.backend.domain.recruitment.domain.Recruitment;
import java.time.LocalDate;
import java.time.LocalDateTime;
import lombok.Builder;
import lombok.Getter;

Expand All @@ -12,12 +13,12 @@ public class UserRecruitmentDTO {
private String prodStudyUrl;
private String designStudyUrl;
private String devStudyUrl;
private LocalDate startDateDoc;
private LocalDate endDateDoc;
private LocalDate resultDateDoc;
private LocalDate startDateInterview;
private LocalDate endDateInterview;
private LocalDate resultDateFinal;
private LocalDateTime startDateDoc;
private LocalDateTime endDateDoc;
private LocalDateTime resultDateDoc;
private LocalDateTime startDateInterview;
private LocalDateTime endDateInterview;
private LocalDateTime resultDateFinal;
private LocalDate otDate;
private LocalDate ideathonDate;
private LocalDate hackathonDate;
Expand All @@ -29,12 +30,12 @@ public UserRecruitmentDTO(
String prodStudyUrl,
String designStudyUrl,
String devStudyUrl,
LocalDate startDateDoc,
LocalDate endDateDoc,
LocalDate resultDateDoc,
LocalDate startDateInterview,
LocalDate endDateInterview,
LocalDate resultDateFinal,
LocalDateTime startDateDoc,
LocalDateTime endDateDoc,
LocalDateTime resultDateDoc,
LocalDateTime startDateInterview,
LocalDateTime endDateInterview,
LocalDateTime resultDateFinal,
LocalDate otDate,
LocalDate ideathonDate,
LocalDate hackathonDate,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@


import ceos.backend.domain.recruitment.helper.RecruitmentHelper;
import java.time.LocalDate;
import java.time.LocalDateTime;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Component;

Expand All @@ -14,26 +14,26 @@ public class RecruitmentValidator {
public void validateBetweenStartDateDocAndEndDateDoc() {
recruitmentHelper
.takeRecruitment()
.validateBetweenStartDateDocAndEndDateDoc(LocalDate.now());
.validateBetweenStartDateDocAndEndDateDoc(LocalDateTime.now());
}

public void validateBeforeStartDateDoc() {
recruitmentHelper.takeRecruitment().validateBeforeStartDateDoc(LocalDate.now());
recruitmentHelper.takeRecruitment().validateBeforeStartDateDoc(LocalDateTime.now());
}

public void validateBetweenResultDateDocAndResultDateFinal() {
recruitmentHelper
.takeRecruitment()
.validateBetweenResultDateDocAndResultDateFinal(LocalDate.now());
.validateBetweenResultDateDocAndResultDateFinal(LocalDateTime.now());
}

public void validateFinalResultAbleDuration() {
recruitmentHelper.takeRecruitment().validateFinalResultAbleDuration(LocalDate.now());
recruitmentHelper.takeRecruitment().validateFinalResultAbleDuration(LocalDateTime.now());
}

public void validateBetweenStartDateDocAndResultDateDoc() {
recruitmentHelper
.takeRecruitment()
.validateBetweenStartDateDocAndResultDateDoc(LocalDate.now());
.validateBetweenStartDateDocAndResultDateDoc(LocalDateTime.now());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import ceos.backend.domain.admin.exception.NotAllowedToModify;
import ceos.backend.domain.recruitment.domain.Recruitment;
import ceos.backend.domain.recruitment.helper.RecruitmentHelper;
import java.time.LocalDate;
import java.time.LocalDateTime;
import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
Expand All @@ -23,13 +23,15 @@ void validAmenablePeriod_X() {
Recruitment recruitment = recruitmentHelper.takeRecruitment();

// when
LocalDate startDateDoc = recruitment.getStartDateDoc();
LocalDate date =
LocalDate.of(
LocalDateTime startDateDoc = recruitment.getStartDateDoc();

LocalDateTime date =
LocalDateTime.of(
startDateDoc.getYear(),
startDateDoc.getMonth(),
startDateDoc.getDayOfMonth() + 1);

startDateDoc.getDayOfMonth(),
startDateDoc.getHour(),
startDateDoc.getMinute() + 1);
// then
assertThrows(
NotAllowedToModify.class,
Expand All @@ -46,13 +48,14 @@ void validAmenablePeriod_O() {
Recruitment recruitment = recruitmentHelper.takeRecruitment();

// when
LocalDate startDateDoc = recruitment.getStartDateDoc();
LocalDate date =
LocalDate.of(
LocalDateTime startDateDoc = recruitment.getStartDateDoc();
LocalDateTime date =
LocalDateTime.of(
startDateDoc.getYear(),
startDateDoc.getMonth(),
startDateDoc.getDayOfMonth() - 1);

startDateDoc.getDayOfMonth(),
startDateDoc.getHour(),
startDateDoc.getMinute() - 1);
// then
recruitment.validAmenablePeriod(date);
}
Expand Down

0 comments on commit e5dcc1c

Please sign in to comment.