diff options
author | Chocobozzz <me@florianbigard.com> | 2019-08-01 16:54:24 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2019-08-01 16:54:24 +0200 |
commit | 65af03a241aa83ab7ba71278b6c99acd26428b8a (patch) | |
tree | 0cc04c31cdf631d11a915ae40389e8fa141f136b /server/models/video/video-playlist-element.ts | |
parent | a21e25ff641854c8b01664cb18655aa420620af6 (diff) | |
download | PeerTube-65af03a241aa83ab7ba71278b6c99acd26428b8a.tar.gz PeerTube-65af03a241aa83ab7ba71278b6c99acd26428b8a.tar.zst PeerTube-65af03a241aa83ab7ba71278b6c99acd26428b8a.zip |
Automatically update playlist thumbnails
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: { |