Skip to content

Commit

Permalink
Merge pull request #298 from team9502/dev
Browse files Browse the repository at this point in the history
fix: 응답값에 id 추가 [배포]
  • Loading branch information
EUNCHAEv1006 authored Jul 3, 2024
2 parents a21ca8c + 06eb7af commit 29697e8
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@
@AllArgsConstructor
public class SavedPointDetailResponseDTO {

@Schema(description = "적립된 포인트 ID", example = "1")
private Long spId;

@Schema(description = "적립된 포인트", example = "REVIEW")
private SpType type;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@
@AllArgsConstructor
public class UsedPointDetailResponseDTO {

@Schema(description = "사용된 포인트 ID", example = "1")
private Long upId;

@Schema(description = "사용된 포인트", example = "REVIEW")
private UpType type;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ public List<SavedPoint> findSavedPointsWithCursor(Long pointId, Long cursorId, i
.selectFrom(qSavedPoint)
.where(
qSavedPoint.point.pointId.eq(pointId)
.and(qSavedPoint.spId.lt(cursorId))
.and(qSavedPoint.spId.gt(cursorId))
)
.orderBy(qSavedPoint.spId.desc())
.orderBy(qSavedPoint.spId.asc())
.limit(limit)
.fetch();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ public List<UsedPoint> findUsedPointsWithCursor(Long pointId, Long cursorId, int
.selectFrom(qUsedPoint)
.where(
qUsedPoint.point.pointId.eq(pointId)
.and(qUsedPoint.upId.lt(cursorId))
.and(qUsedPoint.upId.gt(cursorId))
)
.orderBy(qUsedPoint.upId.desc())
.orderBy(qUsedPoint.upId.asc())
.limit(limit)
.fetch();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,11 @@ public PagedResponseDTO<SavedPointDetailResponseDTO> getSpDetails(UserDetailsImp
}

List<SavedPointDetailResponseDTO> dtoList = savedPoints.stream()
.map(sp -> new SavedPointDetailResponseDTO(sp.getSpType(), sp.getSpAmount(), sp.getCreatedAt().toLocalDate()))
.map(sp -> new SavedPointDetailResponseDTO(
sp.getSpId(),
sp.getSpType(),
sp.getSpAmount(),
sp.getCreatedAt().toLocalDate()))
.collect(Collectors.toList());

return new PagedResponseDTO<>(dtoList, hasNextPage);
Expand All @@ -172,7 +176,11 @@ public PagedResponseDTO<UsedPointDetailResponseDTO> getUpDetails(UserDetailsImpl
}

List<UsedPointDetailResponseDTO> dtoList = usedPoints.stream()
.map(up -> new UsedPointDetailResponseDTO(up.getUpType(), up.getUpAmount(), up.getCreatedAt().toLocalDate()))
.map(up -> new UsedPointDetailResponseDTO(
up.getUpId(),
up.getUpType(),
up.getUpAmount(),
up.getCreatedAt().toLocalDate()))
.collect(Collectors.toList());

return new PagedResponseDTO<>(dtoList, hasNextPage);
Expand All @@ -183,7 +191,11 @@ public List<UsedPointDetailResponseDTO> getPublicLatestBannerUsage() {
List<UsedPoint> usedPoints = usedPointRepository.findTop3ByUpTypeOrderByCreatedAtDesc(UpType.BANNER, PageRequest.of(0, 3));

return usedPoints.stream()
.map(up -> new UsedPointDetailResponseDTO(up.getUpType(), up.getUpAmount(), up.getCreatedAt().toLocalDate()))
.map(up -> new UsedPointDetailResponseDTO(
up.getUpId(),
up.getUpType(),
up.getUpAmount(),
up.getCreatedAt().toLocalDate()))
.collect(Collectors.toList());
}

Expand Down

0 comments on commit 29697e8

Please sign in to comment.