diff --git a/src/main/java/in/koreatech/koin/domain/timetableV2/repository/TimetableFrameRepositoryV2.java b/src/main/java/in/koreatech/koin/domain/timetableV2/repository/TimetableFrameRepositoryV2.java index b91de5810..4715310f7 100644 --- a/src/main/java/in/koreatech/koin/domain/timetableV2/repository/TimetableFrameRepositoryV2.java +++ b/src/main/java/in/koreatech/koin/domain/timetableV2/repository/TimetableFrameRepositoryV2.java @@ -14,7 +14,6 @@ import in.koreatech.koin.domain.timetableV2.model.TimetableFrame; import in.koreatech.koin.domain.user.model.User; import jakarta.persistence.LockModeType; -import jakarta.validation.constraints.NotNull; public interface TimetableFrameRepositoryV2 extends Repository { @@ -61,21 +60,22 @@ default TimetableFrame getByUser(User user) { @Lock(LockModeType.PESSIMISTIC_WRITE) @Query( """ - SELECT t FROM TimetableFrame t - WHERE t.user.id = :userId - AND t.semester.id = :semesterId - AND t.isMain = false - ORDER BY t.createdAt ASC - LIMIT 1 - """) - TimetableFrame findNextFirstTimetableFrame(@Param("userId") Integer userId, @Param("semesterId") Integer semesterId); + SELECT t FROM TimetableFrame t + WHERE t.user.id = :userId + AND t.semester.id = :semesterId + AND t.isMain = false + ORDER BY t.createdAt ASC + LIMIT 1 + """) + TimetableFrame findNextFirstTimetableFrame(@Param("userId") Integer userId, + @Param("semesterId") Integer semesterId); @Query( """ - SELECT COUNT(t) FROM TimetableFrame t - WHERE t.user.id = :userId - AND t.semester.id = :semesterId - """) + SELECT COUNT(t) FROM TimetableFrame t + WHERE t.user.id = :userId + AND t.semester.id = :semesterId + """) int countByUserIdAndSemesterId(@Param("userId") Integer userId, @Param("semesterId") Integer semesterId); void deleteById(Integer id); @@ -91,6 +91,7 @@ default TimetableFrame getByIdWithDeleted(Integer id) { return findByIdWithDeleted(id) .orElseThrow(() -> TimetableFrameNotFoundException.withDetail("id: " + id)); } + void deleteAllByUserAndSemester(User user, Semester semester); List findAllByUserId(Integer userId);