aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/models/videos.js
diff options
context:
space:
mode:
Diffstat (limited to 'server/models/videos.js')
-rw-r--r--server/models/videos.js10
1 files changed, 7 insertions, 3 deletions
diff --git a/server/models/videos.js b/server/models/videos.js
index aa9ed687d..250ad3952 100644
--- a/server/models/videos.js
+++ b/server/models/videos.js
@@ -19,7 +19,11 @@ const videosSchema = mongoose.Schema({
19 podUrl: String, 19 podUrl: String,
20 author: String, 20 author: String,
21 duration: Number, 21 duration: Number,
22 thumbnail: String 22 thumbnail: String,
23 createdDate: {
24 type: Date,
25 default: Date.now
26 }
23}) 27})
24const VideosDB = mongoose.model('videos', videosSchema) 28const VideosDB = mongoose.model('videos', videosSchema)
25 29
@@ -46,13 +50,13 @@ function add (video, callback) {
46 const params = video 50 const params = video
47 params.podUrl = http + '://' + host + ':' + port 51 params.podUrl = http + '://' + host + ':' + port
48 52
49 VideosDB.create(params, function (err, video) { 53 VideosDB.create(params, function (err, insertedVideo) {
50 if (err) { 54 if (err) {
51 logger.error('Cannot insert this video into database.') 55 logger.error('Cannot insert this video into database.')
52 return callback(err) 56 return callback(err)
53 } 57 }
54 58
55 callback(null) 59 callback(null, insertedVideo)
56 }) 60 })
57} 61}
58 62