diff options
Diffstat (limited to 'server/controllers/api/videos/index.ts')
-rw-r--r-- | server/controllers/api/videos/index.ts | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/server/controllers/api/videos/index.ts b/server/controllers/api/videos/index.ts index 3a19fe989..7a9cd9d37 100644 --- a/server/controllers/api/videos/index.ts +++ b/server/controllers/api/videos/index.ts | |||
@@ -157,6 +157,7 @@ function addVideoRetryWrapper (req: express.Request, res: express.Response, next | |||
157 | 157 | ||
158 | function addVideo (req: express.Request, res: express.Response, videoPhysicalFile: Express.Multer.File) { | 158 | function addVideo (req: express.Request, res: express.Response, videoPhysicalFile: Express.Multer.File) { |
159 | const videoInfo: VideoCreate = req.body | 159 | const videoInfo: VideoCreate = req.body |
160 | let videoUUID = '' | ||
160 | 161 | ||
161 | return db.sequelize.transaction(t => { | 162 | return db.sequelize.transaction(t => { |
162 | const user = res.locals.oauth.token.User | 163 | const user = res.locals.oauth.token.User |
@@ -241,6 +242,7 @@ function addVideo (req: express.Request, res: express.Response, videoPhysicalFil | |||
241 | .then(videoCreated => { | 242 | .then(videoCreated => { |
242 | // Do not forget to add Author information to the created video | 243 | // Do not forget to add Author information to the created video |
243 | videoCreated.Author = author | 244 | videoCreated.Author = author |
245 | videoUUID = videoCreated.uuid | ||
244 | 246 | ||
245 | return { tagInstances, video: videoCreated, videoFile } | 247 | return { tagInstances, video: videoCreated, videoFile } |
246 | }) | 248 | }) |
@@ -274,7 +276,7 @@ function addVideo (req: express.Request, res: express.Response, videoPhysicalFil | |||
274 | }) | 276 | }) |
275 | }) | 277 | }) |
276 | }) | 278 | }) |
277 | .then(() => logger.info('Video with name %s created.', videoInfo.name)) | 279 | .then(() => logger.info('Video with name %s and uuid %s created.', videoInfo.name, videoUUID)) |
278 | .catch((err: Error) => { | 280 | .catch((err: Error) => { |
279 | logger.debug('Cannot insert the video.', err) | 281 | logger.debug('Cannot insert the video.', err) |
280 | throw err | 282 | throw err |
@@ -342,7 +344,7 @@ function updateVideo (req: express.Request, res: express.Response) { | |||
342 | }) | 344 | }) |
343 | }) | 345 | }) |
344 | .then(() => { | 346 | .then(() => { |
345 | logger.info('Video with name %s updated.', videoInstance.name) | 347 | logger.info('Video with name %s and uuid %s updated.', videoInstance.name, videoInstance.uuid) |
346 | }) | 348 | }) |
347 | .catch(err => { | 349 | .catch(err => { |
348 | logger.debug('Cannot update the video.', err) | 350 | logger.debug('Cannot update the video.', err) |
@@ -398,7 +400,10 @@ function removeVideo (req: express.Request, res: express.Response, next: express | |||
398 | const videoInstance = res.locals.video | 400 | const videoInstance = res.locals.video |
399 | 401 | ||
400 | videoInstance.destroy() | 402 | videoInstance.destroy() |
401 | .then(() => res.type('json').status(204).end()) | 403 | .then(() => { |
404 | logger.info('Video with name %s and uuid %s deleted.', videoInstance.name, videoInstance.uuid) | ||
405 | res.type('json').status(204).end() | ||
406 | }) | ||
402 | .catch(err => { | 407 | .catch(err => { |
403 | logger.error('Errors when removed the video.', err) | 408 | logger.error('Errors when removed the video.', err) |
404 | return next(err) | 409 | return next(err) |