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

[BE] issue129: 원하는 갯수만큼 작성된 후기 조회 #136

Merged
merged 4 commits into from
Jul 29, 2022

Conversation

verus-j
Copy link
Collaborator

@verus-j verus-j commented Jul 26, 2022

resolve: #129

@verus-j verus-j added 🚀 feature New feature or request 🖥 backend New backend feature labels Jul 26, 2022
@verus-j verus-j self-assigned this Jul 26, 2022
Copy link
Collaborator

@tco0427 tco0427 left a comment

Choose a reason for hiding this comment

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

구현 고생하셨습니다👍
궁금한 사항과 몇가지 제안사항 코멘트로 남겨보았습니다!
CategoryIdRequestConverter에 대해서는 잘 모르겠어서 설명을 들어보고 싶습니다!

Comment on lines -23 to +24
@RequestParam(required = false) Integer size
@RequestParam(name = "size", required = false, defaultValue = "") SizeRequest sizeRequest
Copy link
Collaborator

Choose a reason for hiding this comment

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

SizeRequest 라는 DTO로 감싸주었군요..!!
기존의 @RequestParam(required = false) Integer size 와는 어떤 차이가 있는지 궁금합니다!!

Comment on lines +10 to +13
@Override
public SizeRequest convert(final String source) {
return source.isBlank() ? SizeRequest.empty() : new SizeRequest(Integer.parseInt(source));
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

음..빈 값을 포함한 요청일 때마다 Converter 가 추가된다면 관리가 힘들지 않을까하는 생각이 들어요..ㅠ.ㅠ🥲

Copy link
Collaborator

Choose a reason for hiding this comment

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

아래에도 CategoryIdConverter가 있던데 비슷한 처리를 할 때마다 Converter를 만드는 방법 이외에 더 좋은 방법은 없을까요?? 아니면 혹시 Converter가 꼭 필요한 이유가 있을까요?

Comment on lines +22 to +23
if (sizeRequest.isEmpty() || sizeRequest.isMoreThan(allReviews.size())) {
return new ReviewsResponse(allReviews);
Copy link
Collaborator

Choose a reason for hiding this comment

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

단순 Integer가 아닌 DTO로 관리하니 isMoreThan 과 같은 메소드 호라용이 가능하군요..!!

Comment on lines +35 to +38
private static final MemberData JJANGGU = new MemberData(1L, "jjanggu", "https://image", "github.com");
private static final MemberData GREENLAWN = new MemberData(2L, "greenlawn", "https://image", "github.com");
private static final MemberData DWOO = new MemberData(3L, "dwoo", "https://image", "github.com");
private static final MemberData VERUS = new MemberData(4L, "verus", "https://image", "github.com");
Copy link
Collaborator

Choose a reason for hiding this comment

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

자주 쓰이는 것 같아요!! Fixture로 빼도 될 것 같습니다!!

Comment on lines +124 to +127
private static Member toMember(MemberData memberData) {
return new Member(memberData.getGithubId(), memberData.getUsername(), memberData.getImageUrl(),
memberData.getProfileUrl());
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

메소드명과 parameter 를 보고 기능을 알 수 있을 것 같네요! (코드를 보지 않아도)
해당 메소드를 맨 아래로 내려도 괜찮을 것 같아요!

Copy link
Collaborator

@jaejae-yoo jaejae-yoo left a comment

Choose a reason for hiding this comment

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

베루스 구현하느라 고생하셨습니다 코멘트 확인 부탁드려요 ~

private final NamedParameterJdbcTemplate namedParameterJdbcTemplate;

public List<ReviewData> findAllByStudyId(final Long studyId) {
String sql = "SELECT r.id, r.content, r.created_date, r.last_modified_date, "
Copy link
Collaborator

Choose a reason for hiding this comment

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

r로 축약하지 않고 review로 선언해도 길이가 길 것 같지 않아서 더 명확하게 표현하는 것은 어떨까요 ?!

Copy link
Collaborator

Choose a reason for hiding this comment

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

저는 이 부분은 그렇게 나쁘다고 생각하지 않습니다! sql에서 review r, member m 자체가 테이블의 별칭을 지어주는건데 여기에 굳이 또 review를 하는 것은 의미가 없다고 생각해요!

private MockMvc mockMvc;

@MockBean
private ReviewService reviewService;
Copy link
Collaborator

Choose a reason for hiding this comment

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

요청 값 예외 확인을 위한 테스트 클래스라서, 선언해도 쓰이지 않을 빈일 것 같은데 제거해도 되지 않을까요 ?

Copy link
Collaborator

@sc0116 sc0116 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 +10 to +13
@Override
public SizeRequest convert(final String source) {
return source.isBlank() ? SizeRequest.empty() : new SizeRequest(Integer.parseInt(source));
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

아래에도 CategoryIdConverter가 있던데 비슷한 처리를 할 때마다 Converter를 만드는 방법 이외에 더 좋은 방법은 없을까요?? 아니면 혹시 Converter가 꼭 필요한 이유가 있을까요?

private final NamedParameterJdbcTemplate namedParameterJdbcTemplate;

public List<ReviewData> findAllByStudyId(final Long studyId) {
String sql = "SELECT r.id, r.content, r.created_date, r.last_modified_date, "
Copy link
Collaborator

Choose a reason for hiding this comment

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

저는 이 부분은 그렇게 나쁘다고 생각하지 않습니다! sql에서 review r, member m 자체가 테이블의 별칭을 지어주는건데 여기에 굳이 또 review를 하는 것은 의미가 없다고 생각해요!


public boolean isMoreThan(int value) {
if (isEmpty()) {
throw new IllegalStateException("SizeRequest에 value가 null 입니다.");
Copy link
Collaborator

Choose a reason for hiding this comment

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

BadRequestException을 상속하는 예외 클래스를 만들어도 좋을 것 같아요

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

500 응답을 던지도록 ControllerAdvice 수정


public boolean isMoreThan(int value) {
if (isEmpty()) {
throw new IllegalStateException("SizeRequest에 value가 null 입니다.");
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

500 응답을 던지도록 ControllerAdvice 수정

Comment on lines 23 to 25
private String createdDate;
private String lastModifiedDate;
private String content;
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

LocalDate 로 변경

@tco0427 tco0427 merged commit 966fd67 into develop Jul 29, 2022
@tco0427 tco0427 deleted the feat/129-get-reviews-by-size branch July 29, 2022 06:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🖥 backend New backend feature 🚀 feature New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants