File tree Expand file tree Collapse file tree 3 files changed +33
-31
lines changed
src/main/java/com/sprint/mission/discodeit Expand file tree Collapse file tree 3 files changed +33
-31
lines changed Original file line number Diff line number Diff line change 1
1
package com .sprint .mission .discodeit .dto .User ;
2
2
3
3
import java .util .UUID ;
4
+ import lombok .Builder ;
4
5
6
+ @ Builder
5
7
public record UserResponse (
6
8
UUID id ,
7
9
String username ,
8
10
String email ,
9
11
boolean isOnline ,
10
- boolean profileImage
12
+ boolean hasProfileImage
11
13
) {
12
14
}
Original file line number Diff line number Diff line change @@ -59,23 +59,23 @@ public ChannelResponse find(ChannelFindRequest request) {
59
59
.toList ();
60
60
61
61
if (channel .getType ().equals (ChannelType .PUBLIC )) {
62
- return new ChannelResponse (
63
- channel .getId (),
64
- channel .getType (),
65
- channel .getName (),
66
- channel .getDescription (),
67
- recentMessageAt ,
68
- null
69
- );
62
+ return ChannelResponse . builder ()
63
+ . id ( channel .getId ())
64
+ . type ( channel .getType ())
65
+ . name ( channel .getName ())
66
+ . description ( channel .getDescription ())
67
+ . lastMessageAt ( recentMessageAt )
68
+ . participantIds ( null )
69
+ . build ( );
70
70
} else {
71
- return new ChannelResponse (
72
- channel .getId (),
73
- channel .getType (),
74
- channel .getName (),
75
- channel .getDescription (),
76
- recentMessageAt ,
77
- participantIds
78
- );
71
+ return ChannelResponse . builder ()
72
+ . id ( channel .getId ())
73
+ . type ( channel .getType ())
74
+ . name ( channel .getName ())
75
+ . description ( channel .getDescription ())
76
+ . lastMessageAt ( recentMessageAt )
77
+ . participantIds ( participantIds )
78
+ . build ( );
79
79
}
80
80
81
81
}
Original file line number Diff line number Diff line change @@ -71,13 +71,13 @@ public UserResponse find(UserFindRequest request) {
71
71
.map (status -> status .getUpdatedAt ().isAfter (Instant .now ().minusSeconds (300 )))
72
72
.orElse (false );
73
73
74
- return new UserResponse (
75
- user .getId (),
76
- user .getUsername (),
77
- user .getEmail (),
78
- isOnline ,
79
- user .isHasProfileImage ()
80
- );
74
+ return UserResponse . builder ()
75
+ . id ( user .getId ())
76
+ . username ( user .getUsername ())
77
+ . email ( user .getEmail ())
78
+ . isOnline ( isOnline )
79
+ . hasProfileImage ( user .isHasProfileImage () )
80
+ . build ( );
81
81
}
82
82
83
83
@ Override
@@ -88,13 +88,13 @@ public List<UserResponse> findAll() {
88
88
.map (status -> status .getUpdatedAt ().isAfter (Instant .now ().minusSeconds (300 )))
89
89
.orElse (false );
90
90
91
- return new UserResponse (
92
- user .getId (),
93
- user .getUsername (),
94
- user .getEmail (),
95
- isOnline ,
96
- user .isHasProfileImage ()
97
- );
91
+ return UserResponse . builder ()
92
+ . id ( user .getId ())
93
+ . username ( user .getUsername ())
94
+ . email ( user .getEmail ())
95
+ . isOnline ( isOnline )
96
+ . hasProfileImage ( user .isHasProfileImage () )
97
+ . build ( );
98
98
})
99
99
.toList ();
100
100
}
You can’t perform that action at this time.
0 commit comments