diff options
author | Chocobozzz <me@florianbigard.com> | 2019-03-19 09:26:50 +0100 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2019-03-19 09:26:50 +0100 |
commit | 0f6acda11681de90d38dd18669863c6e270851ee (patch) | |
tree | b3b28e00d539645f5a810202dc8afada289e7b2e /server/helpers/custom-validators/video-channels.ts | |
parent | 9a18a6252071cf21b18f82a24bb63078abb75bc1 (diff) | |
download | PeerTube-0f6acda11681de90d38dd18669863c6e270851ee.tar.gz PeerTube-0f6acda11681de90d38dd18669863c6e270851ee.tar.zst PeerTube-0f6acda11681de90d38dd18669863c6e270851ee.zip |
Does exist
Diffstat (limited to 'server/helpers/custom-validators/video-channels.ts')
-rw-r--r-- | server/helpers/custom-validators/video-channels.ts | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/server/helpers/custom-validators/video-channels.ts b/server/helpers/custom-validators/video-channels.ts index 3792bbdcc..fad7a9bcf 100644 --- a/server/helpers/custom-validators/video-channels.ts +++ b/server/helpers/custom-validators/video-channels.ts | |||
@@ -20,13 +20,13 @@ 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 isLocalVideoChannelNameExist (name: string, res: express.Response) { | 23 | async function doesLocalVideoChannelNameExist (name: string, res: express.Response) { |
24 | const videoChannel = await VideoChannelModel.loadLocalByNameAndPopulateAccount(name) | 24 | const videoChannel = await VideoChannelModel.loadLocalByNameAndPopulateAccount(name) |
25 | 25 | ||
26 | return processVideoChannelExist(videoChannel, res) | 26 | return processVideoChannelExist(videoChannel, res) |
27 | } | 27 | } |
28 | 28 | ||
29 | async function isVideoChannelIdExist (id: number | string, res: express.Response) { | 29 | async function doesVideoChannelIdExist (id: number | string, res: express.Response) { |
30 | let videoChannel: VideoChannelModel | 30 | let videoChannel: VideoChannelModel |
31 | if (validator.isInt('' + id)) { | 31 | if (validator.isInt('' + id)) { |
32 | videoChannel = await VideoChannelModel.loadAndPopulateAccount(+id) | 32 | videoChannel = await VideoChannelModel.loadAndPopulateAccount(+id) |
@@ -37,7 +37,7 @@ async function isVideoChannelIdExist (id: number | string, res: express.Response | |||
37 | return processVideoChannelExist(videoChannel, res) | 37 | return processVideoChannelExist(videoChannel, res) |
38 | } | 38 | } |
39 | 39 | ||
40 | async function isVideoChannelNameWithHostExist (nameWithDomain: string, res: express.Response) { | 40 | async function doesVideoChannelNameWithHostExist (nameWithDomain: string, res: express.Response) { |
41 | const videoChannel = await VideoChannelModel.loadByNameWithHostAndPopulateAccount(nameWithDomain) | 41 | const videoChannel = await VideoChannelModel.loadByNameWithHostAndPopulateAccount(nameWithDomain) |
42 | 42 | ||
43 | return processVideoChannelExist(videoChannel, res) | 43 | return processVideoChannelExist(videoChannel, res) |
@@ -46,12 +46,12 @@ async function isVideoChannelNameWithHostExist (nameWithDomain: string, res: exp | |||
46 | // --------------------------------------------------------------------------- | 46 | // --------------------------------------------------------------------------- |
47 | 47 | ||
48 | export { | 48 | export { |
49 | isVideoChannelNameWithHostExist, | 49 | doesVideoChannelNameWithHostExist, |
50 | isLocalVideoChannelNameExist, | 50 | doesLocalVideoChannelNameExist, |
51 | isVideoChannelDescriptionValid, | 51 | isVideoChannelDescriptionValid, |
52 | isVideoChannelNameValid, | 52 | isVideoChannelNameValid, |
53 | isVideoChannelSupportValid, | 53 | isVideoChannelSupportValid, |
54 | isVideoChannelIdExist | 54 | doesVideoChannelIdExist |
55 | } | 55 | } |
56 | 56 | ||
57 | function processVideoChannelExist (videoChannel: VideoChannelModel, res: express.Response) { | 57 | function processVideoChannelExist (videoChannel: VideoChannelModel, res: express.Response) { |