-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathManagementNotificationController.java
More file actions
61 lines (53 loc) · 3.17 KB
/
ManagementNotificationController.java
File metadata and controls
61 lines (53 loc) · 3.17 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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
package clap.server.adapter.inbound.web.notification;
import clap.server.adapter.inbound.security.service.SecurityUserDetails;
import clap.server.application.port.inbound.notification.*;
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 = "04. Notification")
@WebAdapter
@RestController
@RequestMapping("/api/notifications")
@RequiredArgsConstructor
public class ManagementNotificationController {
private final UpdateNotificationUsecase updateNotificationUsecase;
private final UpdateAllNotificationUsecase updateAllNotificationUsecase;
private final EnableKakaoUsecase enableKakaoUsecase;
private final EnableAgitUsecase enableAgitUsecase;
private final EnableEmailUsecase enableEmailUsecase;
@Operation(summary = "알림 목록에서 한 개 눌렀을 때 읽음 처리")
@Parameter(name = "notificationId", description = "알림 고유 ID", required = true, in = ParameterIn.PATH)
@PatchMapping("/{notificationId}")
public void updateNotificationIsRead(@AuthenticationPrincipal SecurityUserDetails userInfo,
@PathVariable Long notificationId) {
updateNotificationUsecase.updateNotification(userInfo.getUserId(), notificationId);
}
@Operation(summary = "알림 목록에서 전체 읽음 버튼을 눌렀을 때 전체 읽음 처리")
@PatchMapping
public void updateAllNotificationIsRead(@AuthenticationPrincipal SecurityUserDetails userInfo) {
updateAllNotificationUsecase.updateAllNotification(userInfo.getUserId());
}
@Operation(summary = "카카오 푸시 알림 활성화/비활성화 API", description = "알림 거부였을 시 -> 승인으로 변경, 알림 승인이였을 시 -> 거부로 변경")
@PatchMapping("/kakao")
public void enableKaKaoWork(@AuthenticationPrincipal SecurityUserDetails userInfo) {
enableKakaoUsecase.enableKakao(userInfo.getUserId());
}
@Operation(summary = "아지트 푸시 알림 활성화/비활성화 API", description = "알림 거부였을 시 -> 승인으로 변경, 알림 승인이였을 시 -> 거부로 변경")
@PatchMapping("/agit")
public void enableAgit(@AuthenticationPrincipal SecurityUserDetails userInfo) {
enableAgitUsecase.enableAgit(userInfo.getUserId());
}
@Operation(summary = "이메일 푸시 알림 활성화/비활성화 API", description = "알림 거부였을 시 -> 승인으로 변경, 알림 승인이였을 시 -> 거부로 변경")
@PatchMapping("/email")
public void enableEmail(@AuthenticationPrincipal SecurityUserDetails userInfo) {
enableEmailUsecase.enableEmail(userInfo.getUserId());
}
}