-
Notifications
You must be signed in to change notification settings - Fork 0
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
[LIME-33] 아이템 폴더 목록 조회 추가 및 기존 기능 수정 #6
Merged
Merged
Changes from 9 commits
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
fbd51c8
feat: 멤버 아이템 폴더 커서 조회 기능 추가
Curry4182 86c3aa6
test: 아이템 빌더 폴더 아이디 추가
Curry4182 1483acf
test: 아이템 관련 도메인 테스트 할 경우 폴더 아이디 추가
Curry4182 7c1b9e3
feat: 멤버 아이템 폴더 도메인 추가
Curry4182 b2a3de8
feat: 도메인 모듈에 멤버 아이템 폴더 조회 기능 추가
Curry4182 70c0043
feat: 아이템 엔티티에 폴더 id 추가
Curry4182 67641db
feat: 아이템 엔티티에 폴더 id 추가로 인한 기존 api 수정
Curry4182 8881d58
feat: 아이템 엔티티에 폴더 id 추가로 인한 기존 api 수정
Curry4182 2dff796
test: hobby 변경으로 인한 기존 테스트 변경
Curry4182 90e8831
remove: 아이템 등록할 경우 나의 아이템 추가 기능 삭제
Curry4182 e2c7d6e
feat: folder id를 기존 Item 엔티티에서 MemberItem으로 변경
Curry4182 ce39907
remove: 아이템 관련 기능에서 folder id 가 있는 기능 삭제
Curry4182 fcf30c4
feat: 멤버 아이템과 관련된 로직에 folder id 추가
Curry4182 1edb16f
fixture: 멤버 아이템 폴더 추가 테스트를 위한 fixture 추가
Curry4182 19b8114
test: 멤버 아이템 폴더 id 변경으로 인한 테스트 수정
Curry4182 0efbed5
refactor: 작성하지 않아도 되는 sql 쿼리 삭제
Curry4182 1d29d62
docs: 스웨거 상세 설명 수정
Curry4182 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
21 changes: 21 additions & 0 deletions
21
...in/java/com/programmers/lime/domains/item/api/dto/response/FolderGetByCursorResponse.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,21 @@ | ||
package com.programmers.lime.domains.item.api.dto.response; | ||
|
||
import java.util.List; | ||
|
||
import com.programmers.lime.domains.item.application.dto.FolderGetByCursorServiceResponse; | ||
import com.programmers.lime.domains.item.model.MemberItemFolderCursorSummary; | ||
|
||
public record FolderGetByCursorResponse( | ||
String nextCursorId, | ||
int totalCount, | ||
List<MemberItemFolderCursorSummary> summaries | ||
) { | ||
|
||
public static FolderGetByCursorResponse from(final FolderGetByCursorServiceResponse response) { | ||
return new FolderGetByCursorResponse( | ||
response.cursorSummary().nextCursorId(), | ||
response.folderTotalCount(), | ||
response.cursorSummary().summaries() | ||
); | ||
} | ||
} |
30 changes: 30 additions & 0 deletions
30
...m/programmers/lime/domains/item/api/dto/response/MemberItemFolderGetByCursorResponse.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,30 @@ | ||
package com.programmers.lime.domains.item.api.dto.response; | ||
|
||
import java.util.List; | ||
|
||
import com.programmers.lime.common.cursor.CursorSummary; | ||
import com.programmers.lime.domains.item.application.dto.MemberItemFolderGetServiceResponse; | ||
import com.programmers.lime.domains.item.model.MemberItemFolderCursorSummary; | ||
|
||
public record MemberItemFolderGetByCursorResponse ( | ||
|
||
String nextCursorId, | ||
|
||
int totalMemberItemFolderCount, | ||
|
||
int totalCount, | ||
|
||
List<MemberItemFolderCursorSummary> memberItemFolderCursorSummaries | ||
) { | ||
|
||
public static MemberItemFolderGetByCursorResponse from(final MemberItemFolderGetServiceResponse serviceResponse) { | ||
CursorSummary<MemberItemFolderCursorSummary> cursorSummary = serviceResponse.memberItemFolderSummarySummary(); | ||
|
||
return new MemberItemFolderGetByCursorResponse( | ||
cursorSummary.nextCursorId(), | ||
serviceResponse.totalMemberItemFolderCount(), | ||
cursorSummary.summaryCount(), | ||
cursorSummary.summaries() | ||
); | ||
} | ||
} |
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
10 changes: 10 additions & 0 deletions
10
...a/com/programmers/lime/domains/item/application/dto/FolderGetByCursorServiceResponse.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,10 @@ | ||
package com.programmers.lime.domains.item.application.dto; | ||
|
||
import com.programmers.lime.common.cursor.CursorSummary; | ||
import com.programmers.lime.domains.item.model.MemberItemFolderCursorSummary; | ||
|
||
public record FolderGetByCursorServiceResponse( | ||
int folderTotalCount, | ||
CursorSummary<MemberItemFolderCursorSummary> cursorSummary | ||
) { | ||
} |
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 |
---|---|---|
|
@@ -4,6 +4,7 @@ | |
|
||
public record ItemEnrollServiceRequest( | ||
Hobby hobby, | ||
String itemUrl | ||
String itemUrl, | ||
Long folderId | ||
) { | ||
} |
13 changes: 13 additions & 0 deletions
13
...com/programmers/lime/domains/item/application/dto/MemberItemFolderGetServiceResponse.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 com.programmers.lime.domains.item.application.dto; | ||
|
||
import com.programmers.lime.common.cursor.CursorSummary; | ||
import com.programmers.lime.domains.item.model.MemberItemFolderCursorSummary; | ||
import com.programmers.lime.domains.item.model.MemberItemFolderSummary; | ||
|
||
public record MemberItemFolderGetServiceResponse( | ||
|
||
CursorSummary<MemberItemFolderCursorSummary> memberItemFolderSummarySummary, | ||
int totalMemberItemFolderCount | ||
|
||
) { | ||
} |
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
46 changes: 46 additions & 0 deletions
46
lime-domain/src/main/java/com/programmers/lime/domains/item/domain/MemberItemFolder.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,46 @@ | ||
package com.programmers.lime.domains.item.domain; | ||
|
||
import java.util.Objects; | ||
|
||
import com.programmers.lime.common.model.Hobby; | ||
import com.programmers.lime.domains.BaseEntity; | ||
|
||
import jakarta.persistence.Column; | ||
import jakarta.persistence.Entity; | ||
import jakarta.persistence.EnumType; | ||
import jakarta.persistence.Enumerated; | ||
import jakarta.persistence.GeneratedValue; | ||
import jakarta.persistence.GenerationType; | ||
import jakarta.persistence.Id; | ||
import jakarta.persistence.Table; | ||
import lombok.AccessLevel; | ||
import lombok.Getter; | ||
import lombok.NoArgsConstructor; | ||
|
||
@Getter | ||
@NoArgsConstructor(access = AccessLevel.PROTECTED) | ||
@Entity | ||
@Table(name = "member_item_folders") | ||
public class MemberItemFolder extends BaseEntity { | ||
|
||
@Id | ||
@GeneratedValue(strategy = GenerationType.IDENTITY) | ||
@Column(name = "id") | ||
private Long id; | ||
|
||
@Column(name = "name", nullable = false) | ||
private String name; | ||
|
||
@Column(name = "member_id", nullable = false) | ||
private Long memberId; | ||
|
||
@Column(name = "hobby", nullable = false) | ||
@Enumerated(EnumType.STRING) | ||
private Hobby hobby; | ||
|
||
public MemberItemFolder(final String name, final Long memberId, final Hobby hobby) { | ||
this.name = Objects.requireNonNull(name); | ||
this.memberId = Objects.requireNonNull(memberId); | ||
this.hobby = Objects.requireNonNull(hobby); | ||
} | ||
} |
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
58 changes: 58 additions & 0 deletions
58
...rc/main/java/com/programmers/lime/domains/item/implementation/MemberItemFolderReader.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,58 @@ | ||
package com.programmers.lime.domains.item.implementation; | ||
|
||
import java.util.List; | ||
|
||
import org.springframework.stereotype.Component; | ||
import org.springframework.transaction.annotation.Transactional; | ||
|
||
import com.programmers.lime.common.cursor.CursorPageParameters; | ||
import com.programmers.lime.common.cursor.CursorSummary; | ||
import com.programmers.lime.common.cursor.CursorUtils; | ||
import com.programmers.lime.common.model.Hobby; | ||
import com.programmers.lime.domains.item.model.MemberItemFolderCursorSummary; | ||
import com.programmers.lime.domains.item.repository.MemberItemFolderRepository; | ||
|
||
import lombok.RequiredArgsConstructor; | ||
|
||
@Component | ||
@RequiredArgsConstructor | ||
@Transactional(readOnly = true) | ||
public class MemberItemFolderReader { | ||
|
||
private final MemberItemFolderRepository memberItemFolderRepository; | ||
private static final int DEFAULT_PAGE_SIZE = 20; | ||
|
||
public int countByMemberIdAndHobby( | ||
final Long memberId, | ||
final Hobby hobby | ||
) { | ||
return memberItemFolderRepository.countByHobbyAndMemberId(hobby, memberId); | ||
} | ||
|
||
public CursorSummary<MemberItemFolderCursorSummary> readMemberItemFolderByCursor( | ||
final Hobby hobby, | ||
final Long memberId, | ||
final CursorPageParameters parameters | ||
) { | ||
int size = getPageSize(parameters); | ||
List<MemberItemFolderCursorSummary> memberItemFoldersByCursor = | ||
memberItemFolderRepository.findMemberItemFoldersByCursor( | ||
memberId, | ||
hobby, | ||
parameters.cursorId(), | ||
size | ||
); | ||
|
||
return CursorUtils.getCursorSummaries(memberItemFoldersByCursor); | ||
} | ||
|
||
private int getPageSize(final CursorPageParameters parameters) { | ||
Integer parameterSize = parameters.size(); | ||
|
||
if (parameterSize == null) { | ||
return DEFAULT_PAGE_SIZE; | ||
} | ||
|
||
return parameterSize; | ||
} | ||
} |
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
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.
폴더 상세조회로 swagger 설명도 바꿔보면 좋을 것 같아요~