9
9
import net .teumteum .meeting .domain .Topic ;
10
10
import net .teumteum .meeting .domain .request .CreateMeetingRequest ;
11
11
import net .teumteum .meeting .domain .request .UpdateMeetingRequest ;
12
- import net .teumteum .meeting .domain .response .MeetingParticipantsResponse ;
12
+ import net .teumteum .meeting .domain .response .MeetingParticipantResponse ;
13
13
import net .teumteum .meeting .domain .response .MeetingResponse ;
14
14
import net .teumteum .meeting .domain .response .MeetingsResponse ;
15
15
import net .teumteum .meeting .model .PageDto ;
@@ -43,14 +43,14 @@ public class MeetingController {
43
43
public MeetingResponse createMeeting (
44
44
@ RequestPart @ Valid CreateMeetingRequest meetingRequest ,
45
45
@ RequestPart List <MultipartFile > images ) {
46
- Long userId = securityService . getCurrentUserId ();
46
+ Long userId = getCurrentUserId ();
47
47
return meetingService .createMeeting (images , meetingRequest , userId );
48
48
}
49
49
50
50
@ GetMapping ("/{meetingId}" )
51
51
@ ResponseStatus (HttpStatus .OK )
52
52
public MeetingResponse getMeetingById (@ PathVariable ("meetingId" ) Long meetingId ) {
53
- Long userId = securityService . getCurrentUserId ();
53
+ Long userId = getCurrentUserId ();
54
54
return meetingService .getMeetingById (meetingId , userId );
55
55
}
56
56
@@ -64,7 +64,7 @@ public PageDto<MeetingsResponse> getMeetingsByCondition(
64
64
@ RequestParam (value = "participantUserId" , required = false ) Long participantUserId ,
65
65
@ RequestParam (value = "isBookmarked" , required = false ) Boolean isBookmarked ,
66
66
@ RequestParam (value = "searchWord" , required = false ) String searchWord ) {
67
- Long userId = securityService . getCurrentUserId ();
67
+ Long userId = getCurrentUserId ();
68
68
return meetingService .getMeetingsBySpecification (pageable , topic , meetingAreaStreet , participantUserId ,
69
69
searchWord , isBookmarked , isOpen , userId );
70
70
}
@@ -74,55 +74,56 @@ public PageDto<MeetingsResponse> getMeetingsByCondition(
74
74
public MeetingResponse updateMeeting (@ PathVariable Long meetingId ,
75
75
@ RequestPart @ Valid UpdateMeetingRequest request ,
76
76
@ RequestPart List <MultipartFile > images ) {
77
- Long userId = securityService . getCurrentUserId ();
77
+ Long userId = getCurrentUserId ();
78
78
return meetingService .updateMeeting (meetingId , images , request , userId );
79
79
}
80
80
81
81
@ DeleteMapping ("/{meetingId}" )
82
82
@ ResponseStatus (HttpStatus .OK )
83
83
public void deleteMeeting (@ PathVariable ("meetingId" ) Long meetingId ) {
84
- Long userId = securityService . getCurrentUserId ();
84
+ Long userId = getCurrentUserId ();
85
85
meetingService .deleteMeeting (meetingId , userId );
86
86
}
87
87
88
88
@ PostMapping ("/{meetingId}/participants" )
89
89
@ ResponseStatus (HttpStatus .CREATED )
90
90
public MeetingResponse addParticipant (@ PathVariable ("meetingId" ) Long meetingId ) {
91
- Long userId = securityService . getCurrentUserId ();
91
+ Long userId = getCurrentUserId ();
92
92
return meetingService .addParticipant (meetingId , userId );
93
93
}
94
94
95
95
@ DeleteMapping ("/{meetingId}/participants" )
96
96
@ ResponseStatus (HttpStatus .OK )
97
97
public void deleteParticipant (@ PathVariable ("meetingId" ) Long meetingId ) {
98
- Long userId = securityService . getCurrentUserId ();
98
+ Long userId = getCurrentUserId ();
99
99
meetingService .cancelParticipant (meetingId , userId );
100
100
}
101
101
102
102
@ GetMapping ("/{meetingId}/participants" )
103
103
@ ResponseStatus (HttpStatus .OK )
104
- public List <MeetingParticipantsResponse > getParticipants (@ PathVariable ("meetingId" ) Long meetingId ) {
105
- return meetingService .getParticipants (meetingId );
104
+ public List <MeetingParticipantResponse > getParticipants (@ PathVariable ("meetingId" ) Long meetingId ) {
105
+ Long userId = getCurrentUserId ();
106
+ return meetingService .getParticipants (meetingId , userId );
106
107
}
107
108
108
109
@ PostMapping ("/{meetingId}/reports" )
109
110
@ ResponseStatus (HttpStatus .CREATED )
110
111
public void reportMeeting (@ PathVariable ("meetingId" ) Long meetingId ) {
111
- Long userId = securityService . getCurrentUserId ();
112
+ Long userId = getCurrentUserId ();
112
113
meetingService .reportMeeting (meetingId , userId );
113
114
}
114
115
115
116
@ PostMapping ("/{meetingId}/bookmarks" )
116
117
@ ResponseStatus (HttpStatus .CREATED )
117
118
public void addBookmark (@ PathVariable ("meetingId" ) Long meetingId ) {
118
- Long userId = securityService . getCurrentUserId ();
119
+ Long userId = getCurrentUserId ();
119
120
meetingService .addBookmark (meetingId , userId );
120
121
}
121
122
122
123
@ DeleteMapping ("/{meetingId}/bookmarks" )
123
124
@ ResponseStatus (HttpStatus .OK )
124
125
public void deleteBookmark (@ PathVariable ("meetingId" ) Long meetingId ) {
125
- Long userId = securityService . getCurrentUserId ();
126
+ Long userId = getCurrentUserId ();
126
127
meetingService .cancelBookmark (meetingId , userId );
127
128
}
128
129
@@ -132,4 +133,8 @@ public ErrorResponse handleIllegalArgumentException(IllegalArgumentException ill
132
133
Sentry .captureException (illegalArgumentException );
133
134
return ErrorResponse .of (illegalArgumentException );
134
135
}
136
+
137
+ private Long getCurrentUserId () {
138
+ return securityService .getCurrentUserId ();
139
+ }
135
140
}
0 commit comments