1010import io .swagger .v3 .oas .annotations .tags .Tag ;
1111import jakarta .validation .Valid ;
1212import lombok .RequiredArgsConstructor ;
13- import lombok .extern .slf4j .Slf4j ;
1413import org .springframework .http .ResponseEntity ;
15- import org .springframework .security .core .annotation .AuthenticationPrincipal ;
1614import org .springframework .web .bind .annotation .*;
1715
18- @ Slf4j
1916@ RestController
2017@ RequiredArgsConstructor
2118@ RequestMapping ("/api/users/me/notification-settings" )
2219@ Tag (name = "Notification Setting API" , description = "알림 설정 API" )
2320public class NotificationSettingController {
2421
2522 private final NotificationSettingService settingService ;
23+ private final CurrentUser currentUser ;
2624
27- @ Operation (summary = "알림 설정 조회" , description = "사용자의 모든 알림 설정을 조회합니다." )
2825 @ GetMapping
29- public ResponseEntity < RsData < SettingsResponse >> getSettings (
30- @ Parameter ( hidden = true ) @ AuthenticationPrincipal CurrentUser currentUser ) {
26+ @ Operation ( summary = "알림 설정 조회" , description = "사용자의 모든 알림 설정을 조회합니다." )
27+ public ResponseEntity < RsData < SettingsResponse >> getSettings ( ) {
3128
3229 SettingsResponse response = settingService .getUserSettings (currentUser .getUserId ());
30+
3331 return ResponseEntity .ok (RsData .success ("알림 설정 조회 성공" , response ));
3432 }
3533
36- @ Operation (summary = "알림 설정 일괄 변경" , description = "여러 알림 설정을 한 번에 변경합니다." )
3734 @ PutMapping
35+ @ Operation (summary = "알림 설정 일괄 변경" , description = "여러 알림 설정을 한 번에 변경합니다." )
3836 public ResponseEntity <RsData <Void >> updateSettings (
39- @ Parameter (hidden = true ) @ AuthenticationPrincipal CurrentUser currentUser ,
4037 @ RequestBody @ Valid UpdateSettingsRequest request ) {
4138
4239 settingService .updateSettings (currentUser .getUserId (), request .settings ());
40+
4341 return ResponseEntity .ok (RsData .success (null ));
4442 }
4543
46- @ Operation (summary = "개별 알림 설정 토글" , description = "특정 알림 타입의 활성화 상태를 토글합니다." )
4744 @ PutMapping ("/{type}" )
45+ @ Operation (summary = "개별 알림 설정 토글" , description = "특정 알림 타입의 활성화 상태를 토글합니다." )
4846 public ResponseEntity <RsData <Void >> toggleSetting (
49- @ Parameter (hidden = true ) @ AuthenticationPrincipal CurrentUser currentUser ,
5047 @ Parameter (description = "알림 타입" , example = "ROOM_JOIN" )
5148 @ PathVariable NotificationSettingType type ) {
5249
5350 settingService .toggleSetting (currentUser .getUserId (), type );
51+
5452 return ResponseEntity .ok (RsData .success (null ));
5553 }
5654
57- @ Operation (summary = "전체 알림 ON/OFF" , description = "모든 알림을 한 번에 활성화하거나 비활성화합니다." )
5855 @ PutMapping ("/all" )
56+ @ Operation (summary = "전체 알림 ON/OFF" , description = "모든 알림을 한 번에 활성화하거나 비활성화합니다." )
5957 public ResponseEntity <RsData <Void >> toggleAllSettings (
60- @ Parameter (hidden = true ) @ AuthenticationPrincipal CurrentUser currentUser ,
6158 @ Parameter (description = "활성화 여부" , example = "true" )
6259 @ RequestParam boolean enable ) {
6360
6461 settingService .toggleAllSettings (currentUser .getUserId (), enable );
62+
6563 return ResponseEntity .ok (RsData .success (null ));
6664 }
6765}
0 commit comments