From 09979f8959425390b879bce22101a9bc061ae9a0 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Tue, 5 Mar 2019 11:30:43 +0100 Subject: Refactor video playlist middlewares --- server/helpers/custom-validators/video-playlists.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'server/helpers/custom-validators') 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) { return exists(value) && VIDEO_PLAYLIST_TYPES[ value ] !== undefined } -async function isVideoPlaylistExist (id: number | string, res: express.Response) { - const videoPlaylist = await VideoPlaylistModel.loadWithAccountAndChannel(id, undefined) +async function isVideoPlaylistExist (id: number | string, res: express.Response, fetchType: 'summary' | 'all' = 'summary') { + const videoPlaylist = fetchType === 'summary' + ? await VideoPlaylistModel.loadWithAccountAndChannelSummary(id, undefined) + : await VideoPlaylistModel.loadWithAccountAndChannel(id, undefined) if (!videoPlaylist) { res.status(404) -- cgit v1.2.3