aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/models
diff options
context:
space:
mode:
Diffstat (limited to 'server/models')
-rw-r--r--server/models/video/video-playlist.ts23
1 files changed, 23 insertions, 0 deletions
diff --git a/server/models/video/video-playlist.ts b/server/models/video/video-playlist.ts
index 4d2ea0a66..aa42687cd 100644
--- a/server/models/video/video-playlist.ts
+++ b/server/models/video/video-playlist.ts
@@ -317,6 +317,29 @@ export class VideoPlaylistModel extends Model<VideoPlaylistModel> {
317 }) 317 })
318 } 318 }
319 319
320 static listPlaylistIdsOf (accountId: number, videoIds: number[]) {
321 const query = {
322 attributes: [ 'id' ],
323 where: {
324 ownerAccountId: accountId
325 },
326 include: [
327 {
328 attributes: [ 'videoId', 'startTimestamp', 'stopTimestamp' ],
329 model: VideoPlaylistElementModel.unscoped(),
330 where: {
331 videoId: {
332 [Sequelize.Op.any]: videoIds
333 }
334 },
335 required: true
336 }
337 ]
338 }
339
340 return VideoPlaylistModel.findAll(query)
341 }
342
320 static doesPlaylistExist (url: string) { 343 static doesPlaylistExist (url: string) {
321 const query = { 344 const query = {
322 attributes: [], 345 attributes: [],