Add:Notification edit/delete and UI updates #996

This commit is contained in:
advplyr 2022-09-24 14:03:14 -05:00
parent 37a3fdb606
commit 8e8046541e
8 changed files with 179 additions and 60 deletions

View file

@ -1,3 +1,4 @@
const Logger = require('../../Logger')
const Notification = require('../Notification')
class NotificationSettings {
@ -58,7 +59,7 @@ class NotificationSettings {
createNotification(payload) {
if (!payload) return false
// TODO: validate
if (!payload.eventName || !payload.urls.length) return false
const notification = new Notification()
notification.setData(payload)
@ -69,7 +70,10 @@ class NotificationSettings {
updateNotification(payload) {
if (!payload) return false
const notification = this.notifications.find(n => n.id === payload.id)
if (!notification) return false
if (!notification) {
Logger.error(`[NotificationSettings] updateNotification: Notification not found ${payload.id}`)
return false
}
return notification.update(payload)
}