-
Notifications
You must be signed in to change notification settings - Fork 0
Feat: [FN-119] 그룹 전체 조회 API 추가 #37
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
16 commits
Select commit
Hold shift + click to select a range
5267323
Feat: 유저 검증 추가
stoneTiger0912 a07151d
Feat: 그룹 전체 조회 추가
stoneTiger0912 f0668e1
Chore: override 추가
stoneTiger0912 9639bb7
Feat: 커서 기반 그룹 정보 조회 추가
stoneTiger0912 f2e237c
Fix: 그룹 삭제 메서드 수정
stoneTiger0912 942acd4
Refactor: 그룹 조회시 hasNext 추가, category 추가
stoneTiger0912 8dfdcb1
Refactor: 위치 common 패키지로 수정
stoneTiger0912 8396dee
Chore: 변수명 명확하게 수정
stoneTiger0912 2c40d15
Feat: 그룹 전체 조회시 이미지 url 추가
stoneTiger0912 efb923d
Chore: 에러 설명 정확하게 수정
stoneTiger0912 4896e29
Fix: size가 정확히 10개일 때 next를 보내주는 경우 수정
stoneTiger0912 443f7ea
Merge: 충돌 해결
stoneTiger0912 6365dbd
Refactor: PagingRequest, Response 상속 받아 사용으로 변경
stoneTiger0912 d083c35
Refactor: PagingRequest, Response 상속 받아 사용으로 변경
stoneTiger0912 1fca7e9
Fix: size값 상수에서 변수값으로 변경
stoneTiger0912 2c75edd
Merge: 충돌 해결
stoneTiger0912 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
2 changes: 1 addition & 1 deletion
2
...flipnote/infra/config/QuerydslConfig.java → ...lipnote/common/config/QuerydslConfig.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
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 |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| package project.flipnote.group.model; | ||
|
|
||
| import project.flipnote.group.entity.Category; | ||
|
|
||
| public record GroupInfo( | ||
| Long groupId, | ||
| String name, | ||
| String description, | ||
| Category category, | ||
| String imageUrl) { | ||
| public static GroupInfo from(Long groupId, String name, String description, Category category, String imageUrl) { | ||
| return new GroupInfo(groupId, name, description, category, imageUrl); | ||
| } | ||
| } |
20 changes: 20 additions & 0 deletions
20
src/main/java/project/flipnote/group/model/GroupListRequest.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,20 @@ | ||
| package project.flipnote.group.model; | ||
|
|
||
| import org.springframework.data.domain.PageRequest; | ||
| import org.springframework.data.domain.Sort; | ||
|
|
||
| import lombok.Getter; | ||
| import lombok.Setter; | ||
| import project.flipnote.common.model.request.CursorPagingRequest; | ||
|
|
||
| @Setter | ||
| @Getter | ||
| public class GroupListRequest extends CursorPagingRequest { | ||
|
|
||
| private String category; | ||
|
|
||
| @Override | ||
| public PageRequest getPageRequest() { | ||
| return PageRequest.of(0, getSize(), Sort.by(Sort.Direction.DESC, "id")); | ||
| } | ||
| } |
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
10 changes: 10 additions & 0 deletions
10
src/main/java/project/flipnote/group/repository/GroupRepositoryCustom.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,10 @@ | ||
| package project.flipnote.group.repository; | ||
|
|
||
| import java.util.List; | ||
|
|
||
| import project.flipnote.group.entity.Category; | ||
| import project.flipnote.group.model.GroupInfo; | ||
|
|
||
| public interface GroupRepositoryCustom { | ||
| List<GroupInfo> findAllByCursor(Long lastId, Category category, int pageSize); | ||
| } |
50 changes: 50 additions & 0 deletions
50
src/main/java/project/flipnote/group/repository/GroupRepositoryImpl.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,50 @@ | ||
| package project.flipnote.group.repository; | ||
|
|
||
| import java.util.List; | ||
|
|
||
|
|
||
| import com.querydsl.core.BooleanBuilder; | ||
| import com.querydsl.core.types.Projections; | ||
| import com.querydsl.jpa.impl.JPAQueryFactory; | ||
|
|
||
| import lombok.RequiredArgsConstructor; | ||
| import project.flipnote.group.entity.Category; | ||
| import project.flipnote.group.entity.QGroup; | ||
| import project.flipnote.group.model.GroupInfo; | ||
|
|
||
| @RequiredArgsConstructor | ||
| public class GroupRepositoryImpl implements GroupRepositoryCustom { | ||
|
|
||
| private final JPAQueryFactory queryFactory; | ||
|
|
||
| QGroup group = QGroup.group; | ||
|
|
||
| @Override | ||
| public List<GroupInfo> findAllByCursor(Long lastId, Category category, int pageSize) { | ||
| BooleanBuilder where = new BooleanBuilder() | ||
| .and(group.deletedAt.isNull()); | ||
|
|
||
| if (lastId != null) { | ||
| where.and(group.id.lt(lastId)); | ||
| } | ||
|
|
||
| if (category != null) { | ||
| where.and(group.category.eq(category)); | ||
| } | ||
|
|
||
| return queryFactory.select(Projections.constructor( | ||
| GroupInfo.class, | ||
| group.id, | ||
| group.name, | ||
| group.description, | ||
| group.category, | ||
| group.imageUrl | ||
| )) | ||
| .from(group) | ||
| .where(where) | ||
| .orderBy(group.id.desc()) | ||
| .limit(pageSize+1) | ||
| .fetch(); | ||
| } | ||
|
|
||
| } |
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
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.
Uh oh!
There was an error while loading. Please reload this page.