Skip to content

Commit

Permalink
feat: 과제 마감날짜 유효성 검사 로직 수정 (#759)
Browse files Browse the repository at this point in the history
* feat: 기존 커리큘럼의 시작날짜로 검증하는 것으로 변경

* feat: 불필요한 수정 삭제

* feat: 검증 조건 추가

* feat: 코드 중복도 낮추기
  • Loading branch information
AlmondBreez3 authored Sep 4, 2024
1 parent f7262d7 commit d304af7
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public void validateCancelStudyAssignment(Member member, StudyDetail studyDetail
public void validatePublishStudyAssignment(
Member member, StudyDetail studyDetail, AssignmentCreateUpdateRequest request) {
validateStudyMentorAuthorization(member, studyDetail);
validateDeadLine(request.deadLine());
validateDeadLine(request.deadLine(), studyDetail.getPeriod().getStartDate());
}

// 해당 스터디의 멘토가 아니라면 스터디에 대한 권한이 없다.
Expand All @@ -29,8 +29,8 @@ private void validateStudyMentorAuthorization(Member member, StudyDetail studyDe
}
}

private void validateDeadLine(LocalDateTime deadline) {
if (deadline.isBefore(LocalDateTime.now())) {
private void validateDeadLine(LocalDateTime deadline, LocalDateTime studyStartDate) {
if (deadline.isBefore(LocalDateTime.now()) || deadline.isBefore(studyStartDate)) {
throw new CustomException(ASSIGNMENT_DEADLINE_INVALID);
}
}
Expand Down

0 comments on commit d304af7

Please sign in to comment.