-
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
Conversation
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.
고생하셨습니다 👍 👍
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 기능을 이용하면 더 좋은 방식으로 불러올 수도 있을 것 같네요~
나중에 리팩토링 해봅시다~
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 comment
The reason will be displayed to describe this comment to others. Learn more.
[P2] 클린코드를 위해서는 else 예약어 사용을 지양하는 편이 좋다고 합니다!
위 코드는
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), ""); | |
} | |
if (background.endsWith(".jpg")) { | |
return new MypageNoteListResponseDto(note.getBook().getUuid(), note.getBook().getTitle(), | |
note.getId(), note.getContent(), | |
noteDate, -1, background); | |
} | |
return new MypageNoteListResponseDto(note.getBook().getUuid(), note.getBook().getTitle(), | |
note.getId(), note.getContent(), | |
noteDate, Integer.parseInt(background), ""); |
이렇게 바꿀 수 있겠네요 :)
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 comment
The reason will be displayed to describe this comment to others. Learn more.
[P3] DTO 리스트가 단일 필드로 들어가 있는거면 따로 감싸지 않고 그대로 반환하는 것은 어떤가요?
감싸는 것이 좋은 이유가 있다면 알려주세요~
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.
수고하셨습니당!~~
📌 관련 이슈
closed #11
✨ 어떤 이유로 변경된 내용인지
마이페이지 조회 api 를 구현했습니다.
마이페이지 내 레큐북 조회 api를 구현했습니다.
마이페이지 내 레큐노트 조회 api를 구현했습니다.
🙏 검토 혹은 리뷰어에게 남기고 싶은 말
Dto 이름 더 보기 좋은 것으로 추천해주세용 ~~~~~!!
아 노트 생성 부분 이미지랑 색으로 나눠버렸는데 다시 수정해야될 것 같아요 허허 - 수정완료 !!