feat(pagination): Adds MVP pagination to orders and products for admin routes

This commit is contained in:
Oliver Windall Juhl
2020-08-27 17:51:23 +02:00
committed by GitHub
parent d8aac759cf
commit 9dc6999a9a
9 changed files with 70 additions and 27 deletions
+10 -2
View File
@@ -67,8 +67,16 @@ class BaseModel {
* @return {Array<mongoose.Document>} the retreived mongoose documents or
* an empty array
*/
find(query, options) {
return this.mongooseModel_.find(query, options).lean()
find(query, options, offset, limit) {
return this.mongooseModel_
.find(query, options)
.skip(offset)
.limit(limit)
.lean()
}
count() {
return this.mongooseModel_.count({})
}
/**