X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=server%2Fcontrollers%2Fapi%2Fvideos%2Fcaptions.ts;h=44c255232bd83cd8d467139091d32c03c89672cd;hb=b6a1dd4d1b3b0032f8b968e72cbd074f646e8827;hp=9b36613688a58c46fdc715d0a90848162196d759;hpb=88108880bbdba473cfe36ecbebc1c3c4f972e102;p=github%2FChocobozzz%2FPeerTube.git diff --git a/server/controllers/api/videos/captions.ts b/server/controllers/api/videos/captions.ts index 9b3661368..44c255232 100644 --- a/server/controllers/api/videos/captions.ts +++ b/server/controllers/api/videos/captions.ts @@ -2,13 +2,14 @@ import * as express from 'express' import { asyncMiddleware, asyncRetryTransactionMiddleware, authenticate } from '../../../middlewares' import { addVideoCaptionValidator, deleteVideoCaptionValidator, listVideoCaptionsValidator } from '../../../middlewares/validators' import { createReqFiles } from '../../../helpers/express-utils' -import { CONFIG, MIMETYPES, sequelizeTypescript } from '../../../initializers' +import { MIMETYPES } from '../../../initializers/constants' import { getFormattedObjects } from '../../../helpers/utils' import { VideoCaptionModel } from '../../../models/video/video-caption' -import { VideoModel } from '../../../models/video/video' import { logger } from '../../../helpers/logger' import { federateVideoIfNeeded } from '../../../lib/activitypub' import { moveAndProcessCaptionFile } from '../../../helpers/captions-utils' +import { CONFIG } from '../../../initializers/config' +import { sequelizeTypescript } from '../../../initializers/database' const reqVideoCaptionAdd = createReqFiles( [ 'captionfile' ], @@ -52,7 +53,7 @@ async function listVideoCaptions (req: express.Request, res: express.Response) { async function addVideoCaption (req: express.Request, res: express.Response) { const videoCaptionPhysicalFile = req.files['captionfile'][0] - const video = res.locals.video as VideoModel + const video = res.locals.video const videoCaption = new VideoCaptionModel({ videoId: video.id, @@ -74,8 +75,8 @@ async function addVideoCaption (req: express.Request, res: express.Response) { } async function deleteVideoCaption (req: express.Request, res: express.Response) { - const video = res.locals.video as VideoModel - const videoCaption = res.locals.videoCaption as VideoCaptionModel + const video = res.locals.video + const videoCaption = res.locals.videoCaption await sequelizeTypescript.transaction(async t => { await videoCaption.destroy({ transaction: t })