aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/middlewares/validators/shared
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2022-08-10 11:51:13 +0200
committerChocobozzz <me@florianbigard.com>2022-08-10 14:32:00 +0200
commita3b472a12ec6e57dbe2f650419f8064864686eab (patch)
treef36559488e34493c029b686772e986902150a647 /server/middlewares/validators/shared
parent0567049a9819d67070aa6d548a75a7e632a4aaa4 (diff)
downloadPeerTube-a3b472a12ec6e57dbe2f650419f8064864686eab.tar.gz
PeerTube-a3b472a12ec6e57dbe2f650419f8064864686eab.tar.zst
PeerTube-a3b472a12ec6e57dbe2f650419f8064864686eab.zip
Add ability to list imports of a channel sync
Diffstat (limited to 'server/middlewares/validators/shared')
-rw-r--r--server/middlewares/validators/shared/index.ts1
-rw-r--r--server/middlewares/validators/shared/video-channel-syncs.ts24
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'
4export * from './video-blacklists' 4export * from './video-blacklists'
5export * from './video-captions' 5export * from './video-captions'
6export * from './video-channels' 6export * from './video-channels'
7export * from './video-channel-syncs'
7export * from './video-comments' 8export * from './video-comments'
8export * from './video-imports' 9export * from './video-imports'
9export * from './video-ownerships' 10export * 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 @@
1import express from 'express'
2import { VideoChannelSyncModel } from '@server/models/video/video-channel-sync'
3import { HttpStatusCode } from '@shared/models'
4
5async 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
22export {
23 doesVideoChannelSyncIdExist
24}