diff options
author | Chocobozzz <florian.bigard@gmail.com> | 2016-05-13 20:42:11 +0200 |
---|---|---|
committer | Chocobozzz <florian.bigard@gmail.com> | 2016-05-13 20:42:11 +0200 |
commit | bb10240ee15d31a1cc17c0e3d748dde817e7d0cb (patch) | |
tree | d8063b68473aaf1c5f1debc241ebf0d3cb3e7391 /server/controllers/api/v1/videos.js | |
parent | 3fe81fa75eef5320876441539ab89988a04a6c49 (diff) | |
download | PeerTube-bb10240ee15d31a1cc17c0e3d748dde817e7d0cb.tar.gz PeerTube-bb10240ee15d31a1cc17c0e3d748dde817e7d0cb.tar.zst PeerTube-bb10240ee15d31a1cc17c0e3d748dde817e7d0cb.zip |
Add createdDate to videos
Diffstat (limited to 'server/controllers/api/v1/videos.js')
-rw-r--r-- | server/controllers/api/v1/videos.js | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/server/controllers/api/v1/videos.js b/server/controllers/api/v1/videos.js index 0e058836e..5bdfdbf58 100644 --- a/server/controllers/api/v1/videos.js +++ b/server/controllers/api/v1/videos.js | |||
@@ -111,13 +111,15 @@ function addVideo (req, res, next) { | |||
111 | thumbnail: thumbnailName | 111 | thumbnail: thumbnailName |
112 | } | 112 | } |
113 | 113 | ||
114 | Videos.add(videoData, function (err) { | 114 | Videos.add(videoData, function (err, insertedVideo) { |
115 | if (err) { | 115 | if (err) { |
116 | // TODO unseed the video | 116 | // TODO unseed the video |
117 | logger.error('Cannot insert this video in the database.') | 117 | logger.error('Cannot insert this video in the database.') |
118 | return next(err) | 118 | return next(err) |
119 | } | 119 | } |
120 | 120 | ||
121 | videoData.createdDate = insertedVideo.createdDate | ||
122 | |||
121 | fs.readFile(thumbnailsDir + thumbnailName, function (err, data) { | 123 | fs.readFile(thumbnailsDir + thumbnailName, function (err, data) { |
122 | if (err) { | 124 | if (err) { |
123 | // TODO: remove video? | 125 | // TODO: remove video? |
@@ -205,7 +207,8 @@ function getFormatedVideo (videoObj) { | |||
205 | magnetUri: videoObj.magnetUri, | 207 | magnetUri: videoObj.magnetUri, |
206 | author: videoObj.author, | 208 | author: videoObj.author, |
207 | duration: videoObj.duration, | 209 | duration: videoObj.duration, |
208 | thumbnailPath: constants.THUMBNAILS_STATIC_PATH + '/' + videoObj.thumbnail | 210 | thumbnailPath: constants.THUMBNAILS_STATIC_PATH + '/' + videoObj.thumbnail, |
211 | createdDate: videoObj.createdDate | ||
209 | } | 212 | } |
210 | 213 | ||
211 | return formatedVideo | 214 | return formatedVideo |