aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/helpers
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2019-03-05 11:30:43 +0100
committerChocobozzz <chocobozzz@cpy.re>2019-03-18 11:17:59 +0100
commit09979f8959425390b879bce22101a9bc061ae9a0 (patch)
treea128a50b7c58c070e4b7af44028dfaa03e2d2ef1 /server/helpers
parentdf0b219d36bf6852cdf2a7ad09ed4a41c6bccefa (diff)
downloadPeerTube-09979f8959425390b879bce22101a9bc061ae9a0.tar.gz
PeerTube-09979f8959425390b879bce22101a9bc061ae9a0.tar.zst
PeerTube-09979f8959425390b879bce22101a9bc061ae9a0.zip
Refactor video playlist middlewares
Diffstat (limited to 'server/helpers')
-rw-r--r--server/helpers/custom-validators/video-playlists.ts6
1 files changed, 4 insertions, 2 deletions
diff --git a/server/helpers/custom-validators/video-playlists.ts b/server/helpers/custom-validators/video-playlists.ts
index c217a39bf..e0eb423d7 100644
--- a/server/helpers/custom-validators/video-playlists.ts
+++ b/server/helpers/custom-validators/video-playlists.ts
@@ -26,8 +26,10 @@ 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 isVideoPlaylistExist (id: number | string, res: express.Response) { 29async function isVideoPlaylistExist (id: number | string, res: express.Response, fetchType: 'summary' | 'all' = 'summary') {
30 const videoPlaylist = await VideoPlaylistModel.loadWithAccountAndChannel(id, undefined) 30 const videoPlaylist = fetchType === 'summary'
31 ? await VideoPlaylistModel.loadWithAccountAndChannelSummary(id, undefined)
32 : await VideoPlaylistModel.loadWithAccountAndChannel(id, undefined)
31 33
32 if (!videoPlaylist) { 34 if (!videoPlaylist) {
33 res.status(404) 35 res.status(404)