1+ package com .somemore .notification .controller ;
2+
3+ import com .somemore .auth .annotation .CurrentUser ;
4+ import com .somemore .global .common .response .ApiResponse ;
5+ import com .somemore .notification .dto .NotificationIdsRequestDto ;
6+ import com .somemore .notification .usecase .NotificationCommandUseCase ;
7+ import io .swagger .v3 .oas .annotations .Operation ;
8+ import io .swagger .v3 .oas .annotations .tags .Tag ;
9+ import lombok .RequiredArgsConstructor ;
10+ import org .springframework .security .access .annotation .Secured ;
11+ import org .springframework .web .bind .annotation .PatchMapping ;
12+ import org .springframework .web .bind .annotation .PathVariable ;
13+ import org .springframework .web .bind .annotation .PostMapping ;
14+ import org .springframework .web .bind .annotation .RequestBody ;
15+ import org .springframework .web .bind .annotation .RequestMapping ;
16+ import org .springframework .web .bind .annotation .RestController ;
17+
18+ import java .util .UUID ;
19+
20+ @ Tag (name = "Notification Command API" , description = "알림 읽음 처리 API" )
21+ @ RequiredArgsConstructor
22+ @ RequestMapping ("/api/notification" )
23+ @ RestController
24+ public class NotificationCommandController {
25+
26+ private final NotificationCommandUseCase notificationCommandUseCase ;
27+
28+ @ Secured ({"ROLE_VOLUNTEER" , "ROLE_CENTER" })
29+ @ Operation (summary = "알림(1개) 읽음 처리" , description = "알림 1개를 읽음 처리합니다." )
30+ @ PatchMapping ("/read/{notificationId}" )
31+ public ApiResponse <String > markSingleNotification (
32+ @ CurrentUser UUID userId ,
33+ @ PathVariable Long notificationId
34+ ) {
35+ notificationCommandUseCase .markSingleNotificationAsRead (userId , notificationId );
36+ return ApiResponse .ok ("알림 1개 읽음 처리 성공" );
37+ }
38+
39+ @ Secured ({"ROLE_VOLUNTEER" , "ROLE_CENTER" })
40+ @ Operation (summary = "알림(N개) 읽음 처리" , description = "알림 N개를 읽음 처리합니다." )
41+ @ PostMapping ("/read/multiple" )
42+ public ApiResponse <String > markMultipleNotifications (
43+ @ CurrentUser UUID userId ,
44+ @ RequestBody NotificationIdsRequestDto notificationIds
45+ ) {
46+ notificationCommandUseCase .markMultipleNotificationsAsRead (userId , notificationIds );
47+ return ApiResponse .ok ("알림 N개 읽음 처리 성공" );
48+ }
49+ }
0 commit comments