From e94fc29706cd8e8fd892182d4de0a3ae80a3820f Mon Sep 17 00:00:00 2001
From: Chocobozzz <me@florianbigard.com>
Date: Mon, 18 Jun 2018 10:24:53 +0200
Subject: Fix removing scheduled update

---
 server/models/video/schedule-video-update.ts | 11 +++++++++++
 1 file changed, 11 insertions(+)

(limited to 'server/models/video')

diff --git a/server/models/video/schedule-video-update.ts b/server/models/video/schedule-video-update.ts
index 3cf5f6c99..1e56562e1 100644
--- a/server/models/video/schedule-video-update.ts
+++ b/server/models/video/schedule-video-update.ts
@@ -83,6 +83,17 @@ export class ScheduleVideoUpdateModel extends Model<ScheduleVideoUpdateModel> {
     return ScheduleVideoUpdateModel.findAll(query)
   }
 
+  static deleteByVideoId (videoId: number, t: Transaction) {
+    const query = {
+      where: {
+        videoId
+      },
+      transaction: t
+    }
+
+    return ScheduleVideoUpdateModel.destroy(query)
+  }
+
   toFormattedJSON () {
     return {
       updateAt: this.updateAt,
-- 
cgit v1.2.3