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/video/video-caption.ts | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'server/models/video/video-caption.ts') diff --git a/server/models/video/video-caption.ts b/server/models/video/video-caption.ts index a01565851..9ce350d12 100644 --- a/server/models/video/video-caption.ts +++ b/server/models/video/video-caption.ts @@ -21,6 +21,8 @@ import { join } from 'path' import { logger } from '../../helpers/logger' import { remove } from 'fs-extra' import { CONFIG } from '../../initializers/config' +import * as Bluebird from 'bluebird' +import { MVideoCaptionVideo } from '@server/typings/models' export enum ScopeNames { WITH_VIDEO_UUID_AND_REMOTE = 'WITH_VIDEO_UUID_AND_REMOTE' @@ -30,7 +32,7 @@ export enum ScopeNames { [ScopeNames.WITH_VIDEO_UUID_AND_REMOTE]: { include: [ { - attributes: [ 'uuid', 'remote' ], + attributes: [ 'id', 'uuid', 'remote' ], model: VideoModel.unscoped(), required: true } @@ -93,7 +95,7 @@ export class VideoCaptionModel extends Model { return undefined } - static loadByVideoIdAndLanguage (videoId: string | number, language: string) { + static loadByVideoIdAndLanguage (videoId: string | number, language: string): Bluebird { const videoInclude = { model: VideoModel.unscoped(), attributes: [ 'id', 'remote', 'uuid' ], @@ -122,7 +124,7 @@ export class VideoCaptionModel extends Model { .then(([ caption ]) => caption) } - static listVideoCaptions (videoId: number) { + static listVideoCaptions (videoId: number): Bluebird { const query = { order: [ [ 'language', 'ASC' ] ] as OrderItem[], where: { -- cgit v1.2.3