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

GETP-301 feat: 피플 목록 조회 모자이크 기능 추가 #174

Merged
merged 8 commits into from
Oct 13, 2024

Conversation

wlgns12370
Copy link
Member

✨ 구현한 기능

  • 피플 목록 조회 모자이크 기능 추가

📢 논의하고 싶은 내용

  • test 코드에서 모자이크 전후의 값의 길이를 비교합니다. 이때 DTO에 사용자 정의 타입을 사용하고 있기 때문에, assertSoftly로 묶어두었습니다. 매개 변수명을 타입에 맞게 작성하여 가독성을 높이는 방법으로 작성하는 게 어떨까요?
  • assertSoftly로 합치는 과정에서 중복되는 DTO 타입이 발생한다면, Util 클래스로 묶는 작업도 해보는 게 어떨까요?

🎸 기타

  • List<String> mosaicMessage 오버 로딩 메서드를 MosaicResolverSupport 에 추가하였습니다.

Copy link

github-actions bot commented Oct 13, 2024

Test Results

151 tests  ±0   151 ✅ ±0   19s ⏱️ +5s
 93 suites +1     0 💤 ±0 
 93 files   +1     0 ❌ ±0 

Results for commit 211e6bd. ± Comparison against base commit 9b56396.

♻️ This comment has been updated with latest results.

@scv1702
Copy link
Member

scv1702 commented Oct 13, 2024

모자이크를 수행하는 객체마다 assertSoftly를 수행하는 메소드를 만들고, 이를 테스트 메소드에서 조립하는 방식으로 하면 가독성이 좋을 것 같아요!

if (member.isPeople()) {
return null;
}
return repository.existsByMemberIdAndPeopleId(
Copy link
Member

Choose a reason for hiding this comment

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

member가 null이 아니면 existsBy(memberId, ...)를 호출하는건 어떨까요?

final Education education = mosaicEducation(mosaicResponse.getEducation());
final List<String> techStacks = mosaicMessage(mosaicResponse.getHashtags());
final List<PortfolioResponse> portfolios = mosaicPortfolioResponse(mosaicResponse.getPortfolios());
mosaicResponse.mosaic(introduction, activityArea, education, techStacks, portfolios);
Copy link
Member

Choose a reason for hiding this comment

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

PeopleProfileDetailResponse의 mosaic()도 this를 반환하도록 통일하는건 어떨까요?

Comment on lines 66 to 93
assertSoftly(peopleProfile -> {
peopleProfile.assertThat(mosaicResponse.getProfile().getIntroduction()).hasSameSizeAs(response.getProfile().getIntroduction());
peopleProfile.assertThat(mosaicResponse.getProfile().getActivityArea()).hasSameSizeAs(response.getProfile().getActivityArea());
peopleProfile.assertThat(mosaicResponse.getProfile().getTechStacks())
.extracting(String::length)
.containsExactlyElementsOf(response.getProfile().getTechStacks()
.stream()
.map(String::length)
.toList());
assertSoftly(education -> {
education.assertThat(mosaicResponse.getProfile().getEducation().getMajor()).hasSameSizeAs(response.getProfile().getEducation().getMajor());
education.assertThat(mosaicResponse.getProfile().getEducation().getSchool()).hasSameSizeAs(response.getProfile().getEducation().getSchool());
});
assertSoftly(portfolios -> {
portfolios.assertThat(mosaicResponse.getProfile().getPortfolios())
.extracting(portfolio -> portfolio.description().length())
.containsExactlyElementsOf(response.getProfile().getPortfolios()
.stream()
.map(portfolio -> portfolio.description().length())
.toList());
portfolios.assertThat(mosaicResponse.getProfile().getPortfolios())
.extracting(portfolio -> portfolio.url().length())
.containsExactlyElementsOf(response.getProfile().getPortfolios()
.stream()
.map(portfolio -> portfolio.url().length())
.toList());
});
});
Copy link
Member

Choose a reason for hiding this comment

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

내부에 중첩된 assertSoftly는 메소드로 추출해서 가독성을 살리면 좋을 것 같아요.

Comment on lines 40 to 57
assertSoftly(projectDetailResponse -> {
projectDetailResponse.assertThat(mosaicResponse.getDescription()).hasSameSizeAs(response.getDescription());
projectDetailResponse.assertThat(mosaicResponse.getAttachmentFiles())
.extracting(String::length)
.containsExactlyElementsOf(response.getAttachmentFiles()
.stream()
.map(String::length)
.toList());
assertSoftly(client -> {
client.assertThat(mosaicResponse.getClient().clientId()).isEqualTo(null);
client.assertThat(mosaicResponse.getClient().nickname()).hasSameSizeAs(response.getClient().nickname());
assertSoftly(address -> {
address.assertThat(mosaicResponse.getClient().address().zipcode()).hasSameSizeAs(response.getClient().address().zipcode());
address.assertThat(mosaicResponse.getClient().address().detail()).hasSameSizeAs(response.getClient().address().detail());
address.assertThat(mosaicResponse.getClient().address().street()).hasSameSizeAs(response.getClient().address().street());
});
});
});
Copy link
Member

Choose a reason for hiding this comment

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

마찬가지로 중첩된 assertSoftly는 메소드로 추출하면 좋을 것 같아요!

@wlgns12370
Copy link
Member Author

반영 완료했습니다!

Copy link
Member

@scv1702 scv1702 left a comment

Choose a reason for hiding this comment

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

굳!

@scv1702 scv1702 merged commit fa35933 into develop Oct 13, 2024
2 checks passed
@scv1702 scv1702 deleted the feature/GETP-301 branch October 13, 2024 09:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants