From 453e83ea5d81d203ba34bc43cd5c2c750ba40568 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Thu, 15 Aug 2019 11:53:26 +0200 Subject: Stronger model typings --- server/models/redundancy/video-redundancy.ts | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'server/models/redundancy/video-redundancy.ts') diff --git a/server/models/redundancy/video-redundancy.ts b/server/models/redundancy/video-redundancy.ts index 3df1c4f9c..1c216b300 100644 --- a/server/models/redundancy/video-redundancy.ts +++ b/server/models/redundancy/video-redundancy.ts @@ -30,6 +30,7 @@ import * as Bluebird from 'bluebird' import { col, FindOptions, fn, literal, Op, Transaction } from 'sequelize' import { VideoStreamingPlaylistModel } from '../video/video-streaming-playlist' import { CONFIG } from '../../initializers/config' +import { MVideoRedundancy, MVideoRedundancyVideo } from '@server/typings/models' export enum ScopeNames { WITH_VIDEO = 'WITH_VIDEO' @@ -166,7 +167,7 @@ export class VideoRedundancyModel extends Model { return undefined } - static async loadLocalByFileId (videoFileId: number) { + static async loadLocalByFileId (videoFileId: number): Promise { const actor = await getServerActor() const query = { @@ -179,7 +180,7 @@ export class VideoRedundancyModel extends Model { return VideoRedundancyModel.scope(ScopeNames.WITH_VIDEO).findOne(query) } - static async loadLocalByStreamingPlaylistId (videoStreamingPlaylistId: number) { + static async loadLocalByStreamingPlaylistId (videoStreamingPlaylistId: number): Promise { const actor = await getServerActor() const query = { @@ -192,7 +193,7 @@ export class VideoRedundancyModel extends Model { return VideoRedundancyModel.scope(ScopeNames.WITH_VIDEO).findOne(query) } - static loadByUrl (url: string, transaction?: Transaction) { + static loadByUrl (url: string, transaction?: Transaction): Bluebird { const query = { where: { url @@ -306,7 +307,7 @@ export class VideoRedundancyModel extends Model { return VideoRedundancyModel.getVideoSample(VideoModel.unscoped().findAll(query)) } - static async loadOldestLocalThatAlreadyExpired (strategy: VideoRedundancyStrategy, expiresAfterMs: number) { + static async loadOldestLocalExpired (strategy: VideoRedundancyStrategy, expiresAfterMs: number): Promise { const expiredDate = new Date() expiredDate.setMilliseconds(expiredDate.getMilliseconds() - expiresAfterMs) -- cgit v1.2.3 From b5fecbf44192144d1ca27c23a0b53922de288c10 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Wed, 21 Aug 2019 14:31:57 +0200 Subject: Type toActivityPubObject functions --- server/models/redundancy/video-redundancy.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'server/models/redundancy/video-redundancy.ts') diff --git a/server/models/redundancy/video-redundancy.ts b/server/models/redundancy/video-redundancy.ts index 1c216b300..61d9a5612 100644 --- a/server/models/redundancy/video-redundancy.ts +++ b/server/models/redundancy/video-redundancy.ts @@ -30,7 +30,7 @@ import * as Bluebird from 'bluebird' import { col, FindOptions, fn, literal, Op, Transaction } from 'sequelize' import { VideoStreamingPlaylistModel } from '../video/video-streaming-playlist' import { CONFIG } from '../../initializers/config' -import { MVideoRedundancy, MVideoRedundancyVideo } from '@server/typings/models' +import { MVideoRedundancy, MVideoRedundancyAP, MVideoRedundancyVideo } from '@server/typings/models' export enum ScopeNames { WITH_VIDEO = 'WITH_VIDEO' @@ -488,7 +488,7 @@ export class VideoRedundancyModel extends Model { return !!this.strategy } - toActivityPubObject (): CacheFileObject { + toActivityPubObject (this: MVideoRedundancyAP): CacheFileObject { if (this.VideoStreamingPlaylist) { return { id: this.url, -- cgit v1.2.3