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.js9
1 files changed, 5 insertions, 4 deletions
diff --git a/server/models/videos.js b/server/models/videos.js
index 250ad3952..9cac8edda 100644
--- a/server/models/videos.js
+++ b/server/models/videos.js
@@ -80,8 +80,9 @@ function get (id, callback) {
80 }) 80 })
81} 81}
82 82
83function list (start, count, callback) { 83function list (start, count, sort, callback) {
84 VideosDB.find({}).skip(start).limit(start + count).exec(function (err, videosList) { 84 VideosDB.find({}).skip(start).limit(start + count).sort(sort)
85 .exec(function (err, videosList) {
85 if (err) { 86 if (err) {
86 logger.error('Cannot get the list of the videos.') 87 logger.error('Cannot get the list of the videos.')
87 return callback(err) 88 return callback(err)
@@ -129,8 +130,8 @@ function removeByIds (ids, callback) {
129 VideosDB.remove({ _id: { $in: ids } }, callback) 130 VideosDB.remove({ _id: { $in: ids } }, callback)
130} 131}
131 132
132function search (name, start, count, callback) { 133function search (name, start, count, sort, callback) {
133 VideosDB.find({ name: new RegExp(name) }).skip(start).limit(start + count) 134 VideosDB.find({ name: new RegExp(name) }).skip(start).limit(start + count).sort(sort)
134 .exec(function (err, videos) { 135 .exec(function (err, videos) {
135 if (err) { 136 if (err) {
136 logger.error('Cannot search the videos.') 137 logger.error('Cannot search the videos.')