review-api/src/main/java/com/guams/review/model/PostRepository.java

20 lines
656 B
Java

package com.guams.review.model;
import com.guams.review.model.dao.Post;
import org.springframework.data.jdbc.repository.query.Query;
import org.springframework.data.repository.CrudRepository;
import org.springframework.stereotype.Repository;
import java.util.List;
import java.util.UUID;
@Repository
public interface PostRepository extends CrudRepository<Post, Long> {
@Query("select id, description, illustration, title, body, category, publication_date " +
"from post join publication on post.id=publication.post_fk where publication.author_fk=:authorId")
List<Post> findPostsOfAuthor(UUID authorId);
List<Post> findAll();
}