diff options
Diffstat (limited to 'server/models/video/video.ts')
-rw-r--r-- | server/models/video/video.ts | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/server/models/video/video.ts b/server/models/video/video.ts index 64ee7ae34..5b0377c2e 100644 --- a/server/models/video/video.ts +++ b/server/models/video/video.ts | |||
@@ -84,6 +84,7 @@ let loadByHostAndUUID: VideoMethods.LoadByHostAndUUID | |||
84 | let listOwnedAndPopulateAccountAndTags: VideoMethods.ListOwnedAndPopulateAccountAndTags | 84 | let listOwnedAndPopulateAccountAndTags: VideoMethods.ListOwnedAndPopulateAccountAndTags |
85 | let listOwnedByAccount: VideoMethods.ListOwnedByAccount | 85 | let listOwnedByAccount: VideoMethods.ListOwnedByAccount |
86 | let load: VideoMethods.Load | 86 | let load: VideoMethods.Load |
87 | let loadByUrlAndPopulateAccount: VideoMethods.LoadByUrlAndPopulateAccount | ||
87 | let loadByUUID: VideoMethods.LoadByUUID | 88 | let loadByUUID: VideoMethods.LoadByUUID |
88 | let loadByUUIDOrURL: VideoMethods.LoadByUUIDOrURL | 89 | let loadByUUIDOrURL: VideoMethods.LoadByUUIDOrURL |
89 | let loadLocalVideoByUUID: VideoMethods.LoadLocalVideoByUUID | 90 | let loadLocalVideoByUUID: VideoMethods.LoadLocalVideoByUUID |
@@ -271,6 +272,7 @@ export default function (sequelize: Sequelize.Sequelize, DataTypes: Sequelize.Da | |||
271 | listOwnedAndPopulateAccountAndTags, | 272 | listOwnedAndPopulateAccountAndTags, |
272 | listOwnedByAccount, | 273 | listOwnedByAccount, |
273 | load, | 274 | load, |
275 | loadByUrlAndPopulateAccount, | ||
274 | loadAndPopulateAccount, | 276 | loadAndPopulateAccount, |
275 | loadAndPopulateAccountAndServerAndTags, | 277 | loadAndPopulateAccountAndServerAndTags, |
276 | loadByHostAndUUID, | 278 | loadByHostAndUUID, |
@@ -936,6 +938,25 @@ loadByUUID = function (uuid: string, t?: Sequelize.Transaction) { | |||
936 | return Video.findOne(query) | 938 | return Video.findOne(query) |
937 | } | 939 | } |
938 | 940 | ||
941 | loadByUrlAndPopulateAccount = function (url: string, t?: Sequelize.Transaction) { | ||
942 | const query: Sequelize.FindOptions<VideoAttributes> = { | ||
943 | where: { | ||
944 | url | ||
945 | }, | ||
946 | include: [ | ||
947 | Video['sequelize'].models.VideoFile, | ||
948 | { | ||
949 | model: Video['sequelize'].models.VideoChannel, | ||
950 | include: [ Video['sequelize'].models.Account ] | ||
951 | } | ||
952 | ] | ||
953 | } | ||
954 | |||
955 | if (t !== undefined) query.transaction = t | ||
956 | |||
957 | return Video.findOne(query) | ||
958 | } | ||
959 | |||
939 | loadByUUIDOrURL = function (uuid: string, url: string, t?: Sequelize.Transaction) { | 960 | loadByUUIDOrURL = function (uuid: string, url: string, t?: Sequelize.Transaction) { |
940 | const query: Sequelize.FindOptions<VideoAttributes> = { | 961 | const query: Sequelize.FindOptions<VideoAttributes> = { |
941 | where: { | 962 | where: { |