Remove purge-media-progress api route

This commit is contained in:
advplyr 2023-07-09 14:08:14 -05:00
parent f4497acd48
commit b9be7510f8
2 changed files with 0 additions and 37 deletions

View File

@ -166,42 +166,6 @@ class UserController {
res.json(listeningStats)
}
// POST: api/users/:id/purge-media-progress
// TODO: Remove
async purgeMediaProgress(req, res) {
return res.sendStatus(404)
// const user = req.reqUser
// if (user.type === 'root' && !req.user.isRoot) {
// Logger.error(`[UserController] Admin user attempted to purge media progress of root user`, req.user.username)
// return res.sendStatus(403)
// }
// var progressPurged = 0
// user.mediaProgress = user.mediaProgress.filter(mp => {
// const libraryItem = Database.libraryItems.find(li => li.id === mp.libraryItemId)
// if (!libraryItem) {
// progressPurged++
// return false
// } else if (mp.episodeId) {
// const episode = libraryItem.mediaType === 'podcast' ? libraryItem.media.getEpisode(mp.episodeId) : null
// if (!episode) { // Episode not found
// progressPurged++
// return false
// }
// }
// return true
// })
// if (progressPurged) {
// Logger.info(`[UserController] Purged ${progressPurged} media progress for user ${user.username}`)
// await this.db.updateEntity('user', user)
// SocketAuthority.adminEmitter('user_updated', user.toJSONForBrowser())
// }
// res.json(this.userJsonWithItemProgressDetails(user, !req.user.isRoot))
}
// POST: api/users/online (admin)
async getOnlineUsers(req, res) {
if (!req.user.isAdminOrUp) {

View File

@ -140,7 +140,6 @@ class ApiRouter {
this.router.get('/users/:id/listening-sessions', UserController.middleware.bind(this), UserController.getListeningSessions.bind(this))
this.router.get('/users/:id/listening-stats', UserController.middleware.bind(this), UserController.getListeningStats.bind(this))
this.router.post('/users/:id/purge-media-progress', UserController.middleware.bind(this), UserController.purgeMediaProgress.bind(this))
//
// Collection Routes