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

YEL-181 [fix] 필드 추가 #400

Merged
merged 1 commit into from
Jan 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/docs/asciidoc/check-user-v2.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ include::{snippets}/api/v2/user/http-response.adoc[]
- "ticketCount": Integer
- "point": Integer
- "subscribe": "normal" | "active" | "canceled"
- "yelloCount": Integer
- "friendCount": Integer

=== Note

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,12 @@ public record UserDetailV2Response(
Long recommendCount,
Integer ticketCount,
Integer point,
String subscribe
String subscribe,
Integer yelloCount,
Integer friendCount
) {

public static UserDetailV2Response of(User user, UserGroup userGroup) {
public static UserDetailV2Response of(User user, UserGroup userGroup, Integer yelloCount, Integer friendCount) {
return UserDetailV2Response.builder()
.userId(user.getId())
.name(user.getName())
Expand All @@ -50,6 +52,8 @@ public static UserDetailV2Response of(User user, UserGroup userGroup) {
.ticketCount(user.getTicketCount())
.point(user.getPoint())
.subscribe(user.getSubscribe().getIntial())
.yelloCount(yelloCount)
.friendCount(friendCount)
.build();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,10 @@ public UserDetailResponse findMyProfile(Long userId) {

public UserDetailV2Response getUserDetailV2(Long userId) {
final User user = userRepository.getById(userId);
return UserDetailV2Response.of(user, user.getGroup());
final Integer yelloCount = voteRepository.countAllByReceiverUserId(user.getId());
final Integer friendCount = friendRepository.findAllByUserId(user.getId()).size();

return UserDetailV2Response.of(user, user.getGroup(), yelloCount, friendCount);
}

public UserResponse findUserById(Long userId) {
Expand Down
12 changes: 10 additions & 2 deletions src/main/resources/static/docs/check-user-v2.html
Original file line number Diff line number Diff line change
Expand Up @@ -483,7 +483,9 @@ <h3 id="_응답">응답</h3>
"recommendCount" : 0,
"ticketCount" : 0,
"point" : 200,
"subscribe" : "normal"
"subscribe" : "normal",
"yelloCount" : 100,
"friendCount" : 200
}
}</code></pre>
</div>
Expand Down Expand Up @@ -547,6 +549,12 @@ <h3 id="_응답">응답</h3>
<li>
<p>"subscribe": "normal" | "active" | "canceled"</p>
</li>
<li>
<p>"yelloCount": Integer</p>
</li>
<li>
<p>"friendCount": Integer</p>
</li>
</ul>
</div>
</div>
Expand Down Expand Up @@ -585,7 +593,7 @@ <h3 id="_changelog">CHANGELOG</h3>
<div id="footer">
<div id="footer-text">
Version 0.0.1-SNAPSHOT<br>
Last updated 2024-01-09 21:46:17 +0900
Last updated 2024-01-12 02:09:30 +0900
</div>
</div>
</body>
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/static/docs/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -643,7 +643,7 @@ <h3 id="_notice_api"><a class="link" href="#_notice_api">Notice API</a></h3>
<div id="footer">
<div id="footer-text">
Version 0.0.1-SNAPSHOT<br>
Last updated 2024-01-10 00:06:17 +0900
Last updated 2024-01-12 00:28:30 +0900
</div>
</div>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.15.6/styles/github.min.css">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ void init() {
@Test
void 내_정보_조회_V2에_성공합니다() throws Exception {
// given
UserDetailV2Response response = UserDetailV2Response.of(user, user.getGroup());
UserDetailV2Response response = UserDetailV2Response.of(user, user.getGroup(), 100, 200);

given(userService.getUserDetailV2(anyLong()))
.willReturn(response);
Expand Down