import { asyncMiddleware, asyncRetryTransactionMiddleware, authenticate } from '../../../middlewares'
import { addVideoCaptionValidator, deleteVideoCaptionValidator, listVideoCaptionsValidator } from '../../../middlewares/validators'
import { createReqFiles } from '../../../helpers/express-utils'
import { asyncMiddleware, asyncRetryTransactionMiddleware, authenticate } from '../../../middlewares'
import { addVideoCaptionValidator, deleteVideoCaptionValidator, listVideoCaptionsValidator } from '../../../middlewares/validators'
import { createReqFiles } from '../../../helpers/express-utils'
import { getFormattedObjects } from '../../../helpers/utils'
import { VideoCaptionModel } from '../../../models/video/video-caption'
import { getFormattedObjects } from '../../../helpers/utils'
import { VideoCaptionModel } from '../../../models/video/video-caption'
// ---------------------------------------------------------------------------
async function listVideoCaptions (req: express.Request, res: express.Response) {
// ---------------------------------------------------------------------------
async function listVideoCaptions (req: express.Request, res: express.Response) {
return res.json(getFormattedObjects(data, data.length))
}
async function addVideoCaption (req: express.Request, res: express.Response) {
const videoCaptionPhysicalFile = req.files['captionfile'][0]
return res.json(getFormattedObjects(data, data.length))
}
async function addVideoCaption (req: express.Request, res: express.Response) {
const videoCaptionPhysicalFile = req.files['captionfile'][0]
videoCaption.Video = video
// Move physical file
await moveAndProcessCaptionFile(videoCaptionPhysicalFile, videoCaption)
await sequelizeTypescript.transaction(async t => {
videoCaption.Video = video
// Move physical file
await moveAndProcessCaptionFile(videoCaptionPhysicalFile, videoCaption)
await sequelizeTypescript.transaction(async t => {
- await VideoCaptionModel.insertOrReplaceLanguage(video.id, req.params.captionLanguage, t)
+ await VideoCaptionModel.insertOrReplaceLanguage(video.id, req.params.captionLanguage, null, t)