|
@@ -31,7 +31,7 @@ async function getNextIdDesc(Model, where, items) {
|
|
|
}
|
|
|
|
|
|
|
|
|
-async function getNextCount (Model, items, limit, where) {
|
|
|
+async function getNextCount (Model, items, limit, where, desc) {
|
|
|
let lastItem
|
|
|
|
|
|
if(Array.isArray(items)) {
|
|
@@ -40,7 +40,11 @@ async function getNextCount (Model, items, limit, where) {
|
|
|
lastItem = items
|
|
|
}
|
|
|
|
|
|
- where.id = { $gt: lastItem.id }
|
|
|
+ if(desc) {
|
|
|
+ where.id = { $lt: lastItem.id }
|
|
|
+ } else {
|
|
|
+ where.id = { $gt: lastItem.id }
|
|
|
+ }
|
|
|
|
|
|
let remaining = await Model.count({ where })
|
|
|
|