Skip to content

Commit 736dd53

Browse files
committed
fix: 테스트 통과 위한 dto와 수반되는 로직 추가
1 parent b764d3b commit 736dd53

File tree

2 files changed

+36
-4
lines changed

2 files changed

+36
-4
lines changed
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
package com.example.log4u.domain.user.dto;
2+
3+
import com.example.log4u.domain.user.entity.User;
4+
5+
import lombok.Builder;
6+
7+
@Builder
8+
public record UserProfileResponseDto(
9+
String name,
10+
String nickname,
11+
String statusMessage,
12+
String profileImage,
13+
Long diaryCount,
14+
Long followers,
15+
Long followings
16+
) {
17+
18+
public static UserProfileResponseDto fromUser(
19+
User user,
20+
Long diaryCount,
21+
Long followers,
22+
Long followings
23+
) {
24+
return builder()
25+
.name(user.getName())
26+
.nickname(user.getNickname())
27+
.statusMessage(user.getStatusMessage())
28+
.profileImage(user.getProfileImage())
29+
.diaryCount(diaryCount)
30+
.followers(followers)
31+
.followings(followings)
32+
.build();
33+
}
34+
}

src/main/java/com/example/log4u/domain/user/service/UserService.java

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,7 @@ public UserProfileResponseDto getMyProfile(Long userId) {
2727
me,
2828
0L,
2929
0L,
30-
0L,
31-
null
30+
0L
3231
);
3332
}
3433

@@ -39,8 +38,7 @@ public UserProfileResponseDto getUserProfile(String nickname) {
3938
user,
4039
0L,
4140
0L,
42-
0L,
43-
null
41+
0L
4442
);
4543
}
4644

0 commit comments

Comments
 (0)