video-blacklists.ts 653 B

123456789101112131415161718192021222324
  1. import { Response } from 'express'
  2. import { VideoBlacklistModel } from '@server/models/video/video-blacklist'
  3. import { HttpStatusCode } from '@shared/models'
  4. async function doesVideoBlacklistExist (videoId: number, res: Response) {
  5. const videoBlacklist = await VideoBlacklistModel.loadByVideoId(videoId)
  6. if (videoBlacklist === null) {
  7. res.fail({
  8. status: HttpStatusCode.NOT_FOUND_404,
  9. message: 'Blacklisted video not found'
  10. })
  11. return false
  12. }
  13. res.locals.videoBlacklist = videoBlacklist
  14. return true
  15. }
  16. // ---------------------------------------------------------------------------
  17. export {
  18. doesVideoBlacklistExist
  19. }