Skip to content

Commit

Permalink
fix: Add deleteByPostId (#52)
Browse files Browse the repository at this point in the history
  • Loading branch information
chaeeun-Han committed Mar 23, 2024
1 parent 16584f2 commit 9906857
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
import org.springframework.stereotype.Repository;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

Expand All @@ -17,4 +18,6 @@ public interface QuizRepository extends JpaRepository<Quiz, Long> {
@Query("SELECT q FROM Quiz q WHERE q.tags LIKE %:tagName% ORDER BY q.quizId ASC, RAND() LIMIT 10")
List<Quiz> findByTagName(@Param("tagName") String tagName);

@Transactional
void deleteByPostId(Long postId);
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
import org.springframework.stereotype.Repository;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

Expand All @@ -29,4 +30,7 @@ public interface ReviewRepository extends JpaRepository<Review, Long> {
@Query("SELECT r FROM Review r " +
"WHERE r.reviewId = :reviewId")
List<Review> findReviewByReviewId(@Param("reviewId") String reviewId);

@Transactional
void deleteByPostId(Long postId);
}

0 comments on commit 9906857

Please sign in to comment.