-
Notifications
You must be signed in to change notification settings - Fork 1
Feat #202 파트별 게시판 스터디 목록 조회 api 구현 #202
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
The head ref may contain hidden characters: "feat/#201/\uD30C\uD2B8\uBCC4-\uAC8C\uC2DC\uD310-\uC2A4\uD130\uB514-\uBAA9\uB85D-\uC870\uD68C-api-\uAD6C\uD604"
Changes from all commits
34476fd
6f2f424
e0a90af
f0859e8
a9f32a6
b7fb9f9
e34e75d
b23799f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -6,7 +6,7 @@ | |
|
|
||
| public record PartPostDTO( | ||
| @NotNull Part part, | ||
| Category category, | ||
| @NotNull Category category, | ||
| Integer cardinalNumber, | ||
| Integer week, | ||
| String studyName | ||
|
Comment on lines
7
to
12
Collaborator
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. 검색 용도로만 쓰이는걸까요?
Member
Author
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. 검색용도라는게 어떤거 말씀하시는걸까요 ? 조회할때 request에서 사용되는 DTO입니다 분리한 이유를 물으신게 맞다면, @ModelAttribute 어노테이션에서 사용되는 dto라서 따로 분리해주었습니다 |
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,7 @@ | ||
| package leets.weeth.domain.board.domain.repository; | ||
|
|
||
| import java.util.Collection; | ||
| import java.util.List; | ||
| import leets.weeth.domain.board.domain.entity.Post; | ||
| import leets.weeth.domain.board.domain.entity.enums.Category; | ||
| import leets.weeth.domain.board.domain.entity.enums.Part; | ||
|
|
@@ -14,12 +16,19 @@ public interface PostRepository extends JpaRepository<Post, Long> { | |
|
|
||
| Slice<Post> findPageBy(Pageable page); | ||
|
|
||
| @Query(""" | ||
| SELECT DISTINCT p.studyName | ||
| FROM Post p | ||
| WHERE (:part = leets.weeth.domain.board.domain.entity.enums.Part.ALL OR p.part = :part) | ||
| AND p.studyName IS NOT NULL | ||
| ORDER BY p.studyName ASC | ||
| """) | ||
| List<String> findDistinctStudyNamesByPart(@Param("part") Part part); | ||
|
Collaborator
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. ALL로 조회하는 경우는 어떻게 반환되나요?
Member
Author
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. 해당 내용은 아래 시현님 코멘트와 다르게, 근데 저희가 전체 스터디 게시판도 존재하니까, |
||
|
|
||
| @Query(""" | ||
| SELECT p | ||
| FROM Post p | ||
| WHERE ( | ||
| p.part = :part | ||
| OR p.part = leets.weeth.domain.board.domain.entity.enums.Part.ALL | ||
| WHERE (p.part = :part OR p.part = leets.weeth.domain.board.domain.entity.enums.Part.ALL OR :part = leets.weeth.domain.board.domain.entity.enums.Part.ALL | ||
| ) | ||
| AND (:category IS NULL OR p.category = :category) | ||
| AND (:cardinal IS NULL OR p.cardinalNumber = :cardinal) | ||
|
|
@@ -29,7 +38,16 @@ public interface PostRepository extends JpaRepository<Post, Long> { | |
| """) | ||
| Slice<Post> findByPartAndOptionalFilters(@Param("part") Part part, @Param("category") Category category, @Param("cardinal") Integer cardinal, @Param("studyName") String studyName, @Param("week") Integer week, Pageable pageable); | ||
|
|
||
| Slice<Post> findByCategoryAndCardinalNumber(Category category, Integer cardinalNumber, Pageable pageable); | ||
| Slice<Post> findByCategoryAndCardinalNumber(Category category, Integer cardinalNumber, Pageable pageable); | ||
|
|
||
| @Query(""" | ||
| SELECT p | ||
| FROM Post p | ||
| WHERE p.category = :category | ||
| AND p.cardinalNumber IN :cardinals | ||
| ORDER BY p.id DESC | ||
| """) | ||
| Slice<Post> findByCategoryAndCardinalIn(@Param("category") Category category, @Param("cardinals") Collection<Integer> cardinals, Pageable pageable); | ||
|
|
||
| Slice<Post> findByCategory(Category category, Pageable pageable); | ||
|
|
||
|
|
||
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.
part가 ALL일 때는 어떻게 검색되나요?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.
위 강혁님 코멘트 내용이랑 비슷한 내용인거같은데, ALL 일때는 전체 파트에 해당하는 내용이 반환이됩니다
BE, FE, PM, D
위 4개의 파트가 모두 포함됨