Skip to content

Commit 350bd95

Browse files
authored
[EC-240] fix: 유효성 검증 로직 수정 (#249)
1 parent 10b04ec commit 350bd95

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

api/src/main/java/org/example/educheck/domain/absenceattendance/repository/AbsenceAttendanceRepository.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,4 +26,9 @@ public interface AbsenceAttendanceRepository extends JpaRepository<AbsenceAttend
2626
Page<MyAbsenceAttendanceResponseDto> findByStudentIdAndCourseId(@Param("studentId") Long studentId, @Param("courseId") Long courseId, Pageable pageable);
2727

2828
boolean existsByStudentAndCourseAndStartTimeLessThanEqualAndEndTimeGreaterThanEqual(Student student, Course course, LocalDate endDate, LocalDate startDate);
29+
30+
boolean existsByStudentAndCourseAndStartTimeLessThanEqualAndEndTimeGreaterThanEqualAndDeletionRequestedAtIsNull(
31+
Student student, Course course, LocalDate endDate, LocalDate startDate
32+
);
33+
2934
}

api/src/main/java/org/example/educheck/domain/absenceattendance/service/AbsenceAttendanceService.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -147,9 +147,10 @@ public CreateAbsenceAttendanceResponseDto createAbsenceAttendance(Member member,
147147
}
148148

149149
private void validateDuplicateAbsenceAttendance(Member member, Course course, LocalDate startDate, LocalDate endDate) {
150-
boolean isDuplicate = absenceAttendanceRepository.existsByStudentAndCourseAndStartTimeLessThanEqualAndEndTimeGreaterThanEqual(
151-
member.getStudent(), course, endDate, startDate);
150+
// boolean isDuplicate = absenceAttendanceRepository.existsByStudentAndCourseAndStartTimeLessThanEqualAndEndTimeGreaterThanEqual(
151+
// member.getStudent(), course, endDate, startDate);
152152

153+
boolean isDuplicate = absenceAttendanceRepository.existsByStudentAndCourseAndStartTimeLessThanEqualAndEndTimeGreaterThanEqualAndDeletionRequestedAtIsNull(member.getStudent(), course, endDate, startDate);
153154
if (isDuplicate) {
154155
throw new InvalidRequestException("해당 기간에 이미 유고결석 신청이 존재합니다.");
155156
}

0 commit comments

Comments
 (0)