mirror of
https://github.com/advplyr/audiobookshelf.git
synced 2024-12-20 19:06:06 +01:00
25 lines
542 B
JavaScript
25 lines
542 B
JavaScript
|
const Logger = require('../Logger')
|
||
|
|
||
|
class NotificationController {
|
||
|
constructor() { }
|
||
|
|
||
|
get(req, res) {
|
||
|
res.json(this.db.notificationSettings)
|
||
|
}
|
||
|
|
||
|
async update(req, res) {
|
||
|
const updated = this.db.notificationSettings.update(req.body)
|
||
|
if (updated) {
|
||
|
await this.db.updateEntity('settings', this.db.notificationSettings)
|
||
|
}
|
||
|
res.sendStatus(200)
|
||
|
}
|
||
|
|
||
|
middleware(req, res, next) {
|
||
|
if (!req.user.isAdminOrUp) {
|
||
|
return res.sendStatus(404)
|
||
|
}
|
||
|
next()
|
||
|
}
|
||
|
}
|
||
|
module.exports = new NotificationController()
|