@labdigital/commercetools-mock 0.5.16 → 0.5.17
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/commercetools-mock.cjs.development.js +13 -3
- package/dist/commercetools-mock.cjs.development.js.map +1 -1
- package/dist/commercetools-mock.cjs.production.min.js +1 -1
- package/dist/commercetools-mock.cjs.production.min.js.map +1 -1
- package/dist/commercetools-mock.esm.js +13 -3
- package/dist/commercetools-mock.esm.js.map +1 -1
- package/dist/repositories/abstract.d.ts +2 -0
- package/package.json +1 -1
- package/src/repositories/abstract.ts +4 -0
- package/src/repositories/product-projection.ts +2 -0
- package/src/services/abstract.ts +5 -0
- package/src/services/product-projection.test.ts +20 -0
|
@@ -978,9 +978,15 @@ class AbstractService {
|
|
|
978
978
|
}
|
|
979
979
|
|
|
980
980
|
get(request, response) {
|
|
981
|
+
const limit = this._parseParam(request.query.limit);
|
|
982
|
+
|
|
983
|
+
const offset = this._parseParam(request.query.offset);
|
|
984
|
+
|
|
981
985
|
const result = this.repository.query(request.params.projectKey, {
|
|
982
986
|
expand: this._parseParam(request.query.expand),
|
|
983
|
-
where: this._parseParam(request.query.where)
|
|
987
|
+
where: this._parseParam(request.query.where),
|
|
988
|
+
limit: limit !== undefined ? Number(limit) : undefined,
|
|
989
|
+
offset: offset !== undefined ? Number(offset) : undefined
|
|
984
990
|
});
|
|
985
991
|
return response.status(200).send(result);
|
|
986
992
|
}
|
|
@@ -1121,7 +1127,9 @@ class AbstractResourceRepository extends AbstractRepository {
|
|
|
1121
1127
|
query(projectKey, params = {}) {
|
|
1122
1128
|
return this._storage.query(projectKey, this.getTypeId(), {
|
|
1123
1129
|
expand: params.expand,
|
|
1124
|
-
where: params.where
|
|
1130
|
+
where: params.where,
|
|
1131
|
+
offset: params.offset,
|
|
1132
|
+
limit: params.limit
|
|
1125
1133
|
});
|
|
1126
1134
|
}
|
|
1127
1135
|
|
|
@@ -2660,7 +2668,9 @@ class ProductProjectionRepository extends AbstractResourceRepository {
|
|
|
2660
2668
|
const wherePredicate = filter ? parseFilterExpression(filter) : undefined;
|
|
2661
2669
|
|
|
2662
2670
|
const results = this._storage.query(projectKey, this.getTypeId(), {
|
|
2663
|
-
where: wherePredicate
|
|
2671
|
+
where: wherePredicate,
|
|
2672
|
+
offset: query.offset ? Number(query.offset) : undefined,
|
|
2673
|
+
limit: query.limit ? Number(query.limit) : undefined
|
|
2664
2674
|
}); //TODO: this is a partial implementation, but I don't really have the time to implement an actual search API right now
|
|
2665
2675
|
|
|
2666
2676
|
|