'required': 'Video quota is required.',
'min': 'Quota must be greater than -1.'
}
-}
\ No newline at end of file
+}
let qaduType
switch (eventData.eventType) {
- case REQUEST_VIDEO_EVENT_TYPES.VIEWS:
- columnToUpdate = 'views'
- qaduType = REQUEST_VIDEO_QADU_TYPES.VIEWS
- break
-
- case REQUEST_VIDEO_EVENT_TYPES.LIKES:
- columnToUpdate = 'likes'
- qaduType = REQUEST_VIDEO_QADU_TYPES.LIKES
- break
-
- case REQUEST_VIDEO_EVENT_TYPES.DISLIKES:
- columnToUpdate = 'dislikes'
- qaduType = REQUEST_VIDEO_QADU_TYPES.DISLIKES
- break
-
- default:
- throw new Error('Unknown video event type.')
+ case REQUEST_VIDEO_EVENT_TYPES.VIEWS:
+ columnToUpdate = 'views'
+ qaduType = REQUEST_VIDEO_QADU_TYPES.VIEWS
+ break
+
+ case REQUEST_VIDEO_EVENT_TYPES.LIKES:
+ columnToUpdate = 'likes'
+ qaduType = REQUEST_VIDEO_QADU_TYPES.LIKES
+ break
+
+ case REQUEST_VIDEO_EVENT_TYPES.DISLIKES:
+ columnToUpdate = 'dislikes'
+ qaduType = REQUEST_VIDEO_QADU_TYPES.DISLIKES
+ break
+
+ default:
+ throw new Error('Unknown video event type.')
}
const query = {}
},
SIGNUP: {
ENABLED: config.get<boolean>('signup.enabled'),
- LIMIT: config.get<number>('signup.limit'),
+ LIMIT: config.get<number>('signup.limit')
},
USER: {
VIDEO_QUOTA: config.get<number>('user.video_quota')
const THUMBNAILS_SIZE = '200x110'
const PREVIEWS_SIZE = '640x480'
-// Subfolders of cache directory
+// Sub folders of cache directory
const CACHE = {
DIRECTORIES: {
PREVIEWS: join(CONFIG.STORAGE.CACHE_DIR, 'previews')
if (!videoData) videoData = { uuid: null }
switch (request.type) {
- case REQUEST_VIDEO_QADU_TYPES.LIKES:
- videoData.likes = video.likes
- break
+ case REQUEST_VIDEO_QADU_TYPES.LIKES:
+ videoData.likes = video.likes
+ break
- case REQUEST_VIDEO_QADU_TYPES.DISLIKES:
- videoData.dislikes = video.dislikes
- break
+ case REQUEST_VIDEO_QADU_TYPES.DISLIKES:
+ videoData.dislikes = video.dislikes
+ break
- case REQUEST_VIDEO_QADU_TYPES.VIEWS:
- videoData.views = video.views
- break
+ case REQUEST_VIDEO_QADU_TYPES.VIEWS:
+ videoData.views = video.views
+ break
- default:
- logger.error('Unknown request video QADU type %s.', request.type)
- return
+ default:
+ logger.error('Unknown request video QADU type %s.', request.type)
+ return
}
// Do not forget the uuid so the remote pod can identify the video
requestsToMakeGrouped[hashKey].ids.push(request.id)
// Maybe there are multiple quick and dirty update for the same video
- // We use this hashmap to dedupe them
+ // We use this hash map to dedupe them
requestsToMakeGrouped[hashKey].videos[video.id] = videoData
})
})
- // Now we deduped similar quick and dirty updates, we can build our requests datas
+ // Now we deduped similar quick and dirty updates, we can build our requests data
Object.keys(requestsToMakeGrouped).forEach(hashKey => {
Object.keys(requestsToMakeGrouped[hashKey].videos).forEach(videoUUID => {
const videoData = requestsToMakeGrouped[hashKey].videos[videoUUID]
})
})
- // We don't need it anymore, it was just to build our datas array
+ // We don't need it anymore, it was just to build our data array
delete requestsToMakeGrouped[hashKey].videos
})
})
.then(duration => {
// Previous test failed, abort
- if (duration === undefined) return
+ if (duration === undefined) return undefined
if (!isVideoDurationValid('' + duration)) {
return res.status(400).send('Duration of the video file is too big (max: ' + CONSTRAINTS_FIELDS.VIDEOS.DURATION.max + 's).')
import * as Promise from 'bluebird'
import { TagInstance } from './tag-interface'
-import { UserInstance } from '../user/user-interface'
import {
logger,
isVideoNameValid,