mirror of
https://github.com/advplyr/audiobookshelf.git
synced 2025-08-04 02:05:06 +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
|
@ -4,7 +4,10 @@ class NotificationController {
|
|||
constructor() { }
|
||||
|
||||
get(req, res) {
|
||||
res.json(this.db.notificationSettings)
|
||||
res.json({
|
||||
data: this.notificationManager.getData(),
|
||||
settings: this.db.notificationSettings
|
||||
})
|
||||
}
|
||||
|
||||
async update(req, res) {
|
||||
|
@ -15,6 +18,28 @@ class NotificationController {
|
|||
res.sendStatus(200)
|
||||
}
|
||||
|
||||
async createEvent(req, res) {
|
||||
const success = this.db.notificationSettings.addNewEvent(req.body)
|
||||
|
||||
if (success) {
|
||||
await this.db.updateEntity('settings', this.db.notificationSettings)
|
||||
}
|
||||
res.sendStatus(200)
|
||||
}
|
||||
|
||||
async updateEvent(req, res) {
|
||||
const success = this.db.notificationSettings.updateEvent(req.body)
|
||||
|
||||
if (success) {
|
||||
await this.db.updateEntity('settings', this.db.notificationSettings)
|
||||
}
|
||||
res.sendStatus(200)
|
||||
}
|
||||
|
||||
getData(req, res) {
|
||||
res.json(this.notificationManager.getData())
|
||||
}
|
||||
|
||||
middleware(req, res, next) {
|
||||
if (!req.user.isAdminOrUp) {
|
||||
return res.sendStatus(404)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue