Skip to content

Commit

Permalink
[feat] #21 title 값을 포함하는 값 조회 쿼리
Browse files Browse the repository at this point in the history
  • Loading branch information
nykoh2001 committed Feb 17, 2024
1 parent 02d6806 commit 0179c61
Showing 1 changed file with 4 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@
package org.harang.server.repository;

import java.util.List;
import org.harang.server.domain.Post;
import org.springframework.data.jpa.repository.JpaRepository;
import org.harang.server.dto.type.ErrorMessage;
import org.harang.server.exception.CustomException;
import org.springframework.data.jpa.repository.Query;

public interface PostRepository extends JpaRepository<Post, Long> {
default Post findByIdOrThrow(Long id) {
return findById(id).orElseThrow(() -> new CustomException(ErrorMessage.POST_NOT_FOUND));
}

List<Post> findByTitleIsContaining(String title);
}

0 comments on commit 0179c61

Please sign in to comment.