buildTrigramSearchIndex,
buildWhereIdOrUUID,
createSimilarityAttribute,
- getVideoSort,
+ getVideoSort, isOutdated,
throwIfNotValid
} from '../utils'
import { TagModel } from './tag'
},
include: [
{
- model: VideoChannelModel.scope({ method: [ VideoChannelScopeNames.SUMMARY, true ] })
+ model: VideoChannelModel.scope({ method: [ VideoChannelScopeNames.SUMMARY, true ] }),
+ required: true
}
]
}
if (options.videoPlaylistId) {
query.include.push({
model: VideoPlaylistElementModel.unscoped(),
- required: true
+ required: true,
+ where: {
+ videoPlaylistId: options.videoPlaylistId
+ }
})
}
videoPlaylistId: options.videoPlaylistId
}
})
+
+ query.subQuery = false
}
if (options.filter || options.accountId || options.videoChannelId) {
apiScope.push({
method: [
ScopeNames.FOR_API, {
- ids, withFiles:
- options.withFiles,
+ ids,
+ withFiles: options.withFiles,
videoPlaylistId: options.videoPlaylistId
} as ForAPIOptions
]
isOutdated () {
if (this.isOwned()) return false
- const now = Date.now()
- const createdAtTime = this.createdAt.getTime()
- const updatedAtTime = this.updatedAt.getTime()
-
- return (now - createdAtTime) > ACTIVITY_PUB.VIDEO_REFRESH_INTERVAL &&
- (now - updatedAtTime) > ACTIVITY_PUB.VIDEO_REFRESH_INTERVAL
+ return isOutdated(this, ACTIVITY_PUB.VIDEO_REFRESH_INTERVAL)
}
setAsRefreshed () {