aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/models/redundancy/video-redundancy.ts
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2018-09-28 10:07:05 +0200
committerChocobozzz <me@florianbigard.com>2018-09-28 10:07:05 +0200
commit161b061d4e51eb1e2b2b7e9482d5299489ef7c45 (patch)
tree5b9524625b7d8dbde765eaf9799d4f272829e449 /server/models/redundancy/video-redundancy.ts
parentd0b52b5285d0797b30bca6510b7a8f840fab4697 (diff)
downloadPeerTube-161b061d4e51eb1e2b2b7e9482d5299489ef7c45.tar.gz
PeerTube-161b061d4e51eb1e2b2b7e9482d5299489ef7c45.tar.zst
PeerTube-161b061d4e51eb1e2b2b7e9482d5299489ef7c45.zip
Remove duplicated videos on unfollow/delete redundancy
Diffstat (limited to 'server/models/redundancy/video-redundancy.ts')
-rw-r--r--server/models/redundancy/video-redundancy.ts41
1 files changed, 41 insertions, 0 deletions
diff --git a/server/models/redundancy/video-redundancy.ts b/server/models/redundancy/video-redundancy.ts
index 3c87ec2c1..e67164802 100644
--- a/server/models/redundancy/video-redundancy.ts
+++ b/server/models/redundancy/video-redundancy.ts
@@ -286,6 +286,47 @@ export class VideoRedundancyModel extends Model<VideoRedundancyModel> {
286 return VideoRedundancyModel.scope([ ScopeNames.WITH_VIDEO ]).findAll(query) 286 return VideoRedundancyModel.scope([ ScopeNames.WITH_VIDEO ]).findAll(query)
287 } 287 }
288 288
289 static async listLocalOfServer (serverId: number) {
290 const actor = await getServerActor()
291
292 const query = {
293 where: {
294 actorId: actor.id
295 },
296 include: [
297 {
298 model: VideoFileModel,
299 required: true,
300 include: [
301 {
302 model: VideoModel,
303 required: true,
304 include: [
305 {
306 attributes: [],
307 model: VideoChannelModel.unscoped(),
308 required: true,
309 include: [
310 {
311 attributes: [],
312 model: ActorModel.unscoped(),
313 required: true,
314 where: {
315 serverId
316 }
317 }
318 ]
319 }
320 ]
321 }
322 ]
323 }
324 ]
325 }
326
327 return VideoRedundancyModel.findAll(query)
328 }
329
289 static async getStats (strategy: VideoRedundancyStrategy) { 330 static async getStats (strategy: VideoRedundancyStrategy) {
290 const actor = await getServerActor() 331 const actor = await getServerActor()
291 332