aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/models/video/video.ts
diff options
context:
space:
mode:
Diffstat (limited to 'server/models/video/video.ts')
-rw-r--r--server/models/video/video.ts21
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
84let listOwnedAndPopulateAccountAndTags: VideoMethods.ListOwnedAndPopulateAccountAndTags 84let listOwnedAndPopulateAccountAndTags: VideoMethods.ListOwnedAndPopulateAccountAndTags
85let listOwnedByAccount: VideoMethods.ListOwnedByAccount 85let listOwnedByAccount: VideoMethods.ListOwnedByAccount
86let load: VideoMethods.Load 86let load: VideoMethods.Load
87let loadByUrlAndPopulateAccount: VideoMethods.LoadByUrlAndPopulateAccount
87let loadByUUID: VideoMethods.LoadByUUID 88let loadByUUID: VideoMethods.LoadByUUID
88let loadByUUIDOrURL: VideoMethods.LoadByUUIDOrURL 89let loadByUUIDOrURL: VideoMethods.LoadByUUIDOrURL
89let loadLocalVideoByUUID: VideoMethods.LoadLocalVideoByUUID 90let 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
941loadByUrlAndPopulateAccount = 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
939loadByUUIDOrURL = function (uuid: string, url: string, t?: Sequelize.Transaction) { 960loadByUUIDOrURL = function (uuid: string, url: string, t?: Sequelize.Transaction) {
940 const query: Sequelize.FindOptions<VideoAttributes> = { 961 const query: Sequelize.FindOptions<VideoAttributes> = {
941 where: { 962 where: {