-function removeVideoFromBlacklistController (req: express.Request, res: express.Response, next: express.NextFunction) {
- const blacklistedVideo = res.locals.blacklistedVideo as BlacklistedVideoInstance
-
- blacklistedVideo.destroy()
- .then(() => {
- logger.info('Video %s removed from blacklist.', res.locals.video.uuid)
- res.sendStatus(204)
- })
- .catch(err => {
- logger.error('Some error while removing video %s from blacklist.', res.locals.video.uuid, err)
- next(err)
- })
+async function removeVideoFromBlacklistController (req: express.Request, res: express.Response, next: express.NextFunction) {
+ const blacklistedVideo = res.locals.blacklistedVideo as VideoBlacklistModel
+
+ try {
+ await blacklistedVideo.destroy()
+
+ logger.info('Video %s removed from blacklist.', res.locals.video.uuid)
+
+ return res.sendStatus(204)
+ } catch (err) {
+ logger.error('Some error while removing video %s from blacklist.', res.locals.video.uuid, err)
+ throw err
+ }