-
Notifications
You must be signed in to change notification settings - Fork 4
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
[feat/CK-114] 로드맵 리뷰를 조회하는 기능을 구현한다 #74
Merged
Merged
Changes from 6 commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
8c64c08
feat: 로드맵 리뷰 조회 API 구현
Ohjintaek 3f4854a
feat: 로드맵 리뷰 조회 Repository 구현
Ohjintaek f55786f
feat: 로드맵 리뷰 조회 Service 구현
Ohjintaek 030a7ca
feat: 로드맵 리뷰 조회 무한 스크롤 방식으로 변경 및 통합 테스트 추가
Ohjintaek 76a3dd6
refactor: 리뷰 반영
Ohjintaek 07c05dc
refactor: LocalDateTime 요청/응답 formatting문제 해결
Ohjintaek cb2465f
test: 사용자 프로필 이미지 경로도 확인하도록 수정
Ohjintaek e3791f9
chore: merge conflict 해결
Ohjintaek 1a1c63d
chore: merge conflict 해결
Ohjintaek File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
25 changes: 25 additions & 0 deletions
25
backend/kirikiri/src/main/java/co/kirikiri/persistence/dto/RoadmapReviewLastValueDto.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
package co.kirikiri.persistence.dto; | ||
|
||
import co.kirikiri.service.dto.CustomReviewScrollRequest; | ||
import java.time.LocalDateTime; | ||
import lombok.AccessLevel; | ||
import lombok.AllArgsConstructor; | ||
import lombok.Getter; | ||
|
||
@AllArgsConstructor(access = AccessLevel.PRIVATE) | ||
@Getter | ||
public class RoadmapReviewLastValueDto { | ||
|
||
private final LocalDateTime lastCreatedAt; | ||
private final Double lastReviewRate; | ||
|
||
public static RoadmapReviewLastValueDto create(final CustomReviewScrollRequest request) { | ||
if (request.lastCreatedAt() == null && request.lastReviewRate() == null) { | ||
return null; | ||
} | ||
if (request.lastReviewRate() == null) { | ||
return new RoadmapReviewLastValueDto(request.lastCreatedAt(), null); | ||
} | ||
return new RoadmapReviewLastValueDto(null, request.lastReviewRate()); | ||
} | ||
} |
13 changes: 13 additions & 0 deletions
13
.../kirikiri/src/main/java/co/kirikiri/persistence/roadmap/RoadmapReviewQueryRepository.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
package co.kirikiri.persistence.roadmap; | ||
|
||
import co.kirikiri.domain.roadmap.Roadmap; | ||
import co.kirikiri.domain.roadmap.RoadmapReview; | ||
import co.kirikiri.persistence.dto.RoadmapReviewLastValueDto; | ||
import java.util.List; | ||
|
||
public interface RoadmapReviewQueryRepository { | ||
|
||
List<RoadmapReview> findRoadmapReviewWithMemberByRoadmapOrderByLatest(final Roadmap roadmap, | ||
final RoadmapReviewLastValueDto lastValue, | ||
final int pageSize); | ||
} |
49 changes: 49 additions & 0 deletions
49
...ikiri/src/main/java/co/kirikiri/persistence/roadmap/RoadmapReviewQueryRepositoryImpl.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
package co.kirikiri.persistence.roadmap; | ||
|
||
import static co.kirikiri.domain.member.QMember.member; | ||
import static co.kirikiri.domain.roadmap.QRoadmapReview.roadmapReview; | ||
|
||
import co.kirikiri.domain.roadmap.Roadmap; | ||
import co.kirikiri.domain.roadmap.RoadmapReview; | ||
import co.kirikiri.persistence.QuerydslRepositorySupporter; | ||
import co.kirikiri.persistence.dto.RoadmapReviewLastValueDto; | ||
import com.querydsl.core.types.OrderSpecifier; | ||
import com.querydsl.core.types.dsl.BooleanExpression; | ||
import java.time.LocalDateTime; | ||
import java.util.List; | ||
|
||
public class RoadmapReviewQueryRepositoryImpl extends QuerydslRepositorySupporter implements | ||
RoadmapReviewQueryRepository { | ||
|
||
public RoadmapReviewQueryRepositoryImpl() { | ||
super(RoadmapReview.class); | ||
} | ||
|
||
@Override | ||
public List<RoadmapReview> findRoadmapReviewWithMemberByRoadmapOrderByLatest(final Roadmap roadmap, | ||
final RoadmapReviewLastValueDto lastValue, | ||
final int pageSize) { | ||
return selectFrom(roadmapReview) | ||
.innerJoin(roadmapReview.member, member) | ||
.fetchJoin() | ||
.where(roadmapCond(roadmap), lessThanLastValue(lastValue)) | ||
.limit(pageSize) | ||
.orderBy(orderByCreatedAtDesc()) | ||
.fetch(); | ||
} | ||
|
||
private BooleanExpression roadmapCond(final Roadmap roadmap) { | ||
return roadmapReview.roadmap.eq(roadmap); | ||
} | ||
|
||
private BooleanExpression lessThanLastValue(final RoadmapReviewLastValueDto lastValue) { | ||
if (lastValue == null) { | ||
return null; | ||
} | ||
return roadmapReview.createdAt.lt(lastValue.getLastCreatedAt()); | ||
} | ||
|
||
private OrderSpecifier<LocalDateTime> orderByCreatedAtDesc() { | ||
return roadmapReview.createdAt.desc(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 15 additions & 0 deletions
15
backend/kirikiri/src/main/java/co/kirikiri/service/dto/CustomReviewScrollRequest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
package co.kirikiri.service.dto; | ||
|
||
import jakarta.validation.constraints.NotNull; | ||
import java.time.LocalDateTime; | ||
import org.springframework.format.annotation.DateTimeFormat; | ||
|
||
public record CustomReviewScrollRequest( | ||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss.SSSSSS") | ||
LocalDateTime lastCreatedAt, | ||
Double lastReviewRate, | ||
@NotNull(message = "사이즈를 입력해 주세요.") | ||
Integer size | ||
) { | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,7 +2,8 @@ | |
|
||
public record MemberResponse( | ||
long id, | ||
String name | ||
String name, | ||
String imageUrl | ||
) { | ||
|
||
} |
14 changes: 14 additions & 0 deletions
14
...irikiri/src/main/java/co/kirikiri/service/dto/roadmap/response/RoadmapReviewResponse.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
package co.kirikiri.service.dto.roadmap.response; | ||
|
||
import co.kirikiri.service.dto.member.response.MemberResponse; | ||
import java.time.LocalDateTime; | ||
|
||
public record RoadmapReviewResponse( | ||
Long id, | ||
MemberResponse member, | ||
LocalDateTime createdAt, | ||
String content, | ||
Double rate | ||
) { | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Submodule properties
updated
from 870ae7 to 3421e8
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
궁금한 게 있는데 요 포맷으로 들어오지 않았을 경우 어떤 예외 메시지가 발생하나요??
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"message": "Failed to convert value of type 'java.lang.String' to required type 'java.time.LocalDateTime'; Failed to convert from type [java.lang.String] to type [java.time.LocalDateTime] for value [2023-08-10 20:41:51.083111]"
요런 메시지가 나오네요
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
오호... 프론트분들이 요 형식에 맞게 요청을 하셔야겠네요...