From 7b1f49de22c40ae121ddb3c399b2540ba56fd414 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Thu, 29 Dec 2016 19:07:05 +0100 Subject: Server: add ability to update a video --- server/models/video.js | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) (limited to 'server/models') diff --git a/server/models/video.js b/server/models/video.js index 0e84e8986..14fbe2f71 100644 --- a/server/models/video.js +++ b/server/models/video.js @@ -127,7 +127,8 @@ module.exports = function (sequelize, DataTypes) { getTorrentName, isOwned, toFormatedJSON, - toRemoteJSON + toAddRemoteJSON, + toUpdateRemoteJSON }, hooks: { beforeValidate, @@ -334,7 +335,7 @@ function toFormatedJSON () { return json } -function toRemoteJSON (callback) { +function toAddRemoteJSON (callback) { const self = this // Get thumbnail data to send to the other pod @@ -362,6 +363,22 @@ function toRemoteJSON (callback) { }) } +function toUpdateRemoteJSON (callback) { + const json = { + name: this.name, + description: this.description, + infoHash: this.infoHash, + remoteId: this.id, + author: this.Author.name, + duration: this.duration, + tags: map(this.Tags, 'name'), + createdAt: this.createdAt, + extname: this.extname + } + + return json +} + // ------------------------------ STATICS ------------------------------ function generateThumbnailFromData (video, thumbnailData, callback) { -- cgit v1.2.3