@chevre/domain 20.2.0 → 20.3.0-alpha.1
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,31 @@
|
|
|
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
|
+
$all: ['901', '3001']
|
|
19
|
+
// $in: ['1001'],
|
|
20
|
+
// $nin: ['1005']
|
|
21
|
+
}
|
|
22
|
+
},
|
|
23
|
+
itemOffered: { typeOf: { $eq: chevre.factory.product.ProductType.EventService } }
|
|
24
|
+
});
|
|
25
|
+
console.log(catalogs);
|
|
26
|
+
console.log(catalogs.length);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
main()
|
|
30
|
+
.then(console.log)
|
|
31
|
+
.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, _s, _t;
|
|
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
|
-
|
|
47
|
-
|
|
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
|
-
|
|
50
|
-
|
|
51
|
-
|
|
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
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
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
|
-
|
|
66
|
-
|
|
67
|
-
|
|
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 = (
|
|
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,24 @@ class MongoRepository {
|
|
|
89
79
|
}
|
|
90
80
|
});
|
|
91
81
|
}
|
|
92
|
-
const
|
|
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 itemListElementIdAll = (_m = (_l = params.itemListElement) === null || _l === void 0 ? void 0 : _l.id) === null || _m === void 0 ? void 0 : _m.$all;
|
|
91
|
+
if (Array.isArray(itemListElementIdAll)) {
|
|
92
|
+
andConditions.push({
|
|
93
|
+
'itemListElement.id': {
|
|
94
|
+
$exists: true,
|
|
95
|
+
$all: itemListElementIdAll
|
|
96
|
+
}
|
|
97
|
+
});
|
|
98
|
+
}
|
|
99
|
+
const itemOfferedTypeOfEq = (_p = (_o = params.itemOffered) === null || _o === void 0 ? void 0 : _o.typeOf) === null || _p === void 0 ? void 0 : _p.$eq;
|
|
93
100
|
if (typeof itemOfferedTypeOfEq === 'string') {
|
|
94
101
|
andConditions.push({
|
|
95
102
|
'itemOffered.typeOf': {
|
|
@@ -98,7 +105,7 @@ class MongoRepository {
|
|
|
98
105
|
}
|
|
99
106
|
});
|
|
100
107
|
}
|
|
101
|
-
const itemOfferedServiceTypeCodeValueEq = (
|
|
108
|
+
const itemOfferedServiceTypeCodeValueEq = (_s = (_r = (_q = params.itemOffered) === null || _q === void 0 ? void 0 : _q.serviceType) === null || _r === void 0 ? void 0 : _r.codeValue) === null || _s === void 0 ? void 0 : _s.$eq;
|
|
102
109
|
if (typeof itemOfferedServiceTypeCodeValueEq === 'string') {
|
|
103
110
|
andConditions.push({
|
|
104
111
|
'itemOffered.serviceType.codeValue': {
|
|
@@ -107,7 +114,7 @@ class MongoRepository {
|
|
|
107
114
|
}
|
|
108
115
|
});
|
|
109
116
|
}
|
|
110
|
-
const additionalPropertyElemMatch = (
|
|
117
|
+
const additionalPropertyElemMatch = (_t = params.additionalProperty) === null || _t === void 0 ? void 0 : _t.$elemMatch;
|
|
111
118
|
if (additionalPropertyElemMatch !== undefined && additionalPropertyElemMatch !== null) {
|
|
112
119
|
andConditions.push({
|
|
113
120
|
additionalProperty: {
|
package/package.json
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
}
|
|
10
10
|
],
|
|
11
11
|
"dependencies": {
|
|
12
|
-
"@chevre/factory": "4.
|
|
12
|
+
"@chevre/factory": "4.288.0-alpha.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.
|
|
123
|
+
"version": "20.3.0-alpha.1"
|
|
124
124
|
}
|