-
Notifications
You must be signed in to change notification settings - Fork 0
[week07] 제이스 7주차 미션 #21
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
Merged
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
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
Empty file.
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 |
|---|---|---|
|
|
@@ -11,7 +11,9 @@ | |
| public interface MissionRepository extends JpaRepository<Mission, Long> { | ||
|
|
||
| @Query("SELECT m FROM Mission m " + | ||
| "WHERE m.shop.shopAddress LIKE %:region% " + | ||
| "JOIN FETCH m.shop s " + | ||
| "JOIN FETCH s.shopCategory " + | ||
| "WHERE s.shopAddress LIKE %:region% " + | ||
| "AND (:cursorId IS NULL OR m.id < :cursorId) " + | ||
| "ORDER BY m.id DESC") | ||
| List<Mission> findByRegionWithCursor( | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Pageable 파라미터를 사용하면서 List 타입을 반환하면 다음 페이지의 존재 여부 파악이 되지 않습니다! Slice와 같은 타입으로 변경하시면 좋을 것 같아요! |
||
|
|
||
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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
9 changes: 7 additions & 2 deletions
9
jace/src/main/java/com/umcstudy/jace/domain/review/dto/ReviewReqDTO.java
This file contains hidden or 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 |
|---|---|---|
| @@ -1,12 +1,17 @@ | ||
| package com.umcstudy.jace.domain.review.dto; | ||
|
|
||
| import jakarta.validation.constraints.DecimalMax; | ||
| import jakarta.validation.constraints.DecimalMin; | ||
| import jakarta.validation.constraints.NotBlank; | ||
| import jakarta.validation.constraints.Size; | ||
|
|
||
| import java.util.List; | ||
|
|
||
| public class ReviewReqDTO { | ||
|
|
||
| public record PostReviewWrite( | ||
| String reviewContents, | ||
| @NotBlank(message = "리뷰 내용은 필수입니다") @Size(max = 500, message = "리뷰 내용은 500자 이하여야 합니다") String reviewContents, | ||
| List<String> reviewImageUrl, | ||
| float reviewScore | ||
| @DecimalMin(value = "0.5", message = "평점은 0.5 이상이어야 합니다") @DecimalMax(value = "5.0", message = "평점은 5.0 이하여야 합니다") float reviewScore | ||
| ) {} | ||
| } |
This file contains hidden or 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 hidden or 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
5 changes: 5 additions & 0 deletions
5
jace/src/main/java/com/umcstudy/jace/domain/review/enums/ReviewSortType.java
This file contains hidden or 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,5 @@ | ||
| package com.umcstudy.jace.domain.review.enums; | ||
|
|
||
| public enum ReviewSortType { | ||
| ID, SCORE | ||
| } |
This file contains hidden or 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
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.
order by를 제거하고 Pageable에게 정렬 책임을 위임하는 것이 나을 것 같습니다! Pageable에도 정렬조건이 있고, ORDER BY 절에 의한 정렬 쿼리가 작성되어 있다면 Hibernate가 sql을 파싱하는 과정에서 정렬 구문이 중복되거나 충돌하여 syntax 에러가 발생할 수 있기 때문입니다!