Skip to content
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 11 commits into from
Jan 11, 2024
Merged

Conversation

eeddiinn
Copy link
Contributor

@eeddiinn eeddiinn commented Jan 10, 2024

📌 관련 이슈

closed #11

✨ 어떤 이유로 변경된 내용인지

  • 마이페이지 조회 api 를 구현했습니다.

  • 마이페이지 내 레큐북 조회 api를 구현했습니다.

    • 레큐북 생성 일시를 "yyyy.MM.dd" 형식으로 표현하였습니다.
    • 레큐북이 가지고 있는 레큐노트들의 개수를 size()를 통해 가져왔습니다.

  • 마이페이지 내 레큐노트 조회 api를 구현했습니다.

    • 레큐노트 생성 일시를 "yyyy.MM.dd" 형식으로 표현하였습니다.
    • 레큐노트의 배경이 색 (흰색 or 검정색) 또는 이미지(jpg)여서noteBackgroundColor, noteBackgroundImage로 분리하였습니다.
    • 레큐노트를 기준으로 레큐노트가 속해있는 레큐북의 Uuid와 레큐북의 제목을 가져올 수 있도록 코드를 작성하였습니다.

🙏 검토 혹은 리뷰어에게 남기고 싶은 말

Dto 이름 더 보기 좋은 것으로 추천해주세용 ~~~~~!!
아 노트 생성 부분 이미지랑 색으로 나눠버렸는데 다시 수정해야될 것 같아요 허허 - 수정완료 !!

@eeddiinn eeddiinn added 🪄API 서버 API 통신 ✨Feat 새로운 기능 추가 예진❄️ 🔥 Pull Request PR 날림 labels Jan 10, 2024
@eeddiinn eeddiinn self-assigned this Jan 10, 2024
@eeddiinn eeddiinn changed the title [FEAT} 마이페이지 조회 API 구 [FEAT} 마이페이지 조회 API 구현 Jan 10, 2024
Copy link
Contributor

@dong2ast dong2ast left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

고생하셨습니다 👍 👍

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[P3] QueryDSL 기능을 이용하면 더 좋은 방식으로 불러올 수도 있을 것 같네요~
나중에 리팩토링 해봅시다~

Comment on lines 22 to 30
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), "");
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[P2] 클린코드를 위해서는 else 예약어 사용을 지양하는 편이 좋다고 합니다!
위 코드는

Suggested change
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), "");

이렇게 바꿀 수 있겠네요 :)

Comment on lines 8 to 19
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);
}
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[P3] DTO 리스트가 단일 필드로 들어가 있는거면 따로 감싸지 않고 그대로 반환하는 것은 어떤가요?
감싸는 것이 좋은 이유가 있다면 알려주세요~

@ddongseop ddongseop changed the title [FEAT} 마이페이지 조회 API 구현 [FEAT] 마이페이지 조회 API 구현 Jan 10, 2024
Copy link
Member

@ddongseop ddongseop left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

수고하셨습니당!~~

@eeddiinn eeddiinn merged commit 70eb73c into develop Jan 11, 2024
1 check passed
@eeddiinn eeddiinn deleted the feat/#11-mypage_get_api branch January 11, 2024 07:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
예진❄️ 🪄API 서버 API 통신 ✨Feat 새로운 기능 추가 🔥 Pull Request PR 날림
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[FEAT] 마이페이지 조회 API 구현
3 participants