diff options
author | Chocobozzz <florian.bigard@gmail.com> | 2017-10-26 11:26:35 +0200 |
---|---|---|
committer | Chocobozzz <florian.bigard@gmail.com> | 2017-10-26 11:26:35 +0200 |
commit | a041b1714715593b46805d7fd0106501770d11c3 (patch) | |
tree | 952a2fb70839c82a084252a4746ba62a0ef2e8ea /server/models/video/video.ts | |
parent | 51c443dbe0284c5ec54033be06f554ec37397bce (diff) | |
download | PeerTube-a041b1714715593b46805d7fd0106501770d11c3.tar.gz PeerTube-a041b1714715593b46805d7fd0106501770d11c3.tar.zst PeerTube-a041b1714715593b46805d7fd0106501770d11c3.zip |
Reset video fields when remote update fails
Diffstat (limited to 'server/models/video/video.ts')
-rw-r--r-- | server/models/video/video.ts | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/server/models/video/video.ts b/server/models/video/video.ts index d9b976404..01a801da3 100644 --- a/server/models/video/video.ts +++ b/server/models/video/video.ts | |||
@@ -80,6 +80,7 @@ let listOwnedAndPopulateAuthorAndTags: VideoMethods.ListOwnedAndPopulateAuthorAn | |||
80 | let listOwnedByAuthor: VideoMethods.ListOwnedByAuthor | 80 | let listOwnedByAuthor: VideoMethods.ListOwnedByAuthor |
81 | let load: VideoMethods.Load | 81 | let load: VideoMethods.Load |
82 | let loadByUUID: VideoMethods.LoadByUUID | 82 | let loadByUUID: VideoMethods.LoadByUUID |
83 | let loadLocalVideoByUUID: VideoMethods.LoadLocalVideoByUUID | ||
83 | let loadAndPopulateAuthor: VideoMethods.LoadAndPopulateAuthor | 84 | let loadAndPopulateAuthor: VideoMethods.LoadAndPopulateAuthor |
84 | let loadAndPopulateAuthorAndPodAndTags: VideoMethods.LoadAndPopulateAuthorAndPodAndTags | 85 | let loadAndPopulateAuthorAndPodAndTags: VideoMethods.LoadAndPopulateAuthorAndPodAndTags |
85 | let loadByUUIDAndPopulateAuthorAndPodAndTags: VideoMethods.LoadByUUIDAndPopulateAuthorAndPodAndTags | 86 | let loadByUUIDAndPopulateAuthorAndPodAndTags: VideoMethods.LoadByUUIDAndPopulateAuthorAndPodAndTags |
@@ -247,6 +248,7 @@ export default function (sequelize: Sequelize.Sequelize, DataTypes: Sequelize.Da | |||
247 | loadAndPopulateAuthorAndPodAndTags, | 248 | loadAndPopulateAuthorAndPodAndTags, |
248 | loadByHostAndUUID, | 249 | loadByHostAndUUID, |
249 | loadByUUID, | 250 | loadByUUID, |
251 | loadLocalVideoByUUID, | ||
250 | loadByUUIDAndPopulateAuthorAndPodAndTags, | 252 | loadByUUIDAndPopulateAuthorAndPodAndTags, |
251 | searchAndPopulateAuthorAndPodAndTags | 253 | searchAndPopulateAuthorAndPodAndTags |
252 | ] | 254 | ] |
@@ -899,6 +901,20 @@ loadByUUID = function (uuid: string, t?: Sequelize.Transaction) { | |||
899 | return Video.findOne(query) | 901 | return Video.findOne(query) |
900 | } | 902 | } |
901 | 903 | ||
904 | loadLocalVideoByUUID = function (uuid: string, t?: Sequelize.Transaction) { | ||
905 | const query: Sequelize.FindOptions<VideoAttributes> = { | ||
906 | where: { | ||
907 | uuid, | ||
908 | remote: false | ||
909 | }, | ||
910 | include: [ Video['sequelize'].models.VideoFile ] | ||
911 | } | ||
912 | |||
913 | if (t !== undefined) query.transaction = t | ||
914 | |||
915 | return Video.findOne(query) | ||
916 | } | ||
917 | |||
902 | loadAndPopulateAuthor = function (id: number) { | 918 | loadAndPopulateAuthor = function (id: number) { |
903 | const options = { | 919 | const options = { |
904 | include: [ | 920 | include: [ |