11package org .sejongisc .backend .feedback .controller ;
22
3+ import static org .sejongisc .backend .attendance .util .AuthUserUtil .requireUserId ;
4+
35import io .swagger .v3 .oas .annotations .Operation ;
46import io .swagger .v3 .oas .annotations .tags .Tag ;
57import lombok .RequiredArgsConstructor ;
8+ import org .sejongisc .backend .common .auth .dto .CustomUserDetails ;
69import org .sejongisc .backend .feedback .dto .FeedbackCreateRequest ;
710import org .sejongisc .backend .feedback .service .FeedbackService ;
811import org .springframework .http .HttpStatus ;
912import org .springframework .http .ResponseEntity ;
13+ import org .springframework .security .core .annotation .AuthenticationPrincipal ;
1014import org .springframework .web .bind .annotation .PostMapping ;
1115import org .springframework .web .bind .annotation .RequestBody ;
1216import org .springframework .web .bind .annotation .RequestMapping ;
@@ -21,13 +25,16 @@ public class FeedbackController {
2125 private final FeedbackService feedbackService ;
2226
2327 @ Operation (summary = "피드백 등록" , description = """
24- 로그인한 사용자의 피드백을 저장합니다.
28+ 로그인한 사용자의 피드백을 저장합니다.
2529 관리자에게 전달되어 서비스 개선에 활용됩니다.
2630 유저 정보는 저장되지 않습니다.
2731 """ )
2832 @ PostMapping
29- public ResponseEntity <Void > createFeedback (@ RequestBody FeedbackCreateRequest request ) {
30- feedbackService .createFeedback (request );
33+ public ResponseEntity <Void > createFeedback (
34+ @ AuthenticationPrincipal CustomUserDetails userDetails ,
35+ @ RequestBody FeedbackCreateRequest request
36+ ) {
37+ feedbackService .createFeedback (requireUserId (userDetails ), request );
3138 return ResponseEntity .status (HttpStatus .CREATED ).build ();
3239 }
3340}
0 commit comments