-import * as express from 'express'
+import express from 'express'
import { blacklistVideo, unblacklistVideo } from '@server/lib/video-blacklist'
-import { UserRight, VideoBlacklistCreate } from '../../../../shared'
+import { HttpStatusCode, UserRight, VideoBlacklistCreate } from '@shared/models'
import { logger } from '../../../helpers/logger'
import { getFormattedObjects } from '../../../helpers/utils'
import { sequelizeTypescript } from '../../../initializers/database'
authenticate,
blacklistSortValidator,
ensureUserHasRight,
+ openapiOperationDoc,
paginationValidator,
setBlacklistSort,
setDefaultPagination,
const blacklistRouter = express.Router()
blacklistRouter.post('/:videoId/blacklist',
+ openapiOperationDoc({ operationId: 'addVideoBlock' }),
authenticate,
ensureUserHasRight(UserRight.MANAGE_VIDEO_BLACKLIST),
asyncMiddleware(videosBlacklistAddValidator),
)
blacklistRouter.get('/blacklist',
+ openapiOperationDoc({ operationId: 'getVideoBlocks' }),
authenticate,
ensureUserHasRight(UserRight.MANAGE_VIDEO_BLACKLIST),
paginationValidator,
)
blacklistRouter.delete('/:videoId/blacklist',
+ openapiOperationDoc({ operationId: 'delVideoBlock' }),
authenticate,
ensureUserHasRight(UserRight.MANAGE_VIDEO_BLACKLIST),
asyncMiddleware(videosBlacklistRemoveValidator),
logger.info('Video %s blacklisted.', videoInstance.uuid)
- return res.type('json').sendStatus(204)
+ return res.type('json').status(HttpStatusCode.NO_CONTENT_204).end()
}
async function updateVideoBlacklistController (req: express.Request, res: express.Response) {
return videoBlacklist.save({ transaction: t })
})
- return res.type('json').sendStatus(204)
+ return res.type('json').status(HttpStatusCode.NO_CONTENT_204).end()
}
async function listBlacklist (req: express.Request, res: express.Response) {
logger.info('Video %s removed from blacklist.', video.uuid)
- return res.type('json').sendStatus(204)
+ return res.type('json').status(HttpStatusCode.NO_CONTENT_204).end()
}