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

v2.0.6 #418

Merged
merged 6 commits into from
Dec 8, 2024
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 @@ -62,9 +62,11 @@ public FeedSliceResponse findFeed(int size, Long lastId, MissionVisibility visib

@Transactional(readOnly = true)
public Slice<FeedOneResponse> findFeedV2(FeedVisibility visibility, int size, Long lastId) {
// 전체
if (visibility == FeedVisibility.ALL) {
return findAllFeedV2(size, lastId);
}
// 팔로잉
return findFollowingFeedV2(size, lastId);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -168,8 +168,7 @@ public void deleteByMissionRecordId(Long missionRecordId) {
}

@Override
public Slice<MissionRecord> findAllFetch(int size, Long lastId) {

public Slice<MissionRecord> findAllFetch(final int size, final Long lastId) {
List<MissionRecord> missionRecords =
jpaQueryFactory
.selectFrom(missionRecord)
Expand All @@ -180,7 +179,11 @@ public Slice<MissionRecord> findAllFetch(int size, Long lastId) {
.leftJoin(missionRecord.reactions, reaction)
.fetchJoin()
.distinct()
.where(ltMissionRecordId(lastId))
.where(
ltMissionRecordId(lastId) != null
? ltMissionRecordId(lastId)
.and(checkMissionVisibilityNone())
: checkMissionVisibilityNone())
.orderBy(missionRecord.finishedAt.desc())
.limit((long) size + 1)
.fetch();
Expand Down Expand Up @@ -264,4 +267,8 @@ private boolean getHasNext(List<?> list, int size) {
}
return hasNext;
}

private BooleanExpression checkMissionVisibilityNone() {
return mission.visibility.ne(MissionVisibility.NONE);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ private void setFixture() {
Slice<FeedOneResponse> response = feedService.findFeedV2(FeedVisibility.ALL, 10, 5L);

// then
assertThat(response.getContent()).hasSize(4);
assertThat(response.getContent()).hasSize(3);
}

@Nested
Expand Down
Loading