@chevre/domain 21.2.0-alpha.66 → 21.2.0-alpha.67

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.
@@ -0,0 +1,22 @@
1
+ // tslint:disable:no-implicit-dependencies no-console
2
+ import { chevre } from '../../../lib/index';
3
+
4
+ import * as mongoose from 'mongoose';
5
+
6
+ // const project = { id: String(process.env.PROJECT_ID) };
7
+
8
+ async function main() {
9
+ await mongoose.connect(<string>process.env.MONGOLAB_URI, { autoIndex: false });
10
+
11
+ const sellerRepo = new chevre.repository.Seller(mongoose.connection);
12
+ const sellers = await sellerRepo.search({
13
+ hasMerchantReturnPolicy: { itemCondition: { id: { $eq: '646dc7848b3c1437d43dbfeb' } } }
14
+ });
15
+ console.log('sellers:', sellers);
16
+ }
17
+
18
+ main()
19
+ .then(() => {
20
+ console.log('success!');
21
+ })
22
+ .catch(console.error);
@@ -75,3 +75,9 @@ schema.index({ additionalProperty: 1, branchCode: 1 }, {
75
75
  additionalProperty: { $exists: true }
76
76
  }
77
77
  });
78
+ schema.index({ 'hasMerchantReturnPolicy.itemCondition.id': 1, branchCode: 1 }, {
79
+ name: 'searchByHasMerchantReturnPolicyItemConditionId',
80
+ partialFilterExpression: {
81
+ 'hasMerchantReturnPolicy.itemCondition.id': { $exists: true }
82
+ }
83
+ });
@@ -32,21 +32,12 @@ class MongoRepository {
32
32
  }
33
33
  // tslint:disable-next-line:max-func-body-length
34
34
  static CREATE_MONGO_CONDITIONS(params) {
35
- var _a, _b, _c, _d, _e, _f;
35
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
36
36
  // MongoDB検索条件
37
37
  const andConditions = [];
38
- // tslint:disable-next-line:no-single-line-block-comment
39
- /* istanbul ignore else */
40
- if (params.project !== undefined) {
41
- if (params.project.id !== undefined && params.project.id !== null) {
42
- if (typeof params.project.id.$eq === 'string') {
43
- andConditions.push({
44
- 'project.id': {
45
- $eq: params.project.id.$eq
46
- }
47
- });
48
- }
49
- }
38
+ const projectIdEq = (_b = (_a = params.project) === null || _a === void 0 ? void 0 : _a.id) === null || _b === void 0 ? void 0 : _b.$eq;
39
+ if (typeof projectIdEq === 'string') {
40
+ andConditions.push({ 'project.id': { $eq: projectIdEq } });
50
41
  }
51
42
  const nameRegex = params.name;
52
43
  if (typeof nameRegex === 'string' && nameRegex.length > 0) {
@@ -67,7 +58,7 @@ class MongoRepository {
67
58
  ]
68
59
  });
69
60
  }
70
- const branchCodeEq = (_a = params.branchCode) === null || _a === void 0 ? void 0 : _a.$eq;
61
+ const branchCodeEq = (_c = params.branchCode) === null || _c === void 0 ? void 0 : _c.$eq;
71
62
  if (typeof branchCodeEq === 'string') {
72
63
  andConditions.push({
73
64
  branchCode: {
@@ -75,7 +66,7 @@ class MongoRepository {
75
66
  }
76
67
  });
77
68
  }
78
- const branchCodeRegex = (_b = params.branchCode) === null || _b === void 0 ? void 0 : _b.$regex;
69
+ const branchCodeRegex = (_d = params.branchCode) === null || _d === void 0 ? void 0 : _d.$regex;
79
70
  if (typeof branchCodeRegex === 'string' && branchCodeRegex.length > 0) {
80
71
  andConditions.push({
81
72
  branchCode: {
@@ -83,7 +74,7 @@ class MongoRepository {
83
74
  }
84
75
  });
85
76
  }
86
- const additionalPropertyAll = (_c = params.additionalProperty) === null || _c === void 0 ? void 0 : _c.$all;
77
+ const additionalPropertyAll = (_e = params.additionalProperty) === null || _e === void 0 ? void 0 : _e.$all;
87
78
  if (Array.isArray(additionalPropertyAll)) {
88
79
  andConditions.push({
89
80
  additionalProperty: {
@@ -92,7 +83,7 @@ class MongoRepository {
92
83
  }
93
84
  });
94
85
  }
95
- const additionalPropertyIn = (_d = params.additionalProperty) === null || _d === void 0 ? void 0 : _d.$in;
86
+ const additionalPropertyIn = (_f = params.additionalProperty) === null || _f === void 0 ? void 0 : _f.$in;
96
87
  if (Array.isArray(additionalPropertyIn)) {
97
88
  andConditions.push({
98
89
  additionalProperty: {
@@ -101,7 +92,7 @@ class MongoRepository {
101
92
  }
102
93
  });
103
94
  }
104
- const additionalPropertyNin = (_e = params.additionalProperty) === null || _e === void 0 ? void 0 : _e.$nin;
95
+ const additionalPropertyNin = (_g = params.additionalProperty) === null || _g === void 0 ? void 0 : _g.$nin;
105
96
  if (Array.isArray(additionalPropertyNin)) {
106
97
  andConditions.push({
107
98
  additionalProperty: {
@@ -109,7 +100,7 @@ class MongoRepository {
109
100
  }
110
101
  });
111
102
  }
112
- const additionalPropertyElemMatch = (_f = params.additionalProperty) === null || _f === void 0 ? void 0 : _f.$elemMatch;
103
+ const additionalPropertyElemMatch = (_h = params.additionalProperty) === null || _h === void 0 ? void 0 : _h.$elemMatch;
113
104
  if (additionalPropertyElemMatch !== undefined && additionalPropertyElemMatch !== null) {
114
105
  andConditions.push({
115
106
  additionalProperty: {
@@ -118,6 +109,15 @@ class MongoRepository {
118
109
  }
119
110
  });
120
111
  }
112
+ const hasMerchantReturnPolicyItemConditionIdEq = (_l = (_k = (_j = params.hasMerchantReturnPolicy) === null || _j === void 0 ? void 0 : _j.itemCondition) === null || _k === void 0 ? void 0 : _k.id) === null || _l === void 0 ? void 0 : _l.$eq;
113
+ if (typeof hasMerchantReturnPolicyItemConditionIdEq === 'string') {
114
+ andConditions.push({
115
+ 'hasMerchantReturnPolicy.itemCondition.id': {
116
+ $exists: true,
117
+ $eq: hasMerchantReturnPolicyItemConditionIdEq
118
+ }
119
+ });
120
+ }
121
121
  return andConditions;
122
122
  }
123
123
  /**
package/package.json CHANGED
@@ -9,8 +9,8 @@
9
9
  }
10
10
  ],
11
11
  "dependencies": {
12
- "@chevre/factory": "4.313.0-alpha.8",
13
- "@cinerino/sdk": "3.156.0",
12
+ "@chevre/factory": "4.313.0-alpha.10",
13
+ "@cinerino/sdk": "3.157.0-alpha.0",
14
14
  "@motionpicture/coa-service": "9.2.0",
15
15
  "@motionpicture/gmo-service": "5.2.0",
16
16
  "@sendgrid/mail": "6.4.0",
@@ -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.2.0-alpha.66"
120
+ "version": "21.2.0-alpha.67"
121
121
  }