X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=server%2Fmodels%2Fvideo%2Fvideo-playlist.ts;h=aa42687cd131656b90a6340f7f0adf5d4b12a057;hb=f0a3988066f72a28bb44520af072f18d91d77dde;hp=4d2ea0a666ad11600238af46b51f68706bb4e734;hpb=830b4faff15fb9c81d88e8e69fcdf94aad32bef8;p=github%2FChocobozzz%2FPeerTube.git 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 { }) } + static listPlaylistIdsOf (accountId: number, videoIds: number[]) { + const query = { + attributes: [ 'id' ], + where: { + ownerAccountId: accountId + }, + include: [ + { + attributes: [ 'videoId', 'startTimestamp', 'stopTimestamp' ], + model: VideoPlaylistElementModel.unscoped(), + where: { + videoId: { + [Sequelize.Op.any]: videoIds + } + }, + required: true + } + ] + } + + return VideoPlaylistModel.findAll(query) + } + static doesPlaylistExist (url: string) { const query = { attributes: [],