@chevre/domain 20.1.0-alpha.24 → 20.1.0-alpha.25
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/example/src/chevre/migrateCreativeWorkAdditionalProperties.ts +6 -2
- package/lib/chevre/repo/categoryCode.d.ts +1 -0
- package/lib/chevre/repo/categoryCode.js +15 -1
- package/lib/chevre/repo/mongoose/model/categoryCode.js +8 -1
- package/lib/chevre/repo/mongoose/model/offer.js +7 -1
- package/lib/chevre/repo/offer.js +10 -1
- package/package.json +2 -2
|
@@ -11,11 +11,15 @@ const EXCLUDED_PROJECT_ID = process.env.EXCLUDED_PROJECT_ID;
|
|
|
11
11
|
async function main() {
|
|
12
12
|
await mongoose.connect(<string>process.env.MONGOLAB_URI);
|
|
13
13
|
|
|
14
|
-
const creativeWorkRepo = new chevre.repository.CreativeWork(mongoose.connection);
|
|
14
|
+
// const creativeWorkRepo = new chevre.repository.CreativeWork(mongoose.connection);
|
|
15
15
|
// const placeRepo = new chevre.repository.Place(mongoose.connection);
|
|
16
|
+
// const offerRepo = new chevre.repository.Offer(mongoose.connection);
|
|
17
|
+
const categoryCodeRepo = new chevre.repository.CategoryCode(mongoose.connection);
|
|
16
18
|
// const additionalPropertyRepo = new chevre.repository.AdditionalProperty(mongoose.connection);
|
|
17
19
|
|
|
18
|
-
const cursor =
|
|
20
|
+
const cursor = categoryCodeRepo.getCursor(
|
|
21
|
+
// const cursor = offerRepo.getCursor(
|
|
22
|
+
// const cursor = creativeWorkRepo.getCursor(
|
|
19
23
|
// const cursor = placeRepo.getCursor(
|
|
20
24
|
{
|
|
21
25
|
// 'project.id': { $eq: project.id },
|
|
@@ -32,7 +32,7 @@ class MongoRepository {
|
|
|
32
32
|
}
|
|
33
33
|
// tslint:disable-next-line:cyclomatic-complexity max-func-body-length
|
|
34
34
|
static CREATE_MONGO_CONDITIONS(params) {
|
|
35
|
-
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
35
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
36
36
|
// MongoDB検索条件
|
|
37
37
|
const andConditions = [];
|
|
38
38
|
// tslint:disable-next-line:no-single-line-block-comment
|
|
@@ -140,6 +140,15 @@ class MongoRepository {
|
|
|
140
140
|
}
|
|
141
141
|
});
|
|
142
142
|
}
|
|
143
|
+
const additionalPropertyElemMatch = (_j = params.additionalProperty) === null || _j === void 0 ? void 0 : _j.$elemMatch;
|
|
144
|
+
if (additionalPropertyElemMatch !== undefined && additionalPropertyElemMatch !== null) {
|
|
145
|
+
andConditions.push({
|
|
146
|
+
additionalProperty: {
|
|
147
|
+
$exists: true,
|
|
148
|
+
$elemMatch: additionalPropertyElemMatch
|
|
149
|
+
}
|
|
150
|
+
});
|
|
151
|
+
}
|
|
143
152
|
return andConditions;
|
|
144
153
|
}
|
|
145
154
|
count(params) {
|
|
@@ -228,5 +237,10 @@ class MongoRepository {
|
|
|
228
237
|
.exec();
|
|
229
238
|
});
|
|
230
239
|
}
|
|
240
|
+
getCursor(conditions, projection) {
|
|
241
|
+
return this.categoryCodeModel.find(conditions, projection)
|
|
242
|
+
.sort({ codeValue: factory.sortType.Ascending })
|
|
243
|
+
.cursor();
|
|
244
|
+
}
|
|
231
245
|
}
|
|
232
246
|
exports.MongoRepository = MongoRepository;
|
|
@@ -13,7 +13,8 @@ const schema = new mongoose.Schema({
|
|
|
13
13
|
typeOf: {
|
|
14
14
|
type: String,
|
|
15
15
|
required: true
|
|
16
|
-
}
|
|
16
|
+
},
|
|
17
|
+
additionalProperty: [mongoose.SchemaTypes.Mixed]
|
|
17
18
|
}, {
|
|
18
19
|
collection: 'categoryCodes',
|
|
19
20
|
id: true,
|
|
@@ -71,6 +72,12 @@ schema.index({ 'paymentMethod.typeOf': 1, codeValue: 1 }, {
|
|
|
71
72
|
schema.index({ 'project.id': 1, codeValue: 1 }, {
|
|
72
73
|
name: 'searchByProjectId-v20220721'
|
|
73
74
|
});
|
|
75
|
+
schema.index({ additionalProperty: 1, codeValue: 1 }, {
|
|
76
|
+
name: 'searchByAdditionalProperty',
|
|
77
|
+
partialFilterExpression: {
|
|
78
|
+
additionalProperty: { $exists: true }
|
|
79
|
+
}
|
|
80
|
+
});
|
|
74
81
|
mongoose.model(modelName, schema)
|
|
75
82
|
.on('index',
|
|
76
83
|
// tslint:disable-next-line:no-single-line-block-comment
|
|
@@ -19,7 +19,7 @@ const schema = new mongoose.Schema({
|
|
|
19
19
|
description: mongoose.SchemaTypes.Mixed,
|
|
20
20
|
category: mongoose.SchemaTypes.Mixed,
|
|
21
21
|
color: mongoose.SchemaTypes.Mixed,
|
|
22
|
-
additionalProperty: mongoose.SchemaTypes.Mixed,
|
|
22
|
+
additionalProperty: [mongoose.SchemaTypes.Mixed],
|
|
23
23
|
alternateName: mongoose.SchemaTypes.Mixed,
|
|
24
24
|
acceptedPaymentMethod: mongoose.SchemaTypes.Mixed,
|
|
25
25
|
addOn: mongoose.SchemaTypes.Mixed,
|
|
@@ -189,6 +189,12 @@ schema.index({ 'hasMerchantReturnPolicy.id': 1, 'priceSpecification.price': 1 },
|
|
|
189
189
|
'hasMerchantReturnPolicy.id': { $exists: true }
|
|
190
190
|
}
|
|
191
191
|
});
|
|
192
|
+
schema.index({ additionalProperty: 1, 'priceSpecification.price': 1 }, {
|
|
193
|
+
name: 'searchByAdditionalProperty',
|
|
194
|
+
partialFilterExpression: {
|
|
195
|
+
additionalProperty: { $exists: true }
|
|
196
|
+
}
|
|
197
|
+
});
|
|
192
198
|
mongoose.model(modelName, schema)
|
|
193
199
|
.on('index',
|
|
194
200
|
// tslint:disable-next-line:no-single-line-block-comment
|
package/lib/chevre/repo/offer.js
CHANGED
|
@@ -35,7 +35,7 @@ class MongoRepository {
|
|
|
35
35
|
}
|
|
36
36
|
// tslint:disable-next-line:cyclomatic-complexity max-func-body-length
|
|
37
37
|
static CREATE_OFFER_MONGO_CONDITIONS(params) {
|
|
38
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, _20, _21, _22, _23;
|
|
38
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, _20, _21, _22, _23, _24;
|
|
39
39
|
// MongoDB検索条件
|
|
40
40
|
const andConditions = [];
|
|
41
41
|
const projectIdEq = (_b = (_a = params.project) === null || _a === void 0 ? void 0 : _a.id) === null || _b === void 0 ? void 0 : _b.$eq;
|
|
@@ -285,6 +285,15 @@ class MongoRepository {
|
|
|
285
285
|
}
|
|
286
286
|
});
|
|
287
287
|
}
|
|
288
|
+
const additionalPropertyElemMatch = (_24 = params.additionalProperty) === null || _24 === void 0 ? void 0 : _24.$elemMatch;
|
|
289
|
+
if (additionalPropertyElemMatch !== undefined && additionalPropertyElemMatch !== null) {
|
|
290
|
+
andConditions.push({
|
|
291
|
+
additionalProperty: {
|
|
292
|
+
$exists: true,
|
|
293
|
+
$elemMatch: additionalPropertyElemMatch
|
|
294
|
+
}
|
|
295
|
+
});
|
|
296
|
+
}
|
|
288
297
|
return andConditions;
|
|
289
298
|
}
|
|
290
299
|
/**
|
package/package.json
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
}
|
|
10
10
|
],
|
|
11
11
|
"dependencies": {
|
|
12
|
-
"@chevre/factory": "4.279.0-alpha.
|
|
12
|
+
"@chevre/factory": "4.279.0-alpha.4",
|
|
13
13
|
"@cinerino/sdk": "3.134.0-alpha.3",
|
|
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.1.0-alpha.
|
|
123
|
+
"version": "20.1.0-alpha.25"
|
|
124
124
|
}
|