2023-09-07 00:48:50 +02:00
|
|
|
const CacheManager = require('../managers/CacheManager')
|
2022-11-19 20:28:06 +01:00
|
|
|
|
|
|
|
class CacheController {
|
|
|
|
constructor() { }
|
|
|
|
|
|
|
|
// POST: api/cache/purge
|
|
|
|
async purgeCache(req, res) {
|
|
|
|
if (!req.user.isAdminOrUp) {
|
|
|
|
return res.sendStatus(403)
|
|
|
|
}
|
2023-09-07 00:48:50 +02:00
|
|
|
await CacheManager.purgeAll()
|
2022-11-19 20:28:06 +01:00
|
|
|
res.sendStatus(200)
|
|
|
|
}
|
|
|
|
|
|
|
|
// POST: api/cache/items/purge
|
|
|
|
async purgeItemsCache(req, res) {
|
|
|
|
if (!req.user.isAdminOrUp) {
|
|
|
|
return res.sendStatus(403)
|
|
|
|
}
|
2023-09-07 00:48:50 +02:00
|
|
|
await CacheManager.purgeItems()
|
2022-11-19 20:28:06 +01:00
|
|
|
res.sendStatus(200)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
module.exports = new CacheController()
|