aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/models/videos.js
diff options
context:
space:
mode:
authorChocobozzz <florian.bigard@gmail.com>2016-05-13 20:42:11 +0200
committerChocobozzz <florian.bigard@gmail.com>2016-05-13 20:42:11 +0200
commitbb10240ee15d31a1cc17c0e3d748dde817e7d0cb (patch)
treed8063b68473aaf1c5f1debc241ebf0d3cb3e7391 /server/models/videos.js
parent3fe81fa75eef5320876441539ab89988a04a6c49 (diff)
downloadPeerTube-bb10240ee15d31a1cc17c0e3d748dde817e7d0cb.tar.gz
PeerTube-bb10240ee15d31a1cc17c0e3d748dde817e7d0cb.tar.zst
PeerTube-bb10240ee15d31a1cc17c0e3d748dde817e7d0cb.zip
Add createdDate to videos
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