-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathManagementNotificationController.java
More file actions
38 lines (33 loc) · 1.74 KB
/
ManagementNotificationController.java
File metadata and controls
38 lines (33 loc) · 1.74 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
package clap.server.adapter.inbound.web.notification;
import clap.server.adapter.inbound.security.SecurityUserDetails;
import clap.server.application.port.inbound.notification.UpdateNotificationUsecase;
import clap.server.common.annotation.architecture.WebAdapter;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.enums.ParameterIn;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import org.springframework.security.core.annotation.AuthenticationPrincipal;
import org.springframework.web.bind.annotation.PatchMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@Tag(name = "알림 읽음 처리")
@WebAdapter
@RestController
@RequestMapping("/api/notification")
@RequiredArgsConstructor
public class ManagementNotificationController {
private final UpdateNotificationUsecase updateNotificationUsecase;
@Operation(summary = "알림 목록에서 한 개 눌렀을 때 읽음 처리")
@Parameter(name = "notificationId", description = "알림 고유 ID", required = true, in = ParameterIn.PATH)
@PatchMapping("/{notificationId}")
public void updateNotificationIsRead(@PathVariable Long notificationId) {
updateNotificationUsecase.updateNotification(notificationId);
}
@Operation(summary = "알림 목록에서 전체 읽음 버튼을 눌렀을 때 전체 읽음 처리")
@PatchMapping
public void updateAllNotificationIsRead(@AuthenticationPrincipal SecurityUserDetails userInfo) {
updateNotificationUsecase.updateAllNotification(userInfo.getUserId());
}
}