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

This commit is contained in:
Oliver Windall Juhl authored and GitHub committed 2020-08-27 17:51:23 +02:00
1 parent d8aac759cf
commit 9dc6999a9a
9 files changed
+70 -27

No files matched your search

+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({})
}
/**