aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/models/redundancy/video-redundancy.ts
diff options
context:
space:
mode:
Diffstat (limited to 'server/models/redundancy/video-redundancy.ts')
-rw-r--r--server/models/redundancy/video-redundancy.ts32
1 files changed, 32 insertions, 0 deletions
diff --git a/server/models/redundancy/video-redundancy.ts b/server/models/redundancy/video-redundancy.ts
index e67164802..791ba3137 100644
--- a/server/models/redundancy/video-redundancy.ts
+++ b/server/models/redundancy/video-redundancy.ts
@@ -146,6 +146,38 @@ export class VideoRedundancyModel extends Model<VideoRedundancyModel> {
146 return VideoRedundancyModel.findOne(query) 146 return VideoRedundancyModel.findOne(query)
147 } 147 }
148 148
149 static async isLocalByVideoUUIDExists (uuid: string) {
150 const actor = await getServerActor()
151
152 const query = {
153 raw: true,
154 attributes: [ 'id' ],
155 where: {
156 actorId: actor.id
157 },
158 include: [
159 {
160 attributes: [ ],
161 model: VideoFileModel,
162 required: true,
163 include: [
164 {
165 attributes: [ ],
166 model: VideoModel,
167 required: true,
168 where: {
169 uuid
170 }
171 }
172 ]
173 }
174 ]
175 }
176
177 return VideoRedundancyModel.findOne(query)
178 .then(r => !!r)
179 }
180
149 static async getVideoSample (p: Bluebird<VideoModel[]>) { 181 static async getVideoSample (p: Bluebird<VideoModel[]>) {
150 const rows = await p 182 const rows = await p
151 const ids = rows.map(r => r.id) 183 const ids = rows.map(r => r.id)