diff options
Diffstat (limited to 'server/middlewares/validators/shared')
-rw-r--r-- | server/middlewares/validators/shared/index.ts | 1 | ||||
-rw-r--r-- | server/middlewares/validators/shared/video-channel-syncs.ts | 24 |
2 files changed, 25 insertions, 0 deletions
diff --git a/server/middlewares/validators/shared/index.ts b/server/middlewares/validators/shared/index.ts index fa89d05f2..bbd03b248 100644 --- a/server/middlewares/validators/shared/index.ts +++ b/server/middlewares/validators/shared/index.ts | |||
@@ -4,6 +4,7 @@ export * from './utils' | |||
4 | export * from './video-blacklists' | 4 | export * from './video-blacklists' |
5 | export * from './video-captions' | 5 | export * from './video-captions' |
6 | export * from './video-channels' | 6 | export * from './video-channels' |
7 | export * from './video-channel-syncs' | ||
7 | export * from './video-comments' | 8 | export * from './video-comments' |
8 | export * from './video-imports' | 9 | export * from './video-imports' |
9 | export * from './video-ownerships' | 10 | export * from './video-ownerships' |
diff --git a/server/middlewares/validators/shared/video-channel-syncs.ts b/server/middlewares/validators/shared/video-channel-syncs.ts new file mode 100644 index 000000000..a6e51eb97 --- /dev/null +++ b/server/middlewares/validators/shared/video-channel-syncs.ts | |||
@@ -0,0 +1,24 @@ | |||
1 | import express from 'express' | ||
2 | import { VideoChannelSyncModel } from '@server/models/video/video-channel-sync' | ||
3 | import { HttpStatusCode } from '@shared/models' | ||
4 | |||
5 | async function doesVideoChannelSyncIdExist (id: number, res: express.Response) { | ||
6 | const sync = await VideoChannelSyncModel.loadWithChannel(+id) | ||
7 | |||
8 | if (!sync) { | ||
9 | res.fail({ | ||
10 | status: HttpStatusCode.NOT_FOUND_404, | ||
11 | message: 'Video channel sync not found' | ||
12 | }) | ||
13 | return false | ||
14 | } | ||
15 | |||
16 | res.locals.videoChannelSync = sync | ||
17 | return true | ||
18 | } | ||
19 | |||
20 | // --------------------------------------------------------------------------- | ||
21 | |||
22 | export { | ||
23 | doesVideoChannelSyncIdExist | ||
24 | } | ||