aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/helpers/custom-validators/video-channels.ts
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2019-07-23 10:40:39 +0200
committerChocobozzz <chocobozzz@cpy.re>2019-07-24 10:58:16 +0200
commit3e753302d8c911b59971c16a8018df0e1ab78465 (patch)
treeefce7ece3273589228c5c948ea6757b2bdf65429 /server/helpers/custom-validators/video-channels.ts
parenta8b666e9f1ed002230869606308749614390c82f (diff)
downloadPeerTube-3e753302d8c911b59971c16a8018df0e1ab78465.tar.gz
PeerTube-3e753302d8c911b59971c16a8018df0e1ab78465.tar.zst
PeerTube-3e753302d8c911b59971c16a8018df0e1ab78465.zip
Refactor middleware helpers
Diffstat (limited to 'server/helpers/custom-validators/video-channels.ts')
-rw-r--r--server/helpers/custom-validators/video-channels.ts21
1 files changed, 0 insertions, 21 deletions
diff --git a/server/helpers/custom-validators/video-channels.ts b/server/helpers/custom-validators/video-channels.ts
index f818ce8f1..0471f6ec4 100644
--- a/server/helpers/custom-validators/video-channels.ts
+++ b/server/helpers/custom-validators/video-channels.ts
@@ -20,33 +20,12 @@ function isVideoChannelSupportValid (value: string) {
20 return value === null || (exists(value) && validator.isLength(value, VIDEO_CHANNELS_CONSTRAINTS_FIELDS.SUPPORT)) 20 return value === null || (exists(value) && validator.isLength(value, VIDEO_CHANNELS_CONSTRAINTS_FIELDS.SUPPORT))
21} 21}
22 22
23async function doesLocalVideoChannelNameExist (name: string, res: express.Response) {
24 const videoChannel = await VideoChannelModel.loadLocalByNameAndPopulateAccount(name)
25
26 return processVideoChannelExist(videoChannel, res)
27}
28
29async function doesVideoChannelIdExist (id: number, res: express.Response) {
30 const videoChannel = await VideoChannelModel.loadAndPopulateAccount(+id)
31
32 return processVideoChannelExist(videoChannel, res)
33}
34
35async function doesVideoChannelNameWithHostExist (nameWithDomain: string, res: express.Response) {
36 const videoChannel = await VideoChannelModel.loadByNameWithHostAndPopulateAccount(nameWithDomain)
37
38 return processVideoChannelExist(videoChannel, res)
39}
40
41// --------------------------------------------------------------------------- 23// ---------------------------------------------------------------------------
42 24
43export { 25export {
44 doesVideoChannelNameWithHostExist,
45 doesLocalVideoChannelNameExist,
46 isVideoChannelDescriptionValid, 26 isVideoChannelDescriptionValid,
47 isVideoChannelNameValid, 27 isVideoChannelNameValid,
48 isVideoChannelSupportValid, 28 isVideoChannelSupportValid,
49 doesVideoChannelIdExist
50} 29}
51 30
52function processVideoChannelExist (videoChannel: VideoChannelModel, res: express.Response) { 31function processVideoChannelExist (videoChannel: VideoChannelModel, res: express.Response) {