+import { VideoInclude } from '@shared/models'
import { Sequelize } from 'sequelize'
import { AbstractVideosModelQueryBuilder } from './shared/abstract-videos-model-query-builder'
import { VideoModelBuilder } from './shared/video-model-builder'
this.buildListQueryFromIdsQuery(options)
return this.runQuery()
- .then(rows => this.videoModelBuilder.buildVideosFromRows(rows))
+ .then(rows => this.videoModelBuilder.buildVideosFromRows({ rows, include: options.include }))
}
private buildInnerQuery (options: BuildVideosListQueryOptions) {
this.includeAccounts()
this.includeThumbnails()
- if (options.withFiles) {
- this.includeWebtorrentFiles(false)
- this.includeStreamingPlaylistFiles(false)
+ if (options.include & VideoInclude.FILES) {
+ this.includeWebtorrentFiles()
+ this.includeStreamingPlaylistFiles()
}
if (options.user) {
this.includePlaylist(options.videoPlaylistId)
}
+ if (options.include & VideoInclude.BLACKLISTED) {
+ this.includeBlacklisted()
+ }
+
+ if (options.include & VideoInclude.BLOCKED_OWNER) {
+ this.includeBlockedOwnerAndServer(options.serverAccountIdForBlock, options.user)
+ }
+
const select = this.buildSelect()
this.query = `${select} FROM (${this.innerQuery}) AS "tmp" ${this.joins} ${this.innerSort}`