diff options
author | Chocobozzz <me@florianbigard.com> | 2019-07-23 10:40:39 +0200 |
---|---|---|
committer | Chocobozzz <chocobozzz@cpy.re> | 2019-07-24 10:58:16 +0200 |
commit | 3e753302d8c911b59971c16a8018df0e1ab78465 (patch) | |
tree | efce7ece3273589228c5c948ea6757b2bdf65429 /server/helpers/custom-validators/video-channels.ts | |
parent | a8b666e9f1ed002230869606308749614390c82f (diff) | |
download | PeerTube-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.ts | 21 |
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 | ||
23 | async function doesLocalVideoChannelNameExist (name: string, res: express.Response) { | ||
24 | const videoChannel = await VideoChannelModel.loadLocalByNameAndPopulateAccount(name) | ||
25 | |||
26 | return processVideoChannelExist(videoChannel, res) | ||
27 | } | ||
28 | |||
29 | async function doesVideoChannelIdExist (id: number, res: express.Response) { | ||
30 | const videoChannel = await VideoChannelModel.loadAndPopulateAccount(+id) | ||
31 | |||
32 | return processVideoChannelExist(videoChannel, res) | ||
33 | } | ||
34 | |||
35 | async 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 | ||
43 | export { | 25 | export { |
44 | doesVideoChannelNameWithHostExist, | ||
45 | doesLocalVideoChannelNameExist, | ||
46 | isVideoChannelDescriptionValid, | 26 | isVideoChannelDescriptionValid, |
47 | isVideoChannelNameValid, | 27 | isVideoChannelNameValid, |
48 | isVideoChannelSupportValid, | 28 | isVideoChannelSupportValid, |
49 | doesVideoChannelIdExist | ||
50 | } | 29 | } |
51 | 30 | ||
52 | function processVideoChannelExist (videoChannel: VideoChannelModel, res: express.Response) { | 31 | function processVideoChannelExist (videoChannel: VideoChannelModel, res: express.Response) { |