Skip to content

Commit

Permalink
#127 Feat : 저장한 게시물(내 카테고리) 상세보기 API 구현
Browse files Browse the repository at this point in the history
  • Loading branch information
ls-rain committed Feb 16, 2024
1 parent ec28b99 commit d94fae3
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 2 additions & 4 deletions src/main/java/friend/spring/repository/PostRepository.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,6 @@ public interface PostRepository extends JpaRepository<Post, Long> {
Page<Post> findBestPosts(Pageable pageable);
Page<Post> findAllByOrderByCreatedAtDesc(Pageable pageable);

@Query(value = "SELECT * FROM post p join post_scrap ps ON p.user_id = ps.user_id join category c on p.category_id = c.id", nativeQuery = true)
Page<Post> findCategoryDetail(@Param("user_id") Long userId,
@Param("category_id") Long categoryId,
PageRequest pageRequest);
@Query(value = "SELECT p FROM Post p JOIN p.postScrapList s JOIN p.category c WHERE s.user.id = :userId and c.id = :categoryId")
Page<Post> findCategoryDetail(Long userId, Long categoryId, PageRequest pageRequest);
}
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,8 @@ public ApiResponse<MyPageResponseDTO.MyInquiryRes> editUserSecurity(
@ApiResponses({
@io.swagger.v3.oas.annotations.responses.ApiResponse(responseCode = "COMMON200", description = "OK, 요청에 성공했습니다. "),
@io.swagger.v3.oas.annotations.responses.ApiResponse(responseCode = "USER4001",description = "NOT_FOUND, 사용자를 찾을 수 없습니다."),
@io.swagger.v3.oas.annotations.responses.ApiResponse(responseCode = "POST4004",description = "NOT_FOUND, 글에 대한 스크랩 데이터를 찾을 수 없습니다."),

})
@Parameters({
@Parameter(name = "atk", description = "RequestHeader - 로그인한 사용자의 accessToken"),
Expand Down

0 comments on commit d94fae3

Please sign in to comment.