mirror of
https://github.com/advplyr/audiobookshelf.git
synced 2025-12-06 20:09:37 +00:00
Add author edit modal & remove from experimental
This commit is contained in:
parent
deea6702f0
commit
4c2ad3ede5
26 changed files with 344 additions and 131 deletions
|
|
@ -8,6 +8,29 @@ class AuthorController {
|
|||
return res.json(req.author)
|
||||
}
|
||||
|
||||
async update(req, res) {
|
||||
var payload = req.body
|
||||
|
||||
// If updating or removing cover image then clear cache
|
||||
if (payload.imagePath !== undefined && req.author.imagePath && payload.imagePath !== req.author.imagePath) {
|
||||
this.cacheManager.purgeImageCache(req.author.id)
|
||||
if (!payload.imagePath) { // If removing image then remove file
|
||||
var currentImagePath = req.author.imagePath
|
||||
await this.coverController.removeFile(currentImagePath)
|
||||
}
|
||||
}
|
||||
|
||||
var hasUpdated = req.author.update(payload)
|
||||
if (hasUpdated) {
|
||||
await this.db.updateEntity('author', req.author)
|
||||
this.emitter('author_updated', req.author.toJSON())
|
||||
}
|
||||
res.json({
|
||||
author: req.author.toJSON(),
|
||||
updated: hasUpdated
|
||||
})
|
||||
}
|
||||
|
||||
async search(req, res) {
|
||||
var q = (req.query.q || '').toLowerCase()
|
||||
if (!q) return res.json([])
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue