From 7d9ba5c08999c6482f0bc5e0c09c6f55b7724090 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Tue, 11 May 2021 11:15:29 +0200 Subject: Cleanup models directory organization --- server/models/redundancy/video-redundancy.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'server/models/redundancy') diff --git a/server/models/redundancy/video-redundancy.ts b/server/models/redundancy/video-redundancy.ts index 53ebadeaf..b6538c8fd 100644 --- a/server/models/redundancy/video-redundancy.ts +++ b/server/models/redundancy/video-redundancy.ts @@ -29,7 +29,7 @@ import { isActivityPubUrlValid, isUrlValid } from '../../helpers/custom-validato import { logger } from '../../helpers/logger' import { CONFIG } from '../../initializers/config' import { CONSTRAINTS_FIELDS, MIMETYPES } from '../../initializers/constants' -import { ActorModel } from '../activitypub/actor' +import { ActorModel } from '../actor/actor' import { ServerModel } from '../server/server' import { getSort, getVideoSort, parseAggregateResult, throwIfNotValid } from '../utils' import { ScheduleVideoUpdateModel } from '../video/schedule-video-update' -- cgit v1.2.3 From 16c016e8b1d5ca46343d3363f9a49e24c5d7c944 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Wed, 12 May 2021 14:09:04 +0200 Subject: Stricter models typing --- server/models/redundancy/video-redundancy.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'server/models/redundancy') diff --git a/server/models/redundancy/video-redundancy.ts b/server/models/redundancy/video-redundancy.ts index b6538c8fd..ef780c2a4 100644 --- a/server/models/redundancy/video-redundancy.ts +++ b/server/models/redundancy/video-redundancy.ts @@ -16,6 +16,7 @@ import { } from 'sequelize-typescript' import { getServerActor } from '@server/models/application/application' import { MActor, MVideoForRedundancyAPI, MVideoRedundancy, MVideoRedundancyAP, MVideoRedundancyVideo } from '@server/types/models' +import { AttributesOnly } from '@shared/core-utils' import { VideoRedundanciesTarget } from '@shared/models/redundancy/video-redundancies-filters.model' import { FileRedundancyInformation, @@ -84,7 +85,7 @@ export enum ScopeNames { } ] }) -export class VideoRedundancyModel extends Model { +export class VideoRedundancyModel extends Model>> { @CreatedAt createdAt: Date -- cgit v1.2.3 From 53e7f82fe394eff220e1b76aa4d2b6018ed26267 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Wed, 26 May 2021 09:44:16 +0200 Subject: Fix redundancy max size --- server/models/redundancy/video-redundancy.ts | 44 ---------------------------- 1 file changed, 44 deletions(-) (limited to 'server/models/redundancy') diff --git a/server/models/redundancy/video-redundancy.ts b/server/models/redundancy/video-redundancy.ts index 53ebadeaf..a61c3578c 100644 --- a/server/models/redundancy/video-redundancy.ts +++ b/server/models/redundancy/video-redundancy.ts @@ -407,50 +407,6 @@ export class VideoRedundancyModel extends Model { return VideoRedundancyModel.scope([ ScopeNames.WITH_VIDEO ]).findOne(query) } - static async getTotalDuplicated (strategy: VideoRedundancyStrategy) { - const actor = await getServerActor() - const redundancyInclude = { - attributes: [], - model: VideoRedundancyModel, - required: true, - where: { - actorId: actor.id, - strategy - } - } - - const queryFiles: FindOptions = { - include: [ redundancyInclude ] - } - - const queryStreamingPlaylists: FindOptions = { - include: [ - { - attributes: [], - model: VideoModel.unscoped(), - required: true, - include: [ - { - required: true, - attributes: [], - model: VideoStreamingPlaylistModel.unscoped(), - include: [ - redundancyInclude - ] - } - ] - } - ] - } - - return Promise.all([ - VideoFileModel.aggregate('size', 'SUM', queryFiles), - VideoFileModel.aggregate('size', 'SUM', queryStreamingPlaylists) - ]).then(([ r1, r2 ]) => { - return parseAggregateResult(r1) + parseAggregateResult(r2) - }) - } - static async listLocalExpired () { const actor = await getServerActor() -- cgit v1.2.3 From 6c8a99d12ad1a6ffd4bc564bab48f4d4a5588ae2 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Wed, 26 May 2021 15:38:09 +0200 Subject: Fix lint --- server/models/redundancy/video-redundancy.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'server/models/redundancy') diff --git a/server/models/redundancy/video-redundancy.ts b/server/models/redundancy/video-redundancy.ts index a61c3578c..349dba513 100644 --- a/server/models/redundancy/video-redundancy.ts +++ b/server/models/redundancy/video-redundancy.ts @@ -1,5 +1,5 @@ import { sample } from 'lodash' -import { FindOptions, literal, Op, QueryTypes, Transaction, WhereOptions } from 'sequelize' +import { literal, Op, QueryTypes, Transaction, WhereOptions } from 'sequelize' import { AllowNull, BeforeDestroy, -- cgit v1.2.3