Notification create/update events UI

This commit is contained in:
advplyr 2022-09-22 18:12:48 -05:00
parent ff04eb8d5e
commit b08ad8785e
9 changed files with 389 additions and 9 deletions

View file

@ -1,3 +1,5 @@
const Notification = require('../Notification')
class NotificationSettings {
constructor(settings = null) {
this.id = 'notification-settings'
@ -41,5 +43,23 @@ class NotificationSettings {
}
return false
}
addNewEvent(payload) {
if (!payload) return false
// TODO: validate
const notification = new Notification()
notification.setData(payload)
this.notifications.push(notification)
return true
}
updateEvent(payload) {
if (!payload) return false
const notification = this.notifications.find(n => n.id === payload.id)
if (!notification) return false
return notification.update(payload)
}
}
module.exports = NotificationSettings