Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BE] 컬렉션 관련 버그 수정 #578

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ public class MyFeedCollectionResponse {
private String title;
private String thumbnailUrl;
private int feedCount;
private long likeCount;
private int likeCount;
private int commentCount;
private boolean liked;
private LocalDateTime createdAt;
Expand All @@ -26,7 +26,7 @@ public MyFeedCollectionResponse(
String title,
String thumbnailUrl,
Integer feedCount,
Long likeCount,
Integer likeCount,
Integer commentCount,
LocalDateTime createdAt,
LocalDateTime updatedAt,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public interface MemberJpaRepository extends JpaRepository<Member, MemberId>, Me
@Query("SELECT new com.foodymoody.be.member.application.dto.response.MyFeedCollectionTitleResponse (fc.id, fc.title, fc.isPrivate) "
+ "FROM Member m "
+ "LEFT JOIN FETCH FeedCollection fc ON fc.authorId = m.id "
+ "WHERE m.id = :id "
+ "WHERE m.id = :id AND fc.isDeleted = false "
+ "ORDER BY fc.createdAt DESC")
List<MyFeedCollectionTitleResponse> fetchMyCollectionTitles(MemberId id);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ public MyFeedCollectionsResponse fetchMyCollectionResponse(MemberId id, MemberId
feedCollection.title,
feedCollection.thumbnailUrl,
feedCollection.feedIds.ids.size(),
feedCollectionLike.count(),
feedCollection.likeCount,
feedCollection.commentIds.ids.size(),
feedCollection.createdAt,
feedCollection.updatedAt,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -373,7 +373,8 @@ void when_fetch_member_collections_if_not_sign_in_then_response_status_code_200_

@DisplayName("회원이 작성한 컬렉션 목록 조회시 로그인한 사용자가 좋아요를 누른 컬렉션이면, liked가 true이다")
@Test
void when_fetch_member_collections_if_liked_by_current_member_then_response_status_code_200_and_liked_true() {
void when_fetch_member_collections_if_liked_by_current_member_then_response_status_code_200_and_liked_true()
throws InterruptedException {
// docs
api_문서_타이틀("fetch_member_collections_if_liked_by_current_member", spec);

Expand All @@ -394,8 +395,8 @@ void when_fetch_member_collections_if_liked_by_current_member_then_response_stat
() -> 상태코드를_검증한다(response, HttpStatus.OK),
() -> assertThat(response.jsonPath().getList("collections.content"))
.filteredOn("id", 컬렉션1_아이디)
.extracting("likeCount", "liked")
.containsExactly(Tuple.tuple(1, Boolean.TRUE))
.extracting("liked")
.containsExactly(Boolean.TRUE)
);
}

Expand All @@ -420,22 +421,23 @@ void when_fetch_member_collection_titles_if_success_then_response_status_code_20
String 무드1_아이디 = 피드_컬렉션_무드를_등록하고_아이디를_가져온다(회원아티_액세스토큰);
String 무드2_아이디 = 피드_컬렉션_무드를_등록하고_아이디를_가져온다(회원아티_액세스토큰);
String 무드3_아이디 = 피드_컬렉션_무드를_등록하고_아이디를_가져온다(회원아티_액세스토큰);
피드_컬렉션_등록하고_피드_리스트도_추가한다(List.of(무드1_아이디), 회원아티_액세스토큰, List.of(피드1_아이디));
String 피드컬렉션1_아이디 = 피드_컬렉션_등록하고_피드_리스트도_추가한다(List.of(무드1_아이디), 회원아티_액세스토큰, List.of(피드1_아이디));
피드_컬렉션_등록하고_피드_리스트도_추가한다(List.of(무드1_아이디, 무드2_아이디), 회원아티_액세스토큰, List.of(피드1_아이디, 피드2_아이디));
피드_컬렉션_등록하고_피드_리스트도_추가한다(List.of(무드1_아이디, 무드2_아이디, 무드3_아이디), 회원아티_액세스토큰,
List.of(피드1_아이디, 피드2_아이디, 피드3_아이디));
피드_컬렉션_등록하고_피드_리스트도_추가한다(List.of(무드1_아이디), 회원아티_액세스토큰, List.of(피드1_아이디));
피드_컬렉션_등록하고_피드_리스트도_추가한다(List.of(무드1_아이디), 회원아티_액세스토큰, List.of(피드1_아이디));
피드_컬렉션_등록하고_피드_리스트도_추가한다(List.of(무드1_아이디), 회원아티_액세스토큰, List.of(피드1_아이디));
피드_컬렉션_등록하고_피드_리스트도_추가한다(List.of(무드1_아이디), 회원아티_액세스토큰, List.of(피드1_아이디));
피드_컬렉션을_삭제한다(피드컬렉션1_아이디, 회원아티_액세스토큰, new RequestSpecBuilder().build());

// when
ExtractableResponse<Response> response = 회원이_작성한_피드_컬렉션_제목_목록을_조회한다(회원아티_액세스토큰, spec);

// then
Assertions.assertAll(
() -> 상태코드를_검증한다(response, HttpStatus.OK),
() -> assertThat(response.jsonPath().getList("")).hasSize(7)
() -> assertThat(response.jsonPath().getList("")).hasSize(6)
);

}
Expand Down
Loading