-
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
[FEAT] 마이페이지 즐겨찾기 조회 API 구현 #79
Merged
Merged
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
9ce01f3
🐛 [MODIFY] 마이페이지 레큐북, 레뷰노트 조회에서 닉네임 제거 #78
eeddiinn 134f584
🐛 [MODIFY] 마이페이지 레큐북, 레큐노트 조회 Dto 수정 #78
eeddiinn 8c8595e
🐛 [MODIFY] 마이페이지 레큐북 조회에서 즐겨찾기 여부 알수 있도록 수정 #78
eeddiinn 29b6bdf
✨ [FEAT] 마이페이지 즐겨찾기 조회 API 구현 #78
eeddiinn 90a4a1c
:bug: [FIX] 인덴트 버그 수정 #79
ddongseop d47e16f
:bug: [FIX] 인덴트 버그 수정 #79
ddongseop 0fa8e0d
✨ [FEAT] 마이페이지 조회(닉네임) API 구현 #78
eeddiinn 3656d46
✨ [FEAT] 마이페이지 조회(닉네임) API 구현 #78
eeddiinn dec663c
♻️ [REFACTOR] 마이페이지 조회 로직 개선
dong2ast 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
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
48 changes: 36 additions & 12 deletions
48
src/main/java/org/sopt/lequuServer/domain/member/dto/response/MypageBookResponseDto.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 |
---|---|---|
@@ -1,26 +1,50 @@ | ||
package org.sopt.lequuServer.domain.member.dto.response; | ||
|
||
import static java.util.Comparator.comparing; | ||
|
||
import io.swagger.v3.oas.annotations.media.Schema; | ||
import java.time.format.DateTimeFormatter; | ||
import java.util.List; | ||
import org.sopt.lequuServer.domain.book.model.Book; | ||
|
||
import java.util.List; | ||
public record MypageBookResponseDto( | ||
|
||
import static java.util.Comparator.comparing; | ||
@Schema(description = "레큐북 고유 id", example = "1") | ||
Long bookId, | ||
|
||
public record MypageBookResponseDto( | ||
@Schema(description = "레큐북 UUID", example = "ee4f66f9-9cf4-4b28-90f4-f71d0ecba021") | ||
String bookUuid, | ||
|
||
@Schema(description = "레큐북 즐겨찾기 등록 여부", example = "true") | ||
Boolean isFavorite, | ||
|
||
@Schema(description = "최애 이름", example = "LeoJ") | ||
String favoriteName, | ||
|
||
@Schema(description = "유저 닉네임", example = "레큐") | ||
String memberNickname, | ||
@Schema(description = "레큐북 제목", example = "1번째 레큐북") | ||
String title, | ||
|
||
List<MypageBooksResponseDto> bookList | ||
@Schema(description = "레큐북 생성 일시", example = "2024.01.11") | ||
String bookDate, | ||
|
||
@Schema(description = "레큐노트 개수", example = "1974") | ||
int noteNum | ||
) { | ||
public static MypageBookResponseDto of(String nickName, List<Book> books) { | ||
public static List<MypageBookResponseDto> of(List<Book> books, List<Book> favoriteBooks) { | ||
|
||
List<MypageBooksResponseDto> bookList = books.stream() | ||
return books.stream() | ||
.sorted(comparing(Book::getCreatedAt).reversed()) | ||
.map(MypageBooksResponseDto::of) | ||
.map(book -> | ||
new MypageBookResponseDto( | ||
book.getId(), | ||
book.getUuid(), | ||
favoriteBooks.contains(book), | ||
book.getFavoriteName(), | ||
book.getTitle(), | ||
book.getCreatedAt().format(DateTimeFormatter.ofPattern("yyyy.MM.dd")), | ||
book.getNotes().size() | ||
) | ||
) | ||
.toList(); | ||
|
||
return new MypageBookResponseDto(nickName, bookList); | ||
} | ||
} | ||
} |
41 changes: 0 additions & 41 deletions
41
src/main/java/org/sopt/lequuServer/domain/member/dto/response/MypageBooksResponseDto.java
This file was deleted.
Oops, something went wrong.
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
41 changes: 0 additions & 41 deletions
41
src/main/java/org/sopt/lequuServer/domain/member/dto/response/MypageNotesResponseDto.java
This file was deleted.
Oops, something went wrong.
13 changes: 13 additions & 0 deletions
13
src/main/java/org/sopt/lequuServer/domain/member/dto/response/MypageResponseDto.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 org.sopt.lequuServer.domain.member.dto.response; | ||
|
||
import io.swagger.v3.oas.annotations.media.Schema; | ||
|
||
public record MypageResponseDto( | ||
|
||
@Schema(description = "유저 닉네임", example = "레큐") | ||
String memberNickname | ||
) { | ||
public static MypageResponseDto of(String nickName) { | ||
return new MypageResponseDto(nickName); | ||
} | ||
} |
Oops, something went wrong.
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.
[P3] DTO 단에서 트랜잭션(혹은 Database 서버와의 통신)이 발생하는 것이 좋을지 한번 고민해보는 것도 좋을 것 같습니다~
(3tier architecture와 계층 분리 측면에서 생각해보면 좋을 것 같아요~ 고민 결과 공유해주시면 감사하겠습니다 😊)