diff options
Diffstat (limited to 'server/models/video/video-playlist-element.ts')
-rw-r--r-- | server/models/video/video-playlist-element.ts | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/server/models/video/video-playlist-element.ts b/server/models/video/video-playlist-element.ts index bed6f8eaf..dd7653533 100644 --- a/server/models/video/video-playlist-element.ts +++ b/server/models/video/video-playlist-element.ts | |||
@@ -218,6 +218,24 @@ export class VideoPlaylistElementModel extends Model<VideoPlaylistElementModel> | |||
218 | }) | 218 | }) |
219 | } | 219 | } |
220 | 220 | ||
221 | static loadFirstElementWithVideoThumbnail (videoPlaylistId: number) { | ||
222 | const query = { | ||
223 | order: getSort('position'), | ||
224 | where: { | ||
225 | videoPlaylistId | ||
226 | }, | ||
227 | include: [ | ||
228 | { | ||
229 | model: VideoModel.scope(VideoScopeNames.WITH_THUMBNAILS), | ||
230 | required: true | ||
231 | } | ||
232 | ] | ||
233 | } | ||
234 | |||
235 | return VideoPlaylistElementModel | ||
236 | .findOne(query) | ||
237 | } | ||
238 | |||
221 | static getNextPositionOf (videoPlaylistId: number, transaction?: Transaction) { | 239 | static getNextPositionOf (videoPlaylistId: number, transaction?: Transaction) { |
222 | const query: AggregateOptions<number> = { | 240 | const query: AggregateOptions<number> = { |
223 | where: { | 241 | where: { |