X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=server%2Fmodels%2Fvideo%2Fvideo-caption.ts;h=bbda0f3eeb60626a7607776df62ae9d913f6f20c;hb=fd6a74a83594bfb59e28bf9cae71a39884ebcc2f;hp=d2c742b66b4123af53fae2545d74416cade4655b;hpb=5ec3cbdf22fc88ebe57f370fc0bc0e3df7453458;p=github%2FChocobozzz%2FPeerTube.git diff --git a/server/models/video/video-caption.ts b/server/models/video/video-caption.ts index d2c742b66..bbda0f3ee 100644 --- a/server/models/video/video-caption.ts +++ b/server/models/video/video-caption.ts @@ -109,11 +109,12 @@ export class VideoCaptionModel extends Model { + static loadByVideoIdAndLanguage (videoId: string | number, language: string, transaction?: Transaction): Promise { const videoInclude = { model: VideoModel.unscoped(), attributes: [ 'id', 'remote', 'uuid' ], - where: buildWhereIdOrUUID(videoId) + where: buildWhereIdOrUUID(videoId), + transaction } const query = { @@ -145,19 +146,21 @@ export class VideoCaptionModel extends Model { + static listVideoCaptions (videoId: number, transaction?: Transaction): Promise { const query = { order: [ [ 'language', 'ASC' ] ] as OrderItem[], where: { videoId - } + }, + transaction } return VideoCaptionModel.scope(ScopeNames.WITH_VIDEO_UUID_AND_REMOTE).findAll(query) @@ -211,4 +214,10 @@ export class VideoCaptionModel extends Model