-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
23 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 15 additions & 0 deletions
15
src/main/java/com/gamzabat/algohub/feature/notice/repository/NoticeReadRepository.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,26 @@ | ||
package com.gamzabat.algohub.feature.notice.repository; | ||
|
||
import org.springframework.data.jpa.repository.JpaRepository; | ||
import org.springframework.data.jpa.repository.Modifying; | ||
import org.springframework.data.jpa.repository.Query; | ||
|
||
import com.gamzabat.algohub.feature.group.studygroup.domain.StudyGroup; | ||
import com.gamzabat.algohub.feature.notice.domain.Notice; | ||
import com.gamzabat.algohub.feature.notice.domain.NoticeRead; | ||
import com.gamzabat.algohub.feature.user.domain.User; | ||
|
||
public interface NoticeReadRepository extends JpaRepository<NoticeRead, Long> { | ||
boolean existsByNoticeAndUser(Notice notice, User user); | ||
|
||
@Modifying | ||
@Query("delete from NoticeRead nr where nr.notice = :notice") | ||
void deleteAllByNotice(Notice notice); | ||
|
||
@Modifying | ||
@Query("delete from NoticeRead nr where nr.notice.studyGroup = :group") | ||
void deleteAllByStudyGroup(StudyGroup group); | ||
|
||
@Modifying | ||
@Query("delete from NoticeRead nr where nr.notice.studyGroup = :group and nr.user = :user") | ||
void deleteAllByStudyGroupAndUser(StudyGroup group, User user); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters