Add:Purge items cache button and api endpoint

This commit is contained in:
advplyr 2022-10-02 14:46:48 -05:00
parent 02d997897c
commit 142205f060
5 changed files with 56 additions and 7 deletions

View file

@ -158,16 +158,26 @@ class MiscController {
})
}
// POST: api/purgecache (admin)
// POST: api/cache/purge (admin)
async purgeCache(req, res) {
if (!req.user.isAdminOrUp) {
return res.sendStatus(403)
}
Logger.info(`[ApiRouter] Purging all cache`)
Logger.info(`[MiscController] Purging all cache`)
await this.cacheManager.purgeAll()
res.sendStatus(200)
}
// POST: api/cache/items/purge
async purgeItemsCache(req, res) {
if (!req.user.isAdminOrUp) {
return res.sendStatus(403)
}
Logger.info(`[MiscController] Purging items cache`)
await this.cacheManager.purgeItems()
res.sendStatus(200)
}
async findBooks(req, res) {
var provider = req.query.provider || 'google'
var title = req.query.title || ''