]>
git.immae.eu Git - github/Chocobozzz/PeerTube.git/blob - server/models/utils.js
e798aabe67a0f67a2648f450f6c0f26879bc1191
3 const parallel
= require('async/parallel')
9 function listForApiWithCount (query
, start
, count
, sort
, callback
) {
13 function (asyncCallback
) {
14 self
.find(query
).skip(start
).limit(count
).sort(sort
).exec(asyncCallback
)
16 function (asyncCallback
) {
17 self
.count(query
, asyncCallback
)
19 ], function (err
, results
) {
20 if (err
) return callback(err
)
22 const data
= results
[0]
23 const total
= results
[1]
24 return callback(null, data
, total
)
28 // ---------------------------------------------------------------------------
30 module
.exports
= utils