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:
parent
df0b219d36
commit
09979f8959
7 changed files with 44 additions and 32 deletions
|
@ -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)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue