function addVideo (req: express.Request, res: express.Response, videoPhysicalFile: Express.Multer.File) {
const videoInfo: VideoCreate = req.body
+ let videoUUID = ''
return db.sequelize.transaction(t => {
const user = res.locals.oauth.token.User
.then(videoCreated => {
// Do not forget to add Author information to the created video
videoCreated.Author = author
+ videoUUID = videoCreated.uuid
return { tagInstances, video: videoCreated, videoFile }
})
})
})
})
- .then(() => logger.info('Video with name %s created.', videoInfo.name))
+ .then(() => logger.info('Video with name %s and uuid %s created.', videoInfo.name, videoUUID))
.catch((err: Error) => {
logger.debug('Cannot insert the video.', err)
throw err
})
})
.then(() => {
- logger.info('Video with name %s updated.', videoInstance.name)
+ logger.info('Video with name %s and uuid %s updated.', videoInstance.name, videoInstance.uuid)
})
.catch(err => {
logger.debug('Cannot update the video.', err)
const videoInstance = res.locals.video
videoInstance.destroy()
- .then(() => res.type('json').status(204).end())
+ .then(() => {
+ logger.info('Video with name %s and uuid %s deleted.', videoInstance.name, videoInstance.uuid)
+ res.type('json').status(204).end()
+ })
.catch(err => {
logger.error('Errors when removed the video.', err)
return next(err)