aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/models/video
diff options
context:
space:
mode:
Diffstat (limited to 'server/models/video')
-rw-r--r--server/models/video/video-interface.ts2
-rw-r--r--server/models/video/video.ts16
2 files changed, 18 insertions, 0 deletions
diff --git a/server/models/video/video-interface.ts b/server/models/video/video-interface.ts
index dd457bb00..2afbaf09e 100644
--- a/server/models/video/video-interface.ts
+++ b/server/models/video/video-interface.ts
@@ -57,6 +57,7 @@ export namespace VideoMethods {
57 57
58 export type Load = (id: number) => Promise<VideoInstance> 58 export type Load = (id: number) => Promise<VideoInstance>
59 export type LoadByUUID = (uuid: string, t?: Sequelize.Transaction) => Promise<VideoInstance> 59 export type LoadByUUID = (uuid: string, t?: Sequelize.Transaction) => Promise<VideoInstance>
60 export type LoadLocalVideoByUUID = (uuid: string, t?: Sequelize.Transaction) => Promise<VideoInstance>
60 export type LoadByHostAndUUID = (fromHost: string, uuid: string, t?: Sequelize.Transaction) => Promise<VideoInstance> 61 export type LoadByHostAndUUID = (fromHost: string, uuid: string, t?: Sequelize.Transaction) => Promise<VideoInstance>
61 export type LoadAndPopulateAuthor = (id: number) => Promise<VideoInstance> 62 export type LoadAndPopulateAuthor = (id: number) => Promise<VideoInstance>
62 export type LoadAndPopulateAuthorAndPodAndTags = (id: number) => Promise<VideoInstance> 63 export type LoadAndPopulateAuthorAndPodAndTags = (id: number) => Promise<VideoInstance>
@@ -79,6 +80,7 @@ export interface VideoClass {
79 loadAndPopulateAuthorAndPodAndTags: VideoMethods.LoadAndPopulateAuthorAndPodAndTags 80 loadAndPopulateAuthorAndPodAndTags: VideoMethods.LoadAndPopulateAuthorAndPodAndTags
80 loadByHostAndUUID: VideoMethods.LoadByHostAndUUID 81 loadByHostAndUUID: VideoMethods.LoadByHostAndUUID
81 loadByUUID: VideoMethods.LoadByUUID 82 loadByUUID: VideoMethods.LoadByUUID
83 loadLocalVideoByUUID: VideoMethods.LoadLocalVideoByUUID
82 loadByUUIDAndPopulateAuthorAndPodAndTags: VideoMethods.LoadByUUIDAndPopulateAuthorAndPodAndTags 84 loadByUUIDAndPopulateAuthorAndPodAndTags: VideoMethods.LoadByUUIDAndPopulateAuthorAndPodAndTags
83 searchAndPopulateAuthorAndPodAndTags: VideoMethods.SearchAndPopulateAuthorAndPodAndTags 85 searchAndPopulateAuthorAndPodAndTags: VideoMethods.SearchAndPopulateAuthorAndPodAndTags
84} 86}
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
80let listOwnedByAuthor: VideoMethods.ListOwnedByAuthor 80let listOwnedByAuthor: VideoMethods.ListOwnedByAuthor
81let load: VideoMethods.Load 81let load: VideoMethods.Load
82let loadByUUID: VideoMethods.LoadByUUID 82let loadByUUID: VideoMethods.LoadByUUID
83let loadLocalVideoByUUID: VideoMethods.LoadLocalVideoByUUID
83let loadAndPopulateAuthor: VideoMethods.LoadAndPopulateAuthor 84let loadAndPopulateAuthor: VideoMethods.LoadAndPopulateAuthor
84let loadAndPopulateAuthorAndPodAndTags: VideoMethods.LoadAndPopulateAuthorAndPodAndTags 85let loadAndPopulateAuthorAndPodAndTags: VideoMethods.LoadAndPopulateAuthorAndPodAndTags
85let loadByUUIDAndPopulateAuthorAndPodAndTags: VideoMethods.LoadByUUIDAndPopulateAuthorAndPodAndTags 86let 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
904loadLocalVideoByUUID = 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
902loadAndPopulateAuthor = function (id: number) { 918loadAndPopulateAuthor = function (id: number) {
903 const options = { 919 const options = {
904 include: [ 920 include: [