@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
|
@@ -985,9 +985,15 @@ class AbstractService {
|
|
|
985
985
|
}
|
|
986
986
|
|
|
987
987
|
get(request, response) {
|
|
988
|
+
const limit = this._parseParam(request.query.limit);
|
|
989
|
+
|
|
990
|
+
const offset = this._parseParam(request.query.offset);
|
|
991
|
+
|
|
988
992
|
const result = this.repository.query(request.params.projectKey, {
|
|
989
993
|
expand: this._parseParam(request.query.expand),
|
|
990
|
-
where: this._parseParam(request.query.where)
|
|
994
|
+
where: this._parseParam(request.query.where),
|
|
995
|
+
limit: limit !== undefined ? Number(limit) : undefined,
|
|
996
|
+
offset: offset !== undefined ? Number(offset) : undefined
|
|
991
997
|
});
|
|
992
998
|
return response.status(200).send(result);
|
|
993
999
|
}
|
|
@@ -1128,7 +1134,9 @@ class AbstractResourceRepository extends AbstractRepository {
|
|
|
1128
1134
|
query(projectKey, params = {}) {
|
|
1129
1135
|
return this._storage.query(projectKey, this.getTypeId(), {
|
|
1130
1136
|
expand: params.expand,
|
|
1131
|
-
where: params.where
|
|
1137
|
+
where: params.where,
|
|
1138
|
+
offset: params.offset,
|
|
1139
|
+
limit: params.limit
|
|
1132
1140
|
});
|
|
1133
1141
|
}
|
|
1134
1142
|
|
|
@@ -2667,7 +2675,9 @@ class ProductProjectionRepository extends AbstractResourceRepository {
|
|
|
2667
2675
|
const wherePredicate = filter ? parseFilterExpression(filter) : undefined;
|
|
2668
2676
|
|
|
2669
2677
|
const results = this._storage.query(projectKey, this.getTypeId(), {
|
|
2670
|
-
where: wherePredicate
|
|
2678
|
+
where: wherePredicate,
|
|
2679
|
+
offset: query.offset ? Number(query.offset) : undefined,
|
|
2680
|
+
limit: query.limit ? Number(query.limit) : undefined
|
|
2671
2681
|
}); //TODO: this is a partial implementation, but I don't really have the time to implement an actual search API right now
|
|
2672
2682
|
|
|
2673
2683
|
|