-
Notifications
You must be signed in to change notification settings - Fork 5
[Feat/OPS-376] 스페이스 목록 참여 인원 반환 api 구성 #109
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
The head ref may contain hidden characters: "feat/OPS-376-BE-feat-\uC2A4\uD398\uC774\uC2A4-\uBAA9\uB85D-\uCC38\uC5EC-\uC778\uC6D0-\uBC18\uD658-API-\uAD6C\uC131"
Merged
Changes from all commits
Commits
Show all changes
4 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
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
20 changes: 20 additions & 0 deletions
20
src/main/java/org/tuna/zoopzoop/backend/domain/space/space/dto/etc/SpaceInfo.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 org.tuna.zoopzoop.backend.domain.space.space.dto.etc; | ||
|
|
||
| import com.fasterxml.jackson.annotation.JsonInclude; | ||
| import org.tuna.zoopzoop.backend.domain.space.membership.dto.etc.SpaceMemberInfo; | ||
| import org.tuna.zoopzoop.backend.domain.space.membership.enums.Authority; | ||
|
|
||
| import java.util.List; | ||
|
|
||
| @JsonInclude(JsonInclude.Include.NON_NULL) | ||
| public record SpaceInfo( | ||
| Integer id, | ||
| String name, | ||
| String thumbnailUrl, | ||
| Authority authority, | ||
| List<SpaceMemberInfo> members | ||
| ) { | ||
| public SpaceInfo(Integer id, String name, String thumbnailUrl, Authority authority) { | ||
| this(id, name, thumbnailUrl, authority, null); | ||
| } | ||
| } |
2 changes: 1 addition & 1 deletion
2
.../SpaceMembershipInfoWithoutAuthority.java → ...ce/dto/etc/SpaceInfoWithoutAuthority.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
11 changes: 0 additions & 11 deletions
11
src/main/java/org/tuna/zoopzoop/backend/domain/space/space/dto/etc/SpaceMembershipInfo.java
This file was deleted.
Oops, something went wrong.
4 changes: 2 additions & 2 deletions
4
.../java/org/tuna/zoopzoop/backend/domain/space/space/dto/res/ResBodyForSpaceInviteList.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,10 +1,10 @@ | ||
| package org.tuna.zoopzoop.backend.domain.space.space.dto.res; | ||
|
|
||
| import org.tuna.zoopzoop.backend.domain.space.space.dto.etc.SpaceMembershipInfoWithoutAuthority; | ||
| import org.tuna.zoopzoop.backend.domain.space.space.dto.etc.SpaceInfoWithoutAuthority; | ||
|
|
||
| import java.util.List; | ||
|
|
||
| public record ResBodyForSpaceInviteList( | ||
| List<SpaceMembershipInfoWithoutAuthority> spaces | ||
| List<SpaceInfoWithoutAuthority> spaces | ||
| ) { | ||
| } |
4 changes: 2 additions & 2 deletions
4
src/main/java/org/tuna/zoopzoop/backend/domain/space/space/dto/res/ResBodyForSpaceList.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,10 +1,10 @@ | ||
| package org.tuna.zoopzoop.backend.domain.space.space.dto.res; | ||
|
|
||
| import org.tuna.zoopzoop.backend.domain.space.space.dto.etc.SpaceMembershipInfo; | ||
| import org.tuna.zoopzoop.backend.domain.space.space.dto.etc.SpaceInfo; | ||
|
|
||
| import java.util.List; | ||
|
|
||
| public record ResBodyForSpaceList( | ||
| List<SpaceMembershipInfo> spaces | ||
| List<SpaceInfo> spaces | ||
| ) { | ||
| } |
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
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.
This implementation causes an N+1 query problem. For each space in the page, a separate query is made to fetch members. Consider using a single query with JOIN FETCH or batch loading to retrieve all space members at once.
Uh oh!
There was an error while loading. Please reload this page.
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.
코파일럿 리뷰에도 적혀 있는데, 위 쿼리처럼 작동하면 아래와 같은 방식으로 작동될 것 같습니다.
즉, 사용자가 참가한 스페이스가 N개 일 경우 쿼리를 N+1번 실행하는 형태라, 대용량의 데이터 처리 시에는 유의미한 문제가 발생할 것 같습니다.
batch 쿼리 방식 등을 고려해보는 것도 좋을 것 같아요.