Make tslint happy
This commit is contained in:
parent
8221fef0f9
commit
980246ea8f
|
@ -28,4 +28,4 @@ export const USER_VIDEO_QUOTA = {
|
||||||
'required': 'Video quota is required.',
|
'required': 'Video quota is required.',
|
||||||
'min': 'Quota must be greater than -1.'
|
'min': 'Quota must be greater than -1.'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -141,23 +141,23 @@ function processVideosEvents (eventData: RemoteVideoEventData, fromPod: PodInsta
|
||||||
let qaduType
|
let qaduType
|
||||||
|
|
||||||
switch (eventData.eventType) {
|
switch (eventData.eventType) {
|
||||||
case REQUEST_VIDEO_EVENT_TYPES.VIEWS:
|
case REQUEST_VIDEO_EVENT_TYPES.VIEWS:
|
||||||
columnToUpdate = 'views'
|
columnToUpdate = 'views'
|
||||||
qaduType = REQUEST_VIDEO_QADU_TYPES.VIEWS
|
qaduType = REQUEST_VIDEO_QADU_TYPES.VIEWS
|
||||||
break
|
break
|
||||||
|
|
||||||
case REQUEST_VIDEO_EVENT_TYPES.LIKES:
|
case REQUEST_VIDEO_EVENT_TYPES.LIKES:
|
||||||
columnToUpdate = 'likes'
|
columnToUpdate = 'likes'
|
||||||
qaduType = REQUEST_VIDEO_QADU_TYPES.LIKES
|
qaduType = REQUEST_VIDEO_QADU_TYPES.LIKES
|
||||||
break
|
break
|
||||||
|
|
||||||
case REQUEST_VIDEO_EVENT_TYPES.DISLIKES:
|
case REQUEST_VIDEO_EVENT_TYPES.DISLIKES:
|
||||||
columnToUpdate = 'dislikes'
|
columnToUpdate = 'dislikes'
|
||||||
qaduType = REQUEST_VIDEO_QADU_TYPES.DISLIKES
|
qaduType = REQUEST_VIDEO_QADU_TYPES.DISLIKES
|
||||||
break
|
break
|
||||||
|
|
||||||
default:
|
default:
|
||||||
throw new Error('Unknown video event type.')
|
throw new Error('Unknown video event type.')
|
||||||
}
|
}
|
||||||
|
|
||||||
const query = {}
|
const query = {}
|
||||||
|
|
|
@ -77,7 +77,7 @@ const CONFIG = {
|
||||||
},
|
},
|
||||||
SIGNUP: {
|
SIGNUP: {
|
||||||
ENABLED: config.get<boolean>('signup.enabled'),
|
ENABLED: config.get<boolean>('signup.enabled'),
|
||||||
LIMIT: config.get<number>('signup.limit'),
|
LIMIT: config.get<number>('signup.limit')
|
||||||
},
|
},
|
||||||
USER: {
|
USER: {
|
||||||
VIDEO_QUOTA: config.get<number>('user.video_quota')
|
VIDEO_QUOTA: config.get<number>('user.video_quota')
|
||||||
|
@ -298,7 +298,7 @@ let STATIC_MAX_AGE = '30d'
|
||||||
const THUMBNAILS_SIZE = '200x110'
|
const THUMBNAILS_SIZE = '200x110'
|
||||||
const PREVIEWS_SIZE = '640x480'
|
const PREVIEWS_SIZE = '640x480'
|
||||||
|
|
||||||
// Subfolders of cache directory
|
// Sub folders of cache directory
|
||||||
const CACHE = {
|
const CACHE = {
|
||||||
DIRECTORIES: {
|
DIRECTORIES: {
|
||||||
PREVIEWS: join(CONFIG.STORAGE.CACHE_DIR, 'previews')
|
PREVIEWS: join(CONFIG.STORAGE.CACHE_DIR, 'previews')
|
||||||
|
|
|
@ -81,21 +81,21 @@ class RequestVideoQaduScheduler extends AbstractRequestScheduler<RequestsVideoQa
|
||||||
if (!videoData) videoData = { uuid: null }
|
if (!videoData) videoData = { uuid: null }
|
||||||
|
|
||||||
switch (request.type) {
|
switch (request.type) {
|
||||||
case REQUEST_VIDEO_QADU_TYPES.LIKES:
|
case REQUEST_VIDEO_QADU_TYPES.LIKES:
|
||||||
videoData.likes = video.likes
|
videoData.likes = video.likes
|
||||||
break
|
break
|
||||||
|
|
||||||
case REQUEST_VIDEO_QADU_TYPES.DISLIKES:
|
case REQUEST_VIDEO_QADU_TYPES.DISLIKES:
|
||||||
videoData.dislikes = video.dislikes
|
videoData.dislikes = video.dislikes
|
||||||
break
|
break
|
||||||
|
|
||||||
case REQUEST_VIDEO_QADU_TYPES.VIEWS:
|
case REQUEST_VIDEO_QADU_TYPES.VIEWS:
|
||||||
videoData.views = video.views
|
videoData.views = video.views
|
||||||
break
|
break
|
||||||
|
|
||||||
default:
|
default:
|
||||||
logger.error('Unknown request video QADU type %s.', request.type)
|
logger.error('Unknown request video QADU type %s.', request.type)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// Do not forget the uuid so the remote pod can identify the video
|
// Do not forget the uuid so the remote pod can identify the video
|
||||||
|
@ -103,12 +103,12 @@ class RequestVideoQaduScheduler extends AbstractRequestScheduler<RequestsVideoQa
|
||||||
requestsToMakeGrouped[hashKey].ids.push(request.id)
|
requestsToMakeGrouped[hashKey].ids.push(request.id)
|
||||||
|
|
||||||
// Maybe there are multiple quick and dirty update for the same video
|
// 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
|
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).forEach(hashKey => {
|
||||||
Object.keys(requestsToMakeGrouped[hashKey].videos).forEach(videoUUID => {
|
Object.keys(requestsToMakeGrouped[hashKey].videos).forEach(videoUUID => {
|
||||||
const videoData = requestsToMakeGrouped[hashKey].videos[videoUUID]
|
const videoData = requestsToMakeGrouped[hashKey].videos[videoUUID]
|
||||||
|
@ -118,7 +118,7 @@ class RequestVideoQaduScheduler extends AbstractRequestScheduler<RequestsVideoQa
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
// 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
|
delete requestsToMakeGrouped[hashKey].videos
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
|
@ -39,7 +39,7 @@ function videosAddValidator (req: express.Request, res: express.Response, next:
|
||||||
})
|
})
|
||||||
.then(duration => {
|
.then(duration => {
|
||||||
// Previous test failed, abort
|
// Previous test failed, abort
|
||||||
if (duration === undefined) return
|
if (duration === undefined) return undefined
|
||||||
|
|
||||||
if (!isVideoDurationValid('' + duration)) {
|
if (!isVideoDurationValid('' + duration)) {
|
||||||
return res.status(400).send('Duration of the video file is too big (max: ' + CONSTRAINTS_FIELDS.VIDEOS.DURATION.max + 's).')
|
return res.status(400).send('Duration of the video file is too big (max: ' + CONSTRAINTS_FIELDS.VIDEOS.DURATION.max + 's).')
|
||||||
|
|
|
@ -9,7 +9,6 @@ import * as Sequelize from 'sequelize'
|
||||||
import * as Promise from 'bluebird'
|
import * as Promise from 'bluebird'
|
||||||
|
|
||||||
import { TagInstance } from './tag-interface'
|
import { TagInstance } from './tag-interface'
|
||||||
import { UserInstance } from '../user/user-interface'
|
|
||||||
import {
|
import {
|
||||||
logger,
|
logger,
|
||||||
isVideoNameValid,
|
isVideoNameValid,
|
||||||
|
|
Loading…
Reference in New Issue