-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
[FEAT] 마이페이지 즐겨찾기 조회 API 구현
- Loading branch information
Showing
11 changed files
with
175 additions
and
143 deletions.
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.