diff options
Diffstat (limited to 'server/models/video/video-job-info.ts')
-rw-r--r-- | server/models/video/video-job-info.ts | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/server/models/video/video-job-info.ts b/server/models/video/video-job-info.ts index 6a67a214c..7497addf1 100644 --- a/server/models/video/video-job-info.ts +++ b/server/models/video/video-job-info.ts | |||
@@ -99,4 +99,19 @@ export class VideoJobInfoModel extends Model<Partial<AttributesOnly<VideoJobInfo | |||
99 | 99 | ||
100 | return pendingMove | 100 | return pendingMove |
101 | } | 101 | } |
102 | |||
103 | static async abortAllTasks (videoUUID: string, column: VideoJobInfoColumnType): Promise<void> { | ||
104 | const options = { type: QueryTypes.UPDATE as QueryTypes.UPDATE, bind: { videoUUID } } | ||
105 | |||
106 | await VideoJobInfoModel.sequelize.query(` | ||
107 | UPDATE | ||
108 | "videoJobInfo" | ||
109 | SET | ||
110 | "${column}" = 0, | ||
111 | "updatedAt" = NOW() | ||
112 | FROM "video" | ||
113 | WHERE | ||
114 | "video"."id" = "videoJobInfo"."videoId" AND "video"."uuid" = $videoUUID | ||
115 | `, options) | ||
116 | } | ||
102 | } | 117 | } |