Add ability to hide and unhide series

List of hidden series IDs is stored in user.extraData and hidden series
are filtered out of the query on the server side.
This commit is contained in:
DoctorDalek1963 2025-11-03 22:05:13 +00:00
parent 8498378bca
commit 8fb763d81e
No known key found for this signature in database
8 changed files with 133 additions and 0 deletions

View file

@ -381,6 +381,44 @@ class MeController {
res.json(req.user.toOldJSONForBrowser())
}
/**
* GET: /api/me/series/:id/hide
*
* @param {RequestWithUser} req
* @param {Response} res
*/
async hideSeries(req, res) {
if (!(await Database.seriesModel.checkExistsById(req.params.id))) {
Logger.error(`[MeController] hideSeries: Series ${req.params.id} not found`)
return res.sendStatus(404)
}
const hasUpdated = await req.user.hideSeries(req.params.id)
if (hasUpdated) {
SocketAuthority.clientEmitter(req.user.id, 'user_updated', req.user.toOldJSONForBrowser())
}
res.json(req.user.toOldJSONForBrowser())
}
/**
* GET: /api/me/series/:id/unhide
*
* @param {RequestWithUser} req
* @param {Response} res
*/
async unhideSeries(req, res) {
if (!(await Database.seriesModel.checkExistsById(req.params.id))) {
Logger.error(`[MeController] unhideSeries: Series ${req.params.id} not found`)
return res.sendStatus(404)
}
const hasUpdated = await req.user.unhideSeries(req.params.id)
if (hasUpdated) {
SocketAuthority.clientEmitter(req.user.id, 'user_updated', req.user.toOldJSONForBrowser())
}
res.json(req.user.toOldJSONForBrowser())
}
/**
* GET: api/me/progress/:id/remove-from-continue-listening
*