aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/models/video
diff options
context:
space:
mode:
Diffstat (limited to 'server/models/video')
-rw-r--r--server/models/video/schedule-video-update.ts24
1 files changed, 5 insertions, 19 deletions
diff --git a/server/models/video/schedule-video-update.ts b/server/models/video/schedule-video-update.ts
index b0952c431..d462c20c7 100644
--- a/server/models/video/schedule-video-update.ts
+++ b/server/models/video/schedule-video-update.ts
@@ -1,9 +1,9 @@
1import { Op, Transaction } from 'sequelize' 1import { Op, Transaction } from 'sequelize'
2import { AllowNull, BelongsTo, Column, CreatedAt, Default, ForeignKey, Model, Table, UpdatedAt } from 'sequelize-typescript' 2import { AllowNull, BelongsTo, Column, CreatedAt, Default, ForeignKey, Model, Table, UpdatedAt } from 'sequelize-typescript'
3import { MScheduleVideoUpdateFormattable, MScheduleVideoUpdateVideoAll } from '@server/types/models' 3import { MScheduleVideoUpdateFormattable, MScheduleVideoUpdate } from '@server/types/models'
4import { AttributesOnly } from '@shared/core-utils' 4import { AttributesOnly } from '@shared/core-utils'
5import { VideoPrivacy } from '../../../shared/models/videos' 5import { VideoPrivacy } from '../../../shared/models/videos'
6import { ScopeNames as VideoScopeNames, VideoModel } from './video' 6import { VideoModel } from './video'
7 7
8@Table({ 8@Table({
9 tableName: 'scheduleVideoUpdate', 9 tableName: 'scheduleVideoUpdate',
@@ -62,31 +62,17 @@ export class ScheduleVideoUpdateModel extends Model<Partial<AttributesOnly<Sched
62 .then(res => !!res) 62 .then(res => !!res)
63 } 63 }
64 64
65 static listVideosToUpdate (t: Transaction) { 65 static listVideosToUpdate (transaction?: Transaction) {
66 const query = { 66 const query = {
67 where: { 67 where: {
68 updateAt: { 68 updateAt: {
69 [Op.lte]: new Date() 69 [Op.lte]: new Date()
70 } 70 }
71 }, 71 },
72 include: [ 72 transaction
73 {
74 model: VideoModel.scope(
75 [
76 VideoScopeNames.WITH_WEBTORRENT_FILES,
77 VideoScopeNames.WITH_STREAMING_PLAYLISTS,
78 VideoScopeNames.WITH_ACCOUNT_DETAILS,
79 VideoScopeNames.WITH_BLACKLISTED,
80 VideoScopeNames.WITH_THUMBNAILS,
81 VideoScopeNames.WITH_TAGS
82 ]
83 )
84 }
85 ],
86 transaction: t
87 } 73 }
88 74
89 return ScheduleVideoUpdateModel.findAll<MScheduleVideoUpdateVideoAll>(query) 75 return ScheduleVideoUpdateModel.findAll<MScheduleVideoUpdate>(query)
90 } 76 }
91 77
92 static deleteByVideoId (videoId: number, t: Transaction) { 78 static deleteByVideoId (videoId: number, t: Transaction) {