aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/middlewares/validators/shared/video-channels.ts
diff options
context:
space:
mode:
Diffstat (limited to 'server/middlewares/validators/shared/video-channels.ts')
-rw-r--r--server/middlewares/validators/shared/video-channels.ts36
1 files changed, 0 insertions, 36 deletions
diff --git a/server/middlewares/validators/shared/video-channels.ts b/server/middlewares/validators/shared/video-channels.ts
deleted file mode 100644
index bed9f5dbe..000000000
--- a/server/middlewares/validators/shared/video-channels.ts
+++ /dev/null
@@ -1,36 +0,0 @@
1import express from 'express'
2import { VideoChannelModel } from '@server/models/video/video-channel'
3import { MChannelBannerAccountDefault } from '@server/types/models'
4import { HttpStatusCode } from '@shared/models'
5
6async function doesVideoChannelIdExist (id: number, res: express.Response) {
7 const videoChannel = await VideoChannelModel.loadAndPopulateAccount(+id)
8
9 return processVideoChannelExist(videoChannel, res)
10}
11
12async function doesVideoChannelNameWithHostExist (nameWithDomain: string, res: express.Response) {
13 const videoChannel = await VideoChannelModel.loadByNameWithHostAndPopulateAccount(nameWithDomain)
14
15 return processVideoChannelExist(videoChannel, res)
16}
17
18// ---------------------------------------------------------------------------
19
20export {
21 doesVideoChannelIdExist,
22 doesVideoChannelNameWithHostExist
23}
24
25function processVideoChannelExist (videoChannel: MChannelBannerAccountDefault, res: express.Response) {
26 if (!videoChannel) {
27 res.fail({
28 status: HttpStatusCode.NOT_FOUND_404,
29 message: 'Video channel not found'
30 })
31 return false
32 }
33
34 res.locals.videoChannel = videoChannel
35 return true
36}