@chevre/domain 20.2.0 → 20.3.0-alpha.0

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.
@@ -25,7 +25,6 @@ async function main() {
25
25
  agregation: aggregationRepo,
26
26
  action: actionRepo
27
27
  });
28
- return;
29
28
 
30
29
  await chevre.service.aggregation.system.aggregatePayTransaction({
31
30
  aggregationDays: AGGREGATE_DAYS,
@@ -0,0 +1,30 @@
1
+ // tslint:disable:no-console
2
+ // import * as redis from 'redis';
3
+ import * as mongoose from 'mongoose';
4
+
5
+ import { chevre } from '../../../lib/index';
6
+
7
+ async function main() {
8
+ await mongoose.connect(<string>process.env.MONGOLAB_URI);
9
+
10
+ const offerCatalogRepo = new chevre.repository.OfferCatalog(mongoose.connection);
11
+
12
+ const catalogs = await offerCatalogRepo.search({
13
+ limit: 100,
14
+ page: 1,
15
+ id: { $in: ['0001'] },
16
+ itemListElement: {
17
+ id: {
18
+ // $in: ['1001'],
19
+ // $nin: ['1005']
20
+ }
21
+ },
22
+ itemOffered: { typeOf: { $eq: chevre.factory.product.ProductType.EventService } }
23
+ });
24
+ console.log(catalogs);
25
+ console.log(catalogs.length);
26
+ }
27
+
28
+ main()
29
+ .then(console.log)
30
+ .catch(console.error);
@@ -31,8 +31,9 @@ class MongoRepository {
31
31
  constructor(connection) {
32
32
  this.offerCatalogModel = connection.model(offerCatalog_1.modelName);
33
33
  }
34
+ // tslint:disable-next-line:max-func-body-length
34
35
  static CREATE_MONGO_CONDITIONS(params) {
35
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
36
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r;
36
37
  // MongoDB検索条件
37
38
  const andConditions = [];
38
39
  const projectIdEq = (_b = (_a = params.project) === null || _a === void 0 ? void 0 : _a.id) === null || _b === void 0 ? void 0 : _b.$eq;
@@ -43,34 +44,23 @@ class MongoRepository {
43
44
  }
44
45
  });
45
46
  }
46
- if (typeof params.id === 'string') {
47
- andConditions.push({ _id: new RegExp(params.id) });
47
+ const idIn = (_c = params.id) === null || _c === void 0 ? void 0 : _c.$in;
48
+ if (Array.isArray(idIn)) {
49
+ andConditions.push({ _id: { $in: idIn } });
48
50
  }
49
- else {
50
- const idIn = (_c = params.id) === null || _c === void 0 ? void 0 : _c.$in;
51
- if (Array.isArray(idIn)) {
52
- andConditions.push({ _id: { $in: idIn } });
53
- }
51
+ const idRegex = (_d = params.id) === null || _d === void 0 ? void 0 : _d.$regex;
52
+ if (typeof idRegex === 'string' && idRegex.length > 0) {
53
+ andConditions.push({ _id: { $regex: new RegExp(idRegex) } });
54
54
  }
55
- if (typeof params.identifier === 'string') {
56
- if (params.identifier.length > 0) {
57
- andConditions.push({
58
- identifier: {
59
- $exists: true,
60
- $regex: new RegExp(params.identifier)
61
- }
62
- });
63
- }
55
+ const identifierEq = (_e = params.identifier) === null || _e === void 0 ? void 0 : _e.$eq;
56
+ if (typeof identifierEq === 'string') {
57
+ andConditions.push({
58
+ identifier: { $eq: identifierEq }
59
+ });
64
60
  }
65
- else if (params.identifier !== undefined && params.identifier !== null) {
66
- if (typeof params.identifier.$eq === 'string') {
67
- andConditions.push({
68
- identifier: {
69
- $exists: true,
70
- $eq: params.identifier.$eq
71
- }
72
- });
73
- }
61
+ const identifierRegex = (_f = params.identifier) === null || _f === void 0 ? void 0 : _f.$regex;
62
+ if (typeof identifierRegex === 'string' && identifierRegex.length > 0) {
63
+ andConditions.push({ identifier: { $regex: new RegExp(identifierRegex) } });
74
64
  }
75
65
  if (params.name !== undefined) {
76
66
  andConditions.push({
@@ -80,7 +70,7 @@ class MongoRepository {
80
70
  ]
81
71
  });
82
72
  }
83
- const itemListElementIdIn = (_e = (_d = params.itemListElement) === null || _d === void 0 ? void 0 : _d.id) === null || _e === void 0 ? void 0 : _e.$in;
73
+ const itemListElementIdIn = (_h = (_g = params.itemListElement) === null || _g === void 0 ? void 0 : _g.id) === null || _h === void 0 ? void 0 : _h.$in;
84
74
  if (Array.isArray(itemListElementIdIn)) {
85
75
  andConditions.push({
86
76
  'itemListElement.id': {
@@ -89,7 +79,15 @@ class MongoRepository {
89
79
  }
90
80
  });
91
81
  }
92
- const itemOfferedTypeOfEq = (_g = (_f = params.itemOffered) === null || _f === void 0 ? void 0 : _f.typeOf) === null || _g === void 0 ? void 0 : _g.$eq;
82
+ const itemListElementIdNin = (_k = (_j = params.itemListElement) === null || _j === void 0 ? void 0 : _j.id) === null || _k === void 0 ? void 0 : _k.$nin;
83
+ if (Array.isArray(itemListElementIdNin)) {
84
+ andConditions.push({
85
+ 'itemListElement.id': {
86
+ $nin: itemListElementIdNin
87
+ }
88
+ });
89
+ }
90
+ const itemOfferedTypeOfEq = (_m = (_l = params.itemOffered) === null || _l === void 0 ? void 0 : _l.typeOf) === null || _m === void 0 ? void 0 : _m.$eq;
93
91
  if (typeof itemOfferedTypeOfEq === 'string') {
94
92
  andConditions.push({
95
93
  'itemOffered.typeOf': {
@@ -98,7 +96,7 @@ class MongoRepository {
98
96
  }
99
97
  });
100
98
  }
101
- const itemOfferedServiceTypeCodeValueEq = (_k = (_j = (_h = params.itemOffered) === null || _h === void 0 ? void 0 : _h.serviceType) === null || _j === void 0 ? void 0 : _j.codeValue) === null || _k === void 0 ? void 0 : _k.$eq;
99
+ const itemOfferedServiceTypeCodeValueEq = (_q = (_p = (_o = params.itemOffered) === null || _o === void 0 ? void 0 : _o.serviceType) === null || _p === void 0 ? void 0 : _p.codeValue) === null || _q === void 0 ? void 0 : _q.$eq;
102
100
  if (typeof itemOfferedServiceTypeCodeValueEq === 'string') {
103
101
  andConditions.push({
104
102
  'itemOffered.serviceType.codeValue': {
@@ -107,7 +105,7 @@ class MongoRepository {
107
105
  }
108
106
  });
109
107
  }
110
- const additionalPropertyElemMatch = (_l = params.additionalProperty) === null || _l === void 0 ? void 0 : _l.$elemMatch;
108
+ const additionalPropertyElemMatch = (_r = params.additionalProperty) === null || _r === void 0 ? void 0 : _r.$elemMatch;
111
109
  if (additionalPropertyElemMatch !== undefined && additionalPropertyElemMatch !== null) {
112
110
  andConditions.push({
113
111
  additionalProperty: {
package/package.json CHANGED
@@ -9,7 +9,7 @@
9
9
  }
10
10
  ],
11
11
  "dependencies": {
12
- "@chevre/factory": "4.286.0",
12
+ "@chevre/factory": "4.287.0",
13
13
  "@cinerino/sdk": "3.138.1",
14
14
  "@motionpicture/coa-service": "9.2.0",
15
15
  "@motionpicture/gmo-service": "5.2.0",
@@ -120,5 +120,5 @@
120
120
  "postversion": "git push origin --tags",
121
121
  "prepublishOnly": "npm run clean && npm run build && npm test && npm run doc"
122
122
  },
123
- "version": "20.2.0"
123
+ "version": "20.3.0-alpha.0"
124
124
  }