-
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 구현 #43
Merged
Merged
Changes from 5 commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
06df779
✨ [FEAT] 마이페이지 레큐북 조회 API 구현 #11
eeddiinn 6823b66
✨ [FEAT] 마이페이지 레큐노트 조회 API 구현 & Note background 수정 #11
eeddiinn bcb2896
✏️ [FIX] 레큐노트 생성 일시 날짜 형식 수정 #11
eeddiinn 2af8b4a
✏️ [FIX] 레큐북 생성 일시 날짜 형식 간결하게 수정 #11
eeddiinn 4ceebcb
🐛 [FIX] background 다시 수정 #11
eeddiinn 2319b2e
♻️ [REFACTOR] Dto 하나로 수정 #11
eeddiinn 301ff1e
🐛 [FIX] 파일 삭제 #11
eeddiinn 9147410
✏️ [FIX] if 문 수정 #11
eeddiinn 40527c2
:rocket: [DEPLOY] CI 재시도
ddongseop b42aed9
Merge branch 'develop' into feat/#11-mypage_get_api
ddongseop 649d5ae
:twisted_rightwards_arrows: [MERGE] merge 오류 해결
ddongseop 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
31 changes: 31 additions & 0 deletions
31
src/main/java/org/sopt/lequuServer/domain/member/dto/response/MypageBookListResponseDto.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,31 @@ | ||
package org.sopt.lequuServer.domain.member.dto.response; | ||
|
||
import org.sopt.lequuServer.domain.book.model.Book; | ||
|
||
import java.time.LocalDateTime; | ||
import java.time.format.DateTimeFormatter; | ||
|
||
public record MypageBookListResponseDto( | ||
|
||
Long bookId, | ||
String bookUuid, | ||
String title, | ||
String bookDate, | ||
int bookBackgroundColor, | ||
|
||
int noteNum | ||
) { | ||
public static MypageBookListResponseDto of(Book book) { | ||
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy.MM.dd"); | ||
String bookDate = book.getCreatedAt().format(formatter); | ||
|
||
return new MypageBookListResponseDto( | ||
book.getId(), | ||
book.getUuid(), | ||
book.getTitle(), | ||
bookDate, | ||
book.getBackgroundColor(), | ||
book.getNotes().size() | ||
); | ||
} | ||
} |
18 changes: 18 additions & 0 deletions
18
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 |
---|---|---|
@@ -0,0 +1,18 @@ | ||
package org.sopt.lequuServer.domain.member.dto.response; | ||
|
||
import org.sopt.lequuServer.domain.book.model.Book; | ||
|
||
import java.util.List; | ||
|
||
public record MypageBookResponseDto( | ||
String memberNickname, | ||
List<MypageBookListResponseDto> mypageBookList | ||
) { | ||
public static MypageBookResponseDto of(String nickName, List<Book> books) { | ||
List<MypageBookListResponseDto> mypageBookList = books.stream() | ||
.map(MypageBookListResponseDto::of) | ||
.toList(); | ||
|
||
return new MypageBookResponseDto(nickName, mypageBookList); | ||
} | ||
} |
32 changes: 32 additions & 0 deletions
32
src/main/java/org/sopt/lequuServer/domain/member/dto/response/MypageNoteListResponseDto.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,32 @@ | ||||||||||||||||||||||||||||||||||||
package org.sopt.lequuServer.domain.member.dto.response; | ||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||
import org.sopt.lequuServer.domain.note.model.Note; | ||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||
import java.time.format.DateTimeFormatter; | ||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||
public record MypageNoteListResponseDto( | ||||||||||||||||||||||||||||||||||||
String bookUuid, | ||||||||||||||||||||||||||||||||||||
String title, | ||||||||||||||||||||||||||||||||||||
Long noteId, | ||||||||||||||||||||||||||||||||||||
String content, | ||||||||||||||||||||||||||||||||||||
String noteDate, | ||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||
int noteBackgroundColor, | ||||||||||||||||||||||||||||||||||||
String noteBackgroundImage | ||||||||||||||||||||||||||||||||||||
) { | ||||||||||||||||||||||||||||||||||||
public static MypageNoteListResponseDto of(Note note) { | ||||||||||||||||||||||||||||||||||||
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy.MM.dd"); | ||||||||||||||||||||||||||||||||||||
String noteDate = note.getCreatedAt().format(formatter); | ||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||
String background = note.getBackground(); | ||||||||||||||||||||||||||||||||||||
if (background.endsWith(".jpg")) { | ||||||||||||||||||||||||||||||||||||
return new MypageNoteListResponseDto(note.getBook().getUuid(), note.getBook().getTitle(), | ||||||||||||||||||||||||||||||||||||
note.getId(), note.getContent(), | ||||||||||||||||||||||||||||||||||||
noteDate, -1, background); | ||||||||||||||||||||||||||||||||||||
} else { | ||||||||||||||||||||||||||||||||||||
return new MypageNoteListResponseDto(note.getBook().getUuid(), note.getBook().getTitle(), | ||||||||||||||||||||||||||||||||||||
note.getId(), note.getContent(), | ||||||||||||||||||||||||||||||||||||
noteDate, Integer.parseInt(background), ""); | ||||||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [P2] 클린코드를 위해서는 else 예약어 사용을 지양하는 편이 좋다고 합니다!
Suggested change
이렇게 바꿀 수 있겠네요 :) |
||||||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||||||
} |
19 changes: 19 additions & 0 deletions
19
src/main/java/org/sopt/lequuServer/domain/member/dto/response/MypageNoteResponseDto.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,19 @@ | ||
package org.sopt.lequuServer.domain.member.dto.response; | ||
|
||
import org.sopt.lequuServer.domain.note.model.Note; | ||
|
||
import java.util.List; | ||
import java.util.stream.Collectors; | ||
|
||
public record MypageNoteResponseDto( | ||
|
||
List<MypageNoteListResponseDto> mypageNoteList | ||
) { | ||
public static MypageNoteResponseDto of(List<Note> notes) { | ||
List<MypageNoteListResponseDto> mypageNoteList = notes.stream() | ||
.map(MypageNoteListResponseDto::of) | ||
.collect(Collectors.toList()); | ||
|
||
return new MypageNoteResponseDto(mypageNoteList); | ||
} | ||
} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [P3] DTO 리스트가 단일 필드로 들어가 있는거면 따로 감싸지 않고 그대로 반환하는 것은 어떤가요? |
3 changes: 2 additions & 1 deletion
3
src/main/java/org/sopt/lequuServer/domain/member/repository/MemberRepository.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
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
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.
[P3] QueryDSL 기능을 이용하면 더 좋은 방식으로 불러올 수도 있을 것 같네요~
나중에 리팩토링 해봅시다~