1
0
Fork 0
mirror of https://github.com/Chocobozzz/PeerTube.git synced 2025-10-05 19:42:24 +02:00

Refactor video playlist middlewares

This commit is contained in:
Chocobozzz 2019-03-05 11:30:43 +01:00 committed by Chocobozzz
parent df0b219d36
commit 09979f8959
7 changed files with 44 additions and 32 deletions

View file

@ -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)