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

[Team03] 2주차 두 번째 PR 요청드립니다! #181

Merged
merged 6 commits into from Jun 24, 2022

Conversation

naneun
Copy link

@naneun naneun commented Jun 24, 2022

안녕하세요 로치~~ Biaco 입니다! 😁

이번 PR 에서 주로 작업한 내용은 API 를 제공하기 위한 간단한 배포 및 작성한 API 문서화 작업입니다 ㅎㅎ

벌써 마스터즈 코스 마지막 주말이네요.. 😭

코쿼에서 PR 메시지로 보내는 마지막 주말 인사라니..

즐거운 주말 보내세요 로치! ㅎㅎ

한 일

  • Issue 조회, 추가, 수정, 일괄 상태 변경, 일괄 삭제 기능 추가
  • Emoji 조회
  • Label, Milestone API 작성을 위한 사전 테스트 코드 작성

할 일

  • Comment, Label, Milestone 관련 API

@naneun naneun added the review-BE Improvements or additions to documentation label Jun 24, 2022
@naneun naneun requested a review from tmdgusya June 24, 2022 04:56
Copy link

@tmdgusya tmdgusya left a comment

Choose a reason for hiding this comment

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

고생하셨습니다. 몇가지 생각해볼 부분 생각해보시면 좋을 것 같아요

Comment on lines +42 to +64
mapper -> {
mapper.map(IssueAddRequest::getTitle, Issue::changeTitle);
mapper.map(IssueAddRequest::getContent, Issue::changeContent);
mapper.map(IssueAddRequest::getState, Issue::setState);
mapper.using((Converter<Long, Label>) converter ->
labelRepository.findById(converter.getSource())
.orElseThrow(LabelException::new)
)
.map(IssueAddRequest::getLabelId, Issue::changeLabel);

mapper.using((Converter<Long, Milestone>) converter ->
milestoneRepository.findById(converter.getSource())
.orElseThrow(MilestoneException::new)
)
.map(IssueAddRequest::getMilestoneId, Issue::changeMilestone);

mapper.using((Converter<Long, Member>) converter ->
memberRepository.findById(converter.getSource())
.orElseThrow(MemberException::new)
)
.map(IssueAddRequest::getAssigneeId, Issue::changeAssignee);
}
);

Choose a reason for hiding this comment

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

mapper 에서 repository layer 를 참조하는게 옳은 일인지 잘 모르겠어요.
mapper 에서는 단순 property 를 다른 property 랑 mapping 시켜주는게 역할인것 같아요.

코드를 단순화시키는게 좋아보입니다.


@Bean
public Docket swaggerApi() {
return new Docket(DocumentationType.SWAGGER_2)

Choose a reason for hiding this comment

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

Swagger 활용 좋네요

produces = "application/json",
response = IssueSimpleResponse.class
)
@GetMapping("/api/issues")

Choose a reason for hiding this comment

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

@RequestMapping("/api/issues") 를 클래스 상단에 적으면 불필요하게 /api/issues 를 중복해서 적는일이 줄어들 것 같네요.

/********************************************************************/

public Issue merge(Issue updated) {
if (!title.equals(updated.title)) {

Choose a reason for hiding this comment

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

굳이 이렇게 검사할 필요가 없지 않나요?
title = "a"
updated.title = "a" 일때
title = updated.title 한다고 해서 값이 바뀔것 같지는 않아서요

}

@Override
public List<Long> deleteById(List<Long> ids) {

Choose a reason for hiding this comment

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

ids 가 Label id 가 맞을까요?

public List<Long> deleteById(List<Long> ids) {

List<Issue> issues = ids.stream()
.map(issueRepository::findAllByLabelId)

Choose a reason for hiding this comment

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

Stream 순회하면서 계속해서 SELECT Query 를 발생시킬 것 같은데, 나중에 Query 최적화가 필요해보여요

@tmdgusya tmdgusya merged commit 53eb982 into codesquad-members-2022:team-03 Jun 24, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
review-BE Improvements or additions to documentation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants