aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/helpers/custom-validators/video-playlists.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-playlists.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-playlists.ts')
-rw-r--r--server/helpers/custom-validators/video-playlists.ts18
1 files changed, 0 insertions, 18 deletions
diff --git a/server/helpers/custom-validators/video-playlists.ts b/server/helpers/custom-validators/video-playlists.ts
index 2fe426560..60125dcda 100644
--- a/server/helpers/custom-validators/video-playlists.ts
+++ b/server/helpers/custom-validators/video-playlists.ts
@@ -26,27 +26,9 @@ function isVideoPlaylistTypeValid (value: any) {
26 return exists(value) && VIDEO_PLAYLIST_TYPES[ value ] !== undefined 26 return exists(value) && VIDEO_PLAYLIST_TYPES[ value ] !== undefined
27} 27}
28 28
29async function doesVideoPlaylistExist (id: number | string, res: express.Response, fetchType: 'summary' | 'all' = 'summary') {
30 const videoPlaylist = fetchType === 'summary'
31 ? await VideoPlaylistModel.loadWithAccountAndChannelSummary(id, undefined)
32 : await VideoPlaylistModel.loadWithAccountAndChannel(id, undefined)
33
34 if (!videoPlaylist) {
35 res.status(404)
36 .json({ error: 'Video playlist not found' })
37 .end()
38
39 return false
40 }
41
42 res.locals.videoPlaylist = videoPlaylist
43 return true
44}
45
46// --------------------------------------------------------------------------- 29// ---------------------------------------------------------------------------
47 30
48export { 31export {
49 doesVideoPlaylistExist,
50 isVideoPlaylistNameValid, 32 isVideoPlaylistNameValid,
51 isVideoPlaylistDescriptionValid, 33 isVideoPlaylistDescriptionValid,
52 isVideoPlaylistPrivacyValid, 34 isVideoPlaylistPrivacyValid,