mirror of
https://github.com/Chocobozzz/PeerTube.git
synced 2025-10-05 02:39:33 +02:00
Add like/dislike system for videos
This commit is contained in:
parent
8f90644321
commit
d38b828106
31 changed files with 907 additions and 47 deletions
|
@ -1,6 +1,7 @@
|
|||
'use strict'
|
||||
|
||||
const validator = require('express-validator').validator
|
||||
const values = require('lodash/values')
|
||||
|
||||
const constants = require('../../initializers/constants')
|
||||
const usersValidators = require('./users')
|
||||
|
@ -26,6 +27,7 @@ const videosValidators = {
|
|||
isVideoFile,
|
||||
isVideoViewsValid,
|
||||
isVideoLikesValid,
|
||||
isVideoRatingTypeValid,
|
||||
isVideoDislikesValid,
|
||||
isVideoEventCountValid
|
||||
}
|
||||
|
@ -103,6 +105,10 @@ function isVideoEventCountValid (value) {
|
|||
return validator.isInt(value + '', VIDEO_EVENTS_CONSTRAINTS_FIELDS.COUNT)
|
||||
}
|
||||
|
||||
function isVideoRatingTypeValid (value) {
|
||||
return values(constants.VIDEO_RATE_TYPES).indexOf(value) !== -1
|
||||
}
|
||||
|
||||
function isVideoFile (value, files) {
|
||||
// Should have files
|
||||
if (!files) return false
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue