Server: add views attribute when sending videos to friends
This commit is contained in:
parent
1f5bf9ef70
commit
e3d156b341
|
@ -155,7 +155,8 @@ function addVideo (req, res, videoFile, finalCallback) {
|
||||||
extname: path.extname(videoFile.filename),
|
extname: path.extname(videoFile.filename),
|
||||||
description: videoInfos.description,
|
description: videoInfos.description,
|
||||||
duration: videoFile.duration,
|
duration: videoFile.duration,
|
||||||
authorId: author.id
|
authorId: author.id,
|
||||||
|
views: videoInfos.views
|
||||||
}
|
}
|
||||||
|
|
||||||
const video = db.Video.build(videoData)
|
const video = db.Video.build(videoData)
|
||||||
|
|
|
@ -91,7 +91,8 @@ function isCommonVideoAttributesValid (video) {
|
||||||
videosValidators.isVideoNameValid(video.name) &&
|
videosValidators.isVideoNameValid(video.name) &&
|
||||||
videosValidators.isVideoTagsValid(video.tags) &&
|
videosValidators.isVideoTagsValid(video.tags) &&
|
||||||
videosValidators.isVideoRemoteIdValid(video.remoteId) &&
|
videosValidators.isVideoRemoteIdValid(video.remoteId) &&
|
||||||
videosValidators.isVideoExtnameValid(video.extname)
|
videosValidators.isVideoExtnameValid(video.extname) &&
|
||||||
|
videosValidators.isVideoViewsValid(video.views)
|
||||||
}
|
}
|
||||||
|
|
||||||
function isRequestTypeAddValid (value) {
|
function isRequestTypeAddValid (value) {
|
||||||
|
|
|
@ -380,7 +380,8 @@ function toAddRemoteJSON (callback) {
|
||||||
tags: map(self.Tags, 'name'),
|
tags: map(self.Tags, 'name'),
|
||||||
createdAt: self.createdAt,
|
createdAt: self.createdAt,
|
||||||
updatedAt: self.updatedAt,
|
updatedAt: self.updatedAt,
|
||||||
extname: self.extname
|
extname: self.extname,
|
||||||
|
views: self.views
|
||||||
}
|
}
|
||||||
|
|
||||||
return callback(null, remoteVideo)
|
return callback(null, remoteVideo)
|
||||||
|
@ -398,7 +399,8 @@ function toUpdateRemoteJSON (callback) {
|
||||||
tags: map(this.Tags, 'name'),
|
tags: map(this.Tags, 'name'),
|
||||||
createdAt: this.createdAt,
|
createdAt: this.createdAt,
|
||||||
updatedAt: this.updatedAt,
|
updatedAt: this.updatedAt,
|
||||||
extname: this.extname
|
extname: this.extname,
|
||||||
|
views: this.views
|
||||||
}
|
}
|
||||||
|
|
||||||
return json
|
return json
|
||||||
|
|
Loading…
Reference in New Issue