Server: add views attribute when sending videos to friends

pull/61/head
Chocobozzz 2017-03-04 11:00:59 +01:00
parent 1f5bf9ef70
commit e3d156b341
3 changed files with 8 additions and 4 deletions

View File

@ -155,7 +155,8 @@ function addVideo (req, res, videoFile, finalCallback) {
extname: path.extname(videoFile.filename),
description: videoInfos.description,
duration: videoFile.duration,
authorId: author.id
authorId: author.id,
views: videoInfos.views
}
const video = db.Video.build(videoData)

View File

@ -91,7 +91,8 @@ function isCommonVideoAttributesValid (video) {
videosValidators.isVideoNameValid(video.name) &&
videosValidators.isVideoTagsValid(video.tags) &&
videosValidators.isVideoRemoteIdValid(video.remoteId) &&
videosValidators.isVideoExtnameValid(video.extname)
videosValidators.isVideoExtnameValid(video.extname) &&
videosValidators.isVideoViewsValid(video.views)
}
function isRequestTypeAddValid (value) {

View File

@ -380,7 +380,8 @@ function toAddRemoteJSON (callback) {
tags: map(self.Tags, 'name'),
createdAt: self.createdAt,
updatedAt: self.updatedAt,
extname: self.extname
extname: self.extname,
views: self.views
}
return callback(null, remoteVideo)
@ -398,7 +399,8 @@ function toUpdateRemoteJSON (callback) {
tags: map(this.Tags, 'name'),
createdAt: this.createdAt,
updatedAt: this.updatedAt,
extname: this.extname
extname: this.extname,
views: this.views
}
return json