]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - server/helpers/custom-validators/video-playlists.ts
add quarantine videos feature (#1637)
[github/Chocobozzz/PeerTube.git] / server / helpers / custom-validators / video-playlists.ts
index c217a39bf9ed76d16ea52227784202e54f27213a..c962c5532348c27f17203ed28f20b30ee0d7fa83 100644 (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 doesVideoPlaylistExist (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)
@@ -44,7 +46,7 @@ async function isVideoPlaylistExist (id: number | string, res: express.Response)
 // ---------------------------------------------------------------------------
 
 export {
-  isVideoPlaylistExist,
+  doesVideoPlaylistExist,
   isVideoPlaylistNameValid,
   isVideoPlaylistDescriptionValid,
   isVideoPlaylistPrivacyValid,