aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/middlewares/validators/shared/video-channel-syncs.ts
blob: a6e51eb97f4d4ff5077ae68aa9aaa64fa15dc1ff (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
import express from 'express'
import { VideoChannelSyncModel } from '@server/models/video/video-channel-sync'
import { HttpStatusCode } from '@shared/models'

async function doesVideoChannelSyncIdExist (id: number, res: express.Response) {
  const sync = await VideoChannelSyncModel.loadWithChannel(+id)

  if (!sync) {
    res.fail({
      status: HttpStatusCode.NOT_FOUND_404,
      message: 'Video channel sync not found'
    })
    return false
  }

  res.locals.videoChannelSync = sync
  return true
}

// ---------------------------------------------------------------------------

export {
  doesVideoChannelSyncIdExist
}