mirror of
https://github.com/advplyr/audiobookshelf.git
synced 2025-06-28 03:30:37 +02:00
Start adding notification manager
This commit is contained in:
parent
565bb4cd6b
commit
9a7503cde2
4 changed files with 61 additions and 4 deletions
39
server/objects/Notification.js
Normal file
39
server/objects/Notification.js
Normal file
|
@ -0,0 +1,39 @@
|
|||
class Notification {
|
||||
constructor(notification = null) {
|
||||
this.id = null
|
||||
this.eventName = ''
|
||||
this.urls = []
|
||||
this.titleTemplate = ''
|
||||
this.bodyTemplate = ''
|
||||
this.enabled = false
|
||||
|
||||
this.createdAt = null
|
||||
|
||||
if (notification) {
|
||||
this.construct(notification)
|
||||
}
|
||||
}
|
||||
|
||||
construct(notification) {
|
||||
this.id = notification.id
|
||||
this.eventName = notification.eventName
|
||||
this.urls = notification.urls || []
|
||||
this.titleTemplate = notification.titleTemplate || ''
|
||||
this.bodyTemplate = notification.bodyTemplate || ''
|
||||
this.enabled = !!notification.enabled
|
||||
this.createdAt = notification.createdAt
|
||||
}
|
||||
|
||||
toJSON() {
|
||||
return {
|
||||
id: this.id,
|
||||
eventName: this.eventName,
|
||||
urls: this.urls,
|
||||
titleTemplate: this.titleTemplate,
|
||||
bodyTemplate: this.bodyTemplate,
|
||||
enabled: this.enabled,
|
||||
createdAt: this.createdAt
|
||||
}
|
||||
}
|
||||
}
|
||||
module.exports = Notification
|
Loading…
Add table
Add a link
Reference in a new issue