mirror of
https://github.com/advplyr/audiobookshelf.git
synced 2025-07-24 04:44:57 +02:00
Notification create/update events UI
This commit is contained in:
parent
ff04eb8d5e
commit
b08ad8785e
9 changed files with 389 additions and 9 deletions
|
@ -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
|
Loading…
Add table
Add a link
Reference in a new issue