Skip to content

Commit 678f16c

Browse files
committed
refact: SOLO 챌린지 로그인한 유저의 챌린지만 조회
1 parent 37613c9 commit 678f16c

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/main/java/targeter/aim/domain/challenge/repository/ChallengeQueryRepository.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -271,7 +271,7 @@ public Page<ChallengeDto.ChallengeListResponse> paginateSoloByTypeAndKeyword(
271271
.limit(pageable.getPageSize())
272272
.fetch();
273273

274-
Long total = buildCountSoloQuery(filterType, keyword).fetchOne();
274+
Long total = buildCountSoloQuery(userDetails, filterType, keyword).fetchOne();
275275

276276
return new PageImpl<>(
277277
enrichDetails(tuples),
@@ -303,6 +303,7 @@ private JPAQuery<Tuple> buildSoloBaseQuery(
303303
.from(challenge)
304304
.where(
305305
challenge.mode.eq(ChallengeMode.SOLO),
306+
challenge.host.id.eq(userDetails.getUser().getId()),
306307
soloStatusCondition(filterType)
307308
)
308309
.leftJoin(challenge.host).fetchJoin()
@@ -319,6 +320,7 @@ private JPAQuery<Tuple> buildSoloBaseQuery(
319320
}
320321

321322
private JPAQuery<Long> buildCountSoloQuery(
323+
UserDetails userDetails,
322324
ChallengeDto.ChallengeFilterType filterType,
323325
String keyword
324326
) {
@@ -327,6 +329,7 @@ private JPAQuery<Long> buildCountSoloQuery(
327329
.from(challenge)
328330
.where(
329331
challenge.mode.eq(ChallengeMode.SOLO),
332+
challenge.host.id.eq(userDetails.getUser().getId()),
330333
soloStatusCondition(filterType)
331334
);
332335

0 commit comments

Comments
 (0)