aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/models/video
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2019-03-07 17:06:00 +0100
committerChocobozzz <chocobozzz@cpy.re>2019-03-18 11:17:59 +0100
commitf0a3988066f72a28bb44520af072f18d91d77dde (patch)
treedfa3a92102557b567530c5dd014c90866621140a /server/models/video
parent830b4faff15fb9c81d88e8e69fcdf94aad32bef8 (diff)
downloadPeerTube-f0a3988066f72a28bb44520af072f18d91d77dde.tar.gz
PeerTube-f0a3988066f72a28bb44520af072f18d91d77dde.tar.zst
PeerTube-f0a3988066f72a28bb44520af072f18d91d77dde.zip
Add to playlist dropdown
Diffstat (limited to 'server/models/video')
-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: [],