import { UserModel } from '../user/user'
import { UserVideoHistoryModel } from '../user/user-video-history'
import { buildTrigramSearchIndex, buildWhereIdOrUUID, getVideoSort, isOutdated, throwIfNotValid } from '../utils'
+import { VideoViewModel } from '../view/video-view'
import {
videoFilesModelToFormattedJSON,
VideoFormattingJSONOptions,
import { VideoShareModel } from './video-share'
import { VideoStreamingPlaylistModel } from './video-streaming-playlist'
import { VideoTagModel } from './video-tag'
-import { VideoViewModel } from './video-view'
export enum ScopeNames {
FOR_API = 'FOR_API',
logger.info('Stopping live of video %s after video deletion.', instance.uuid)
- LiveManager.Instance.stopSessionOf(instance.id)
+ LiveManager.Instance.stopSessionOf(instance.id, null)
}
@BeforeDestroy
}) {
const { accountId, channelId, start, count, sort, search, isLive } = options
- function buildBaseQuery (): FindOptions {
+ function buildBaseQuery (forCount: boolean): FindOptions {
const where: WhereOptions = {}
if (search) {
where: channelWhere,
include: [
{
- model: AccountModel,
+ model: forCount
+ ? AccountModel.unscoped()
+ : AccountModel,
where: {
id: accountId
},
return baseQuery
}
- const countQuery = buildBaseQuery()
- const findQuery = buildBaseQuery()
+ const countQuery = buildBaseQuery(true)
+ const findQuery = buildBaseQuery(false)
const findScopes: (string | ScopeOptions)[] = [
ScopeNames.WITH_SCHEDULED_UPDATE,