const countQuery = buildBaseQuery()
const findQuery = buildBaseQuery()
- findQuery.include.push({
- model: ScheduleVideoUpdateModel,
- required: false
- })
-
- findQuery.include.push({
- model: VideoBlacklistModel,
- required: false
- })
+ const findScopes = [
+ ScopeNames.WITH_SCHEDULED_UPDATE,
+ ScopeNames.WITH_BLACKLISTED,
+ ScopeNames.WITH_THUMBNAILS
+ ]
if (withFiles === true) {
findQuery.include.push({
return Promise.all([
VideoModel.count(countQuery),
- VideoModel.findAll(findQuery)
+ VideoModel.scope(findScopes).findAll(findQuery)
]).then(([ count, rows ]) => {
return {
data: rows,
import * as chai from 'chai'
import 'mocha'
-import { User, UserRole } from '../../../../shared/index'
+import { User, UserRole, Video } from '../../../../shared/index'
import {
blockUser,
cleanupTests,
const videos = res.body.data
expect(videos).to.have.lengthOf(1)
- expect(videos[ 0 ].name).to.equal('super user video')
+ const video: Video = videos[ 0 ]
+ expect(video.name).to.equal('super user video')
+ expect(video.thumbnailPath).to.not.be.null
+ expect(video.previewPath).to.not.be.null
})
})