mirror of
https://github.com/nagisa77/OpenIsle.git
synced 2026-02-12 01:51:02 +08:00
feat: allow updating notification prefs
This commit is contained in:
@@ -3,6 +3,8 @@ package com.openisle.controller;
|
||||
import com.openisle.dto.NotificationDto;
|
||||
import com.openisle.dto.NotificationMarkReadRequest;
|
||||
import com.openisle.dto.NotificationUnreadCountDto;
|
||||
import com.openisle.dto.NotificationPreferenceDto;
|
||||
import com.openisle.dto.NotificationPreferenceUpdateRequest;
|
||||
import com.openisle.mapper.NotificationMapper;
|
||||
import com.openisle.service.NotificationService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
@@ -40,4 +42,14 @@ public class NotificationController {
|
||||
public void markRead(@RequestBody NotificationMarkReadRequest req, Authentication auth) {
|
||||
notificationService.markRead(auth.getName(), req.getIds());
|
||||
}
|
||||
|
||||
@GetMapping("/prefs")
|
||||
public List<NotificationPreferenceDto> prefs(Authentication auth) {
|
||||
return notificationService.listPreferences(auth.getName());
|
||||
}
|
||||
|
||||
@PostMapping("/prefs")
|
||||
public void updatePref(@RequestBody NotificationPreferenceUpdateRequest req, Authentication auth) {
|
||||
notificationService.updatePreference(auth.getName(), req.getType(), req.isEnabled());
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user