@chevre/domain 21.11.0-alpha.2 → 21.11.0-alpha.3

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.
@@ -14,7 +14,11 @@ async function main() {
14
14
  const poses = await posRepo.search({
15
15
  limit: 10,
16
16
  page: 1,
17
- project: { id: { $eq: project.id } }
17
+ project: { id: { $eq: project.id } },
18
+ branchCode: {
19
+ // $eq: '002',
20
+ $regex: '^0'
21
+ }
18
22
  });
19
23
  console.log(poses);
20
24
  console.log(poses.length);
@@ -19,6 +19,10 @@ export declare class MongoRepository {
19
19
  search(params: {
20
20
  limit?: number;
21
21
  page?: number;
22
+ branchCode?: {
23
+ $eq?: string;
24
+ $regex?: string;
25
+ };
22
26
  project?: {
23
27
  id?: {
24
28
  $eq?: string;
@@ -23,7 +23,7 @@ class MongoRepository {
23
23
  this.operater = operater;
24
24
  }
25
25
  search(params) {
26
- var _a, _b;
26
+ var _a, _b, _c, _d;
27
27
  return __awaiter(this, void 0, void 0, function* () {
28
28
  const matchStages = [
29
29
  { $match: { _id: { $eq: new mongoose_1.Types.ObjectId(this.operater.id) } } }
@@ -32,6 +32,14 @@ class MongoRepository {
32
32
  if (typeof projectIdEq === 'string') {
33
33
  matchStages.push({ $match: { 'project.id': { $eq: projectIdEq } } });
34
34
  }
35
+ const branchCodeEq = (_c = params.branchCode) === null || _c === void 0 ? void 0 : _c.$eq;
36
+ if (typeof branchCodeEq === 'string') {
37
+ matchStages.push({ $match: { 'hasPOS.branchCode': { $eq: branchCodeEq } } });
38
+ }
39
+ const branchCodeRegex = (_d = params.branchCode) === null || _d === void 0 ? void 0 : _d.$regex;
40
+ if (typeof branchCodeRegex === 'string' && branchCodeRegex.length > 0) {
41
+ matchStages.push({ $match: { 'hasPOS.branchCode': { $regex: new RegExp(branchCodeRegex) } } });
42
+ }
35
43
  const aggregate = this.placeModel.aggregate([
36
44
  {
37
45
  $unwind: {
package/package.json CHANGED
@@ -117,5 +117,5 @@
117
117
  "postversion": "git push origin --tags",
118
118
  "prepublishOnly": "npm run clean && npm run build && npm test && npm run doc"
119
119
  },
120
- "version": "21.11.0-alpha.2"
120
+ "version": "21.11.0-alpha.3"
121
121
  }