@@ -65,9 +65,8 @@ public class PartyController {
6565 @ PostMapping ("/{partyId}/join" )
6666 public ResponseEntity <Long > joinParty (
6767 @ PathVariable Long partyId ,
68- @ RequestHeader ( "Authorization" ) String token ) {
68+ @ Parameter ( hidden = true ) @ AuthenticationPrincipal Long userId ) {
6969
70- Long userId = jwtTokenProvider .getUserId (token );
7170 partyService .joinParty (partyId , userId );
7271
7372 return ResponseEntity .ok ().build ();
@@ -100,10 +99,9 @@ public ResponseEntity<Long> joinParty(
10099 public ResponseEntity <Void > approveParticipant (
101100 @ PathVariable Long partyId ,
102101 @ PathVariable Long participantId ,
103- @ RequestHeader ( "Authorization" ) String token ) {
102+ @ Parameter ( hidden = true ) @ AuthenticationPrincipal Long userId ) {
104103
105- Long hostId = jwtTokenProvider .getUserId (token );
106- partyService .approveParticipant (partyId , participantId , hostId );
104+ partyService .approveParticipant (partyId , participantId , userId );
107105
108106 return ResponseEntity .ok ().build ();
109107 }
@@ -135,10 +133,9 @@ public ResponseEntity<Void> approveParticipant(
135133 public ResponseEntity <Void > rejectParticipant (
136134 @ PathVariable Long partyId ,
137135 @ PathVariable Long participantId ,
138- @ RequestHeader ( "Authorization" ) String token ) {
136+ @ Parameter ( hidden = true ) @ AuthenticationPrincipal Long userId ) {
139137
140- Long hostId = jwtTokenProvider .getUserId (token );
141- partyService .rejectParticipant (partyId , participantId , hostId );
138+ partyService .rejectParticipant (partyId , participantId , userId );
142139
143140 return ResponseEntity .ok ().build ();
144141 }
@@ -169,9 +166,8 @@ public ResponseEntity<Void> rejectParticipant(
169166 @ GetMapping ("{partyId}/chat/group" )
170167 public ResponseEntity <ChatRoomResponse > getGroupChatRoom (
171168 @ PathVariable Long partyId ,
172- @ RequestHeader ( "Authorization" ) String token ) {
169+ @ Parameter ( hidden = true ) @ AuthenticationPrincipal Long userId ) {
173170
174- Long userId = jwtTokenProvider .getUserId (token );
175171 ChatRoomResponse chatRoom = partyService .getGroupChatRoom (partyId , userId );
176172
177173 return ResponseEntity .ok (chatRoom );
@@ -227,10 +223,9 @@ public ResponseEntity<Boolean> canSettle(@PathVariable Long partyId) {
227223 @ PostMapping ("{partyId}/settle" )
228224 public ResponseEntity <Void > settleParty (
229225 @ PathVariable Long partyId ,
230- @ RequestHeader ( "Authorization" ) String token ) {
226+ @ Parameter ( hidden = true ) @ AuthenticationPrincipal Long userId ) {
231227
232- Long hostId = jwtTokenProvider .getUserId (token );
233- partyService .settleParty (partyId , hostId );
228+ partyService .settleParty (partyId , userId );
234229
235230 return ResponseEntity .ok ().build ();
236231 }
@@ -261,10 +256,9 @@ public ResponseEntity<Void> settleParty(
261256 @ GetMapping ("{partyId}/participants/pending" )
262257 public ResponseEntity <List <PartyParticipant >> getPendingParticipants (
263258 @ PathVariable Long partyId ,
264- @ RequestHeader ( "Authorization" ) String token ) {
259+ @ Parameter ( hidden = true ) @ AuthenticationPrincipal Long userId ) {
265260
266- Long hostId = jwtTokenProvider .getUserId (token );
267- List <PartyParticipant > participants = partyService .getPendingParticipants (partyId , hostId );
261+ List <PartyParticipant > participants = partyService .getPendingParticipants (partyId , userId );
268262
269263 return ResponseEntity .ok (participants );
270264 }
@@ -274,18 +268,14 @@ public ResponseEntity<List<PartyParticipant>> getPendingParticipants(
274268 */
275269 @ GetMapping
276270 public ResponseEntity <PartyListResponse > getPartyList (
277- @ Parameter (description = "JWT 토큰" , required = false )
278- @ RequestHeader (value = "Authorization" , required = false ) String token ,
279-
271+ @ Parameter (hidden = true ) @ AuthenticationPrincipal Long userId ,
280272 @ Parameter (
281273 description = "파티 카테고리" ,
282274 example = "ALL" ,
283275 schema = @ Schema (allowableValues = {"ALL" , "DELIVERY" , "GROCERY" , "HOUSEHOLD" })
284276 )
285277 @ RequestParam (defaultValue = "ALL" ) PartyCategory category
286278 ) {
287- Long userId = jwtTokenProvider .getUserId (token );
288-
289279 PartyListResponse response = partyService .getPartyList (
290280 userId , category );
291281
@@ -320,11 +310,9 @@ public ResponseEntity<PartyListResponse> getPartyList(
320310 @ GetMapping ("/{partyId}" )
321311 public ResponseEntity <PartyDetailResponse > getPartyDetail (
322312 @ PathVariable Long partyId ,
323- @ RequestHeader ( "Authorization" ) String token ,
313+ @ Parameter ( hidden = true ) @ AuthenticationPrincipal Long userId ,
324314 @ RequestParam (required = false ) Double userLat ,
325- @ RequestParam (required = false ) Double userLon
326- ) {
327- Long userId = jwtTokenProvider .getUserId (token );
315+ @ RequestParam (required = false ) Double userLon ) {
328316
329317 PartyDetailResponse response = partyService .getPartyDetail (partyId , userId ,userLat ,userLon );
330318 return ResponseEntity .ok (response );
@@ -356,10 +344,9 @@ public ResponseEntity<PartyDetailResponse> getPartyDetail(
356344 })
357345 @ PostMapping
358346 public ResponseEntity <Long > createParty (
359- @ RequestHeader ( "Authorization" ) String token ,
347+ @ Parameter ( hidden = true ) @ AuthenticationPrincipal Long userId ,
360348 @ Valid @ RequestBody PartyCreateRequest request ) {
361349
362- Long userId = jwtTokenProvider .getUserId (token );
363350 Long partyId = partyService .createParty (userId , request );
364351
365352 return ResponseEntity .ok (partyId );
0 commit comments