Skip to content

Commit

Permalink
[CICD] API 수정 배포 (#135)
Browse files Browse the repository at this point in the history
* #128 [fix] 이미지 return 값 수정 (#129)

* Fix/#128 (#131)

* #128 [fix] 이미지 return 값 수정

* #128 [fix] scrap 오류 수정

* #128 [fix] tool scrap 오류 수정

* #133 [fix] board scrap 오류 수정 (#134)

* #133 [fix] board scrap 오류 수정

* #133 [fix] board scrap 오류 수정

---------

Co-authored-by: woals2840 <[email protected]>
  • Loading branch information
jjuny-won and woals2840 authored Jan 21, 2025
1 parent 9e08bc7 commit 052c1a3
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
import org.springframework.stereotype.Repository;

Expand All @@ -19,7 +20,8 @@ public interface BoardScrapRepository extends JpaRepository<BoardScrap,Long> {
@Transactional
void deleteAllByUserId(@Param("userId") Long userId);

Page<BoardScrap> findAllByUserId(Long userId, Pageable pageable);
@Query("SELECT bs FROM BoardScrap bs WHERE bs.user.id = :userId AND bs.delYn = false")
Page<BoardScrap> findAllActiveByUserId(@Param("userId") Long userId, Pageable pageable);

Optional<BoardScrap> findByUserAndBoard(UserEntity user, Board board);
}
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ else if (toolId != null) {
public FavoriteBoardsRetrieveResponse getFavoriteBoards(final Long userId, final Pageable pageable){
validateBoard.validateUser(userId);

Page<BoardScrap> boardScraps = boardScrapRepository.findAllByUserId(userId, pageable);
Page<BoardScrap> boardScraps = boardScrapRepository.findAllActiveByUserId(userId, pageable);
List<FavoriteBoardsResponse> favoriteBoardsResponses = boardScraps.getContent().stream()
.filter(boardScrap -> !boardScrap.isDelYn())
.map(boardScrap -> {
Expand All @@ -229,7 +229,6 @@ public FavoriteBoardsRetrieveResponse getFavoriteBoards(final Long userId, final
})
.toList();
PagenationDto pageInfo = PagenationDto.of(pageable.getPageNumber(), pageable.getPageSize(), boardScraps.getTotalPages());
log.debug("페이지 번호를 출력합니다" + pageable.getPageNumber());
return new FavoriteBoardsRetrieveResponse(userId, favoriteBoardsResponses, pageInfo);

}
Expand Down

0 comments on commit 052c1a3

Please sign in to comment.