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
[Team03] 2주차 두 번째 PR 요청드립니다! #181
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.
고생하셨습니다. 몇가지 생각해볼 부분 생각해보시면 좋을 것 같아요
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); | ||
} | ||
); |
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.
mapper
에서 repository layer 를 참조하는게 옳은 일인지 잘 모르겠어요.
mapper
에서는 단순 property 를 다른 property 랑 mapping 시켜주는게 역할인것 같아요.
코드를 단순화시키는게 좋아보입니다.
|
||
@Bean | ||
public Docket swaggerApi() { | ||
return new Docket(DocumentationType.SWAGGER_2) |
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.
Swagger 활용 좋네요
produces = "application/json", | ||
response = IssueSimpleResponse.class | ||
) | ||
@GetMapping("/api/issues") |
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.
@RequestMapping("/api/issues")
를 클래스 상단에 적으면 불필요하게 /api/issues
를 중복해서 적는일이 줄어들 것 같네요.
/********************************************************************/ | ||
|
||
public Issue merge(Issue updated) { | ||
if (!title.equals(updated.title)) { |
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.
굳이 이렇게 검사할 필요가 없지 않나요?
title = "a"
updated.title = "a" 일때
title = updated.title 한다고 해서 값이 바뀔것 같지는 않아서요
} | ||
|
||
@Override | ||
public List<Long> deleteById(List<Long> ids) { |
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.
ids
가 Label id 가 맞을까요?
public List<Long> deleteById(List<Long> ids) { | ||
|
||
List<Issue> issues = ids.stream() | ||
.map(issueRepository::findAllByLabelId) |
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.
Stream 순회하면서 계속해서 SELECT Query 를 발생시킬 것 같은데, 나중에 Query 최적화가 필요해보여요
안녕하세요 로치~~ Biaco 입니다! 😁
이번 PR 에서 주로 작업한 내용은 API 를 제공하기 위한 간단한 배포 및 작성한 API 문서화 작업입니다 ㅎㅎ
벌써 마스터즈 코스 마지막 주말이네요.. 😭
코쿼에서 PR 메시지로 보내는 마지막 주말 인사라니..
즐거운 주말 보내세요 로치! ㅎㅎ
한 일
할 일