mirror of
https://github.com/advplyr/audiobookshelf.git
synced 2025-06-24 17:59:06 +02:00
Add:Notification edit/delete and UI updates #996
This commit is contained in:
parent
37a3fdb606
commit
8e8046541e
8 changed files with 179 additions and 60 deletions
|
@ -18,36 +18,37 @@ class NotificationController {
|
|||
res.sendStatus(200)
|
||||
}
|
||||
|
||||
getData(req, res) {
|
||||
res.json(this.notificationManager.getData())
|
||||
}
|
||||
|
||||
async createNotification(req, res) {
|
||||
const success = this.db.notificationSettings.createNotification(req.body)
|
||||
|
||||
if (success) {
|
||||
await this.db.updateEntity('settings', this.db.notificationSettings)
|
||||
}
|
||||
res.sendStatus(200)
|
||||
}
|
||||
|
||||
getData(req, res) {
|
||||
res.json(this.notificationManager.getData())
|
||||
res.json(this.db.notificationSettings)
|
||||
}
|
||||
|
||||
async deleteNotification(req, res) {
|
||||
if (this.db.notificationSettings.removeNotification(req.notification.id)) {
|
||||
await this.db.updateEntity('settings', this.db.notificationSettings)
|
||||
}
|
||||
res.sendStatus(200)
|
||||
res.json(this.db.notificationSettings)
|
||||
}
|
||||
|
||||
async updateNotification(req, res) {
|
||||
const success = this.db.notificationSettings.updateNotification(req.body)
|
||||
|
||||
console.log('Update notification', success, req.body)
|
||||
if (success) {
|
||||
await this.db.updateEntity('settings', this.db.notificationSettings)
|
||||
}
|
||||
res.sendStatus(200)
|
||||
res.json(this.db.notificationSettings)
|
||||
}
|
||||
|
||||
sendNotificationTest(req, res) {
|
||||
if (!this.db.notificationSettings.isUsable) return res.status(500).send('Apprise is not configured')
|
||||
this.notificationManager.onTest()
|
||||
res.sendStatus(200)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue