)
}
]
- },
+ }
+ },
+ include: []
+ }
+
+ // Only list public/published videos
+ if (!options.filter || options.filter !== 'all-local') {
+ const privacyWhere = {
// Always list public videos
privacy: VideoPrivacy.PUBLIC,
// Always list published videos, or videos that are being transcoded but on which we don't want to wait for transcoding
}
}
]
- },
- include: []
+ }
+
+ Object.assign(query.where, privacyWhere)
}
if (options.filter || options.accountId || options.videoChannelId) {
trendingDays?: number,
userId?: number
}, countVideos = true) {
+ if (options.filter && options.filter === 'all-local' && !options.userId) {
+ throw new Error('Try to filter all-local but no userId is provided')
+ }
+
const query: IFindOptions<VideoModel> = {
offset: options.start,
limit: options.count,
tagsAllOf?: string[]
durationMin?: number // seconds
durationMax?: number // seconds
- userId?: number
+ userId?: number,
+ filter?: VideoFilter
}) {
const whereAnd = []
languageOneOf: options.languageOneOf,
tagsOneOf: options.tagsOneOf,
tagsAllOf: options.tagsAllOf,
- userId: options.userId
+ userId: options.userId,
+ filter: options.filter
}
return VideoModel.getAvailableForApi(query, queryOptions)
}
private static buildActorWhereWithFilter (filter?: VideoFilter) {
- if (filter && filter === 'local') {
+ if (filter && (filter === 'local' || filter === 'all-local')) {
return {
serverId: null
}