@chevre/domain 21.8.0-alpha.64 → 21.8.0-alpha.65
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/optimizeCatalogs.ts +21 -0
- package/example/src/chevre/pushIncludedInDataCatalog.ts +47 -0
- package/example/src/chevre/searchOffers.ts +2 -2
- package/example/src/chevre/syncCatalogs2aggregateOffers.ts +4 -6
- package/lib/chevre/repo/aggregateOffer.d.ts +2 -2
- package/lib/chevre/repo/aggregateOffer.js +35 -7
- package/lib/chevre/repo/mongoose/schemas/offerCatalog.js +2 -0
- package/lib/chevre/repo/offer.js +36 -38
- package/lib/chevre/repo/offerCatalog.d.ts +4 -0
- package/lib/chevre/repo/offerCatalog.js +23 -0
- package/lib/chevre/settings.js +0 -6
- package/package.json +3 -3
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
// tslint:disable:no-console
|
|
2
|
+
import * as mongoose from 'mongoose';
|
|
3
|
+
|
|
4
|
+
import { chevre } from '../../../lib/index';
|
|
5
|
+
|
|
6
|
+
// const project = { id: String(process.env.PROJECT_ID) };
|
|
7
|
+
|
|
8
|
+
// tslint:disable-next-line:max-func-body-length
|
|
9
|
+
async function main() {
|
|
10
|
+
await mongoose.connect(<string>process.env.MONGOLAB_URI, { autoIndex: false });
|
|
11
|
+
|
|
12
|
+
const offerCatalogRepo = new chevre.repository.OfferCatalog(mongoose.connection);
|
|
13
|
+
|
|
14
|
+
await offerCatalogRepo.optimizeAll();
|
|
15
|
+
|
|
16
|
+
console.log('optmized');
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
main()
|
|
20
|
+
.then()
|
|
21
|
+
.catch(console.error);
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
// tslint:disable:no-console
|
|
2
|
+
import * as mongoose from 'mongoose';
|
|
3
|
+
|
|
4
|
+
import { chevre } from '../../../lib/index';
|
|
5
|
+
|
|
6
|
+
const project = { id: String(process.env.PROJECT_ID) };
|
|
7
|
+
|
|
8
|
+
// tslint:disable-next-line:max-func-body-length
|
|
9
|
+
async function main() {
|
|
10
|
+
await mongoose.connect(<string>process.env.MONGOLAB_URI, { autoIndex: false });
|
|
11
|
+
|
|
12
|
+
const aggregateOfferRepo = new chevre.repository.AggregateOffer(mongoose.connection);
|
|
13
|
+
|
|
14
|
+
await aggregateOfferRepo.pushIncludedInDataCatalog({
|
|
15
|
+
project: {
|
|
16
|
+
id: project.id
|
|
17
|
+
},
|
|
18
|
+
id: {
|
|
19
|
+
$in: ['1001']
|
|
20
|
+
},
|
|
21
|
+
$push: {
|
|
22
|
+
includedInDataCatalog: {
|
|
23
|
+
$each: [{ id: '0001' }]
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
console.log('pushed');
|
|
28
|
+
|
|
29
|
+
// const pullResult = await aggregateOfferRepo.pullIncludedInDataCatalog({
|
|
30
|
+
// project: {
|
|
31
|
+
// id: project.id
|
|
32
|
+
// },
|
|
33
|
+
// id: {
|
|
34
|
+
// // $nin: ['1001']
|
|
35
|
+
// },
|
|
36
|
+
// $pull: {
|
|
37
|
+
// includedInDataCatalog: {
|
|
38
|
+
// $elemMatch: { id: { $eq: '0001' } }
|
|
39
|
+
// }
|
|
40
|
+
// }
|
|
41
|
+
// });
|
|
42
|
+
// console.log('pulled', pullResult);
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
main()
|
|
46
|
+
.then()
|
|
47
|
+
.catch(console.error);
|
|
@@ -14,8 +14,8 @@ async function main() {
|
|
|
14
14
|
project: { id: { $eq: String(process.env.PROJECT_ID) } },
|
|
15
15
|
availability: { $eq: chevre.factory.itemAvailability.InStock },
|
|
16
16
|
parentOffer: {
|
|
17
|
-
|
|
18
|
-
}
|
|
17
|
+
},
|
|
18
|
+
includedInDataCatalog: { id: { $in: ['0001'] } }
|
|
19
19
|
// additionalProperty: {
|
|
20
20
|
// $all: [
|
|
21
21
|
// {
|
|
@@ -8,7 +8,7 @@ import { chevre } from '../../../lib/index';
|
|
|
8
8
|
// tslint:disable-next-line:max-func-body-length
|
|
9
9
|
async function main() {
|
|
10
10
|
const now = new Date();
|
|
11
|
-
await mongoose.connect(<string>process.env.MONGOLAB_URI, { autoIndex:
|
|
11
|
+
await mongoose.connect(<string>process.env.MONGOLAB_URI, { autoIndex: true });
|
|
12
12
|
|
|
13
13
|
const offerRepo = new chevre.repository.Offer(mongoose.connection);
|
|
14
14
|
const offerCatalogRepo = new chevre.repository.OfferCatalog(mongoose.connection);
|
|
@@ -37,10 +37,8 @@ async function main() {
|
|
|
37
37
|
const existingOffers = await offerRepo.search(
|
|
38
38
|
{
|
|
39
39
|
project: { id: { $eq: offerCatalog.project.id } },
|
|
40
|
-
parentOffer: {
|
|
41
|
-
|
|
42
|
-
includedInDataCatalog: { id: { $in: [String(offerCatalog.id)] } }
|
|
43
|
-
}
|
|
40
|
+
// parentOffer: {},
|
|
41
|
+
includedInDataCatalog: { id: { $in: [String(offerCatalog.id)] } }
|
|
44
42
|
},
|
|
45
43
|
{ id: 1 }
|
|
46
44
|
);
|
|
@@ -52,7 +50,7 @@ async function main() {
|
|
|
52
50
|
} else {
|
|
53
51
|
console.log('creating task...', offerCatalog.project.id, offerCatalog.id, offerCatalog.identifier, i);
|
|
54
52
|
const syncTaskData: chevre.factory.task.onResourceUpdated.IData4common = {
|
|
55
|
-
typeOf: '
|
|
53
|
+
typeOf: 'OfferCatalog',
|
|
56
54
|
id: [String(offerCatalog.id)],
|
|
57
55
|
isNew: false,
|
|
58
56
|
isDeleted: false,
|
|
@@ -39,7 +39,7 @@ export declare class MongoRepository {
|
|
|
39
39
|
};
|
|
40
40
|
}): Promise<void>;
|
|
41
41
|
/**
|
|
42
|
-
*
|
|
42
|
+
* 記載カタログからカタログを除外する
|
|
43
43
|
*/
|
|
44
44
|
pullIncludedInDataCatalog(params: {
|
|
45
45
|
project: {
|
|
@@ -57,6 +57,6 @@ export declare class MongoRepository {
|
|
|
57
57
|
};
|
|
58
58
|
};
|
|
59
59
|
};
|
|
60
|
-
}): Promise<
|
|
60
|
+
}): Promise<void>;
|
|
61
61
|
}
|
|
62
62
|
export {};
|
|
@@ -10,7 +10,9 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
exports.MongoRepository = void 0;
|
|
13
|
+
const createDebug = require("debug");
|
|
13
14
|
const aggregateOffer_1 = require("./mongoose/schemas/aggregateOffer");
|
|
15
|
+
const debug = createDebug('chevre-domain:repo:aggregateOffer');
|
|
14
16
|
/**
|
|
15
17
|
* 集計オファーリポジトリ
|
|
16
18
|
*/
|
|
@@ -492,7 +494,7 @@ class MongoRepository {
|
|
|
492
494
|
typeOf: 'OfferCatalog'
|
|
493
495
|
};
|
|
494
496
|
});
|
|
495
|
-
yield this.aggregateOfferModel.updateMany({
|
|
497
|
+
let result = yield this.aggregateOfferModel.updateMany({
|
|
496
498
|
'project.id': { $eq: params.project.id },
|
|
497
499
|
_id: { $in: params.id.$in },
|
|
498
500
|
// includedInDataCatalogのユニークネスを保証する
|
|
@@ -508,22 +510,48 @@ class MongoRepository {
|
|
|
508
510
|
}
|
|
509
511
|
})
|
|
510
512
|
.exec();
|
|
513
|
+
debug('result', result);
|
|
514
|
+
// offersにもpush
|
|
515
|
+
result = yield this.aggregateOfferModel.updateMany({
|
|
516
|
+
'project.id': { $eq: params.project.id },
|
|
517
|
+
_id: { $in: params.id.$in }
|
|
518
|
+
}, {
|
|
519
|
+
$push: {
|
|
520
|
+
'offers.$[offer].includedInDataCatalog': {
|
|
521
|
+
$each: newIncludedInDataCatalogs
|
|
522
|
+
}
|
|
523
|
+
}
|
|
524
|
+
}, {
|
|
525
|
+
// includedInDataCatalogのユニークネスを保証する
|
|
526
|
+
arrayFilters: [
|
|
527
|
+
{ 'offer.includedInDataCatalog.id': { $nin: pushIncludedInDataCatalogIds } }
|
|
528
|
+
]
|
|
529
|
+
})
|
|
530
|
+
.exec();
|
|
531
|
+
debug('result', result);
|
|
511
532
|
});
|
|
512
533
|
}
|
|
513
534
|
/**
|
|
514
|
-
*
|
|
535
|
+
* 記載カタログからカタログを除外する
|
|
515
536
|
*/
|
|
516
537
|
pullIncludedInDataCatalog(params) {
|
|
517
538
|
var _a;
|
|
518
539
|
return __awaiter(this, void 0, void 0, function* () {
|
|
519
540
|
const idNin = (_a = params.id) === null || _a === void 0 ? void 0 : _a.$nin;
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
$eq: params.$pull.includedInDataCatalog.$elemMatch.id.$eq
|
|
523
|
-
} }, (Array.isArray(idNin)) ? { _id: { $nin: idNin } } : undefined), {
|
|
541
|
+
const pullingCatalogId = params.$pull.includedInDataCatalog.$elemMatch.id.$eq;
|
|
542
|
+
yield this.aggregateOfferModel.updateMany(Object.assign({ 'project.id': { $eq: params.project.id }, 'includedInDataCatalog.id': { $exists: true, $eq: pullingCatalogId } }, (Array.isArray(idNin)) ? { _id: { $nin: idNin } } : undefined), {
|
|
524
543
|
$pull: {
|
|
525
544
|
includedInDataCatalog: {
|
|
526
|
-
id: { $eq:
|
|
545
|
+
id: { $eq: pullingCatalogId }
|
|
546
|
+
}
|
|
547
|
+
}
|
|
548
|
+
})
|
|
549
|
+
.exec();
|
|
550
|
+
// 全offersからもpull
|
|
551
|
+
yield this.aggregateOfferModel.updateMany(Object.assign({ 'project.id': { $eq: params.project.id }, 'offers.includedInDataCatalog.id': { $exists: true, $eq: pullingCatalogId } }, (Array.isArray(idNin)) ? { _id: { $nin: idNin } } : undefined), {
|
|
552
|
+
$pull: {
|
|
553
|
+
'offers.$[].includedInDataCatalog': {
|
|
554
|
+
id: { $eq: pullingCatalogId }
|
|
527
555
|
}
|
|
528
556
|
}
|
|
529
557
|
})
|
|
@@ -26,6 +26,8 @@ const schema = new mongoose_1.Schema({
|
|
|
26
26
|
itemOffered: mongoose_1.SchemaTypes.Mixed,
|
|
27
27
|
additionalProperty: [mongoose_1.SchemaTypes.Mixed],
|
|
28
28
|
dateSynced: Date // 追加(2023-09-13~)
|
|
29
|
+
// ticketTypes: SchemaTypes.Mixed,
|
|
30
|
+
// id: SchemaTypes.Mixed
|
|
29
31
|
}, {
|
|
30
32
|
collection: 'offerCatalogs',
|
|
31
33
|
id: true,
|
package/lib/chevre/repo/offer.js
CHANGED
|
@@ -40,7 +40,7 @@ class MongoRepository {
|
|
|
40
40
|
}
|
|
41
41
|
// tslint:disable-next-line:cyclomatic-complexity max-func-body-length
|
|
42
42
|
static CREATE_AGGREGATE_OFFERS_MATCH_CONDITIONS(params) {
|
|
43
|
-
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, _25, _26, _27, _28, _29, _30, _31, _32, _33, _34, _35, _36, _37, _38, _39, _40
|
|
43
|
+
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, _25, _26, _27, _28, _29, _30, _31, _32, _33, _34, _35, _36, _37, _38, _39, _40;
|
|
44
44
|
const matchStages = [];
|
|
45
45
|
const projectIdEq = (_b = (_a = params.project) === null || _a === void 0 ? void 0 : _a.id) === null || _b === void 0 ? void 0 : _b.$eq;
|
|
46
46
|
if (typeof projectIdEq === 'string') {
|
|
@@ -52,23 +52,23 @@ class MongoRepository {
|
|
|
52
52
|
if (Array.isArray(parentOfferIdIn)) {
|
|
53
53
|
matchStages.push({ $match: { _id: { $in: parentOfferIdIn } } });
|
|
54
54
|
}
|
|
55
|
-
const includedInDataCatalogIdIn = (
|
|
55
|
+
const includedInDataCatalogIdIn = (_f = (_e = params.includedInDataCatalog) === null || _e === void 0 ? void 0 : _e.id) === null || _f === void 0 ? void 0 : _f.$in;
|
|
56
56
|
if (Array.isArray(includedInDataCatalogIdIn)) {
|
|
57
|
-
matchStages.push({ $match: { 'includedInDataCatalog.id': { $exists: true, $in: includedInDataCatalogIdIn } } });
|
|
57
|
+
matchStages.push({ $match: { 'offers.includedInDataCatalog.id': { $exists: true, $in: includedInDataCatalogIdIn } } });
|
|
58
58
|
}
|
|
59
|
-
const idEq = (
|
|
59
|
+
const idEq = (_g = params.id) === null || _g === void 0 ? void 0 : _g.$eq;
|
|
60
60
|
if (typeof idEq === 'string') {
|
|
61
61
|
matchStages.push({
|
|
62
62
|
$match: { 'offers.id': { $eq: idEq } }
|
|
63
63
|
});
|
|
64
64
|
}
|
|
65
|
-
const idIn = (
|
|
65
|
+
const idIn = (_h = params.id) === null || _h === void 0 ? void 0 : _h.$in;
|
|
66
66
|
if (Array.isArray(idIn)) {
|
|
67
67
|
matchStages.push({
|
|
68
68
|
$match: { 'offers.id': { $in: idIn } }
|
|
69
69
|
});
|
|
70
70
|
}
|
|
71
|
-
const identifierEq = (
|
|
71
|
+
const identifierEq = (_j = params.identifier) === null || _j === void 0 ? void 0 : _j.$eq;
|
|
72
72
|
if (typeof identifierEq === 'string') {
|
|
73
73
|
matchStages.push({
|
|
74
74
|
$match: {
|
|
@@ -76,7 +76,7 @@ class MongoRepository {
|
|
|
76
76
|
}
|
|
77
77
|
});
|
|
78
78
|
}
|
|
79
|
-
const identifierIn = (
|
|
79
|
+
const identifierIn = (_k = params.identifier) === null || _k === void 0 ? void 0 : _k.$in;
|
|
80
80
|
if (Array.isArray(identifierIn)) {
|
|
81
81
|
matchStages.push({
|
|
82
82
|
$match: {
|
|
@@ -84,7 +84,7 @@ class MongoRepository {
|
|
|
84
84
|
}
|
|
85
85
|
});
|
|
86
86
|
}
|
|
87
|
-
const identifierRegex = (
|
|
87
|
+
const identifierRegex = (_l = params.identifier) === null || _l === void 0 ? void 0 : _l.$regex;
|
|
88
88
|
if (typeof identifierRegex === 'string' && identifierRegex.length > 0) {
|
|
89
89
|
matchStages.push({
|
|
90
90
|
$match: {
|
|
@@ -92,7 +92,7 @@ class MongoRepository {
|
|
|
92
92
|
}
|
|
93
93
|
});
|
|
94
94
|
}
|
|
95
|
-
const nameRegex = (
|
|
95
|
+
const nameRegex = (_m = params.name) === null || _m === void 0 ? void 0 : _m.$regex;
|
|
96
96
|
if (typeof nameRegex === 'string' && nameRegex.length > 0) {
|
|
97
97
|
const nameRegexExp = new RegExp(nameRegex);
|
|
98
98
|
matchStages.push({
|
|
@@ -106,7 +106,7 @@ class MongoRepository {
|
|
|
106
106
|
}
|
|
107
107
|
});
|
|
108
108
|
}
|
|
109
|
-
const itemOfferedTypeOfEq = (
|
|
109
|
+
const itemOfferedTypeOfEq = (_p = (_o = params.itemOffered) === null || _o === void 0 ? void 0 : _o.typeOf) === null || _p === void 0 ? void 0 : _p.$eq;
|
|
110
110
|
if (typeof itemOfferedTypeOfEq === 'string') {
|
|
111
111
|
matchStages.push({
|
|
112
112
|
$match: {
|
|
@@ -114,7 +114,7 @@ class MongoRepository {
|
|
|
114
114
|
}
|
|
115
115
|
});
|
|
116
116
|
}
|
|
117
|
-
const categoryCodeValueIn = (
|
|
117
|
+
const categoryCodeValueIn = (_r = (_q = params.category) === null || _q === void 0 ? void 0 : _q.codeValue) === null || _r === void 0 ? void 0 : _r.$in;
|
|
118
118
|
if (Array.isArray(categoryCodeValueIn)) {
|
|
119
119
|
matchStages.push({
|
|
120
120
|
$match: {
|
|
@@ -122,7 +122,7 @@ class MongoRepository {
|
|
|
122
122
|
}
|
|
123
123
|
});
|
|
124
124
|
}
|
|
125
|
-
const eligibleMembershipTypeCodeValueEq = (
|
|
125
|
+
const eligibleMembershipTypeCodeValueEq = (_t = (_s = params.eligibleMembershipType) === null || _s === void 0 ? void 0 : _s.codeValue) === null || _t === void 0 ? void 0 : _t.$eq;
|
|
126
126
|
if (typeof eligibleMembershipTypeCodeValueEq === 'string') {
|
|
127
127
|
matchStages.push({
|
|
128
128
|
$match: {
|
|
@@ -133,7 +133,7 @@ class MongoRepository {
|
|
|
133
133
|
}
|
|
134
134
|
});
|
|
135
135
|
}
|
|
136
|
-
const eligibleMonetaryAmountCurrencyEq = (
|
|
136
|
+
const eligibleMonetaryAmountCurrencyEq = (_v = (_u = params.eligibleMonetaryAmount) === null || _u === void 0 ? void 0 : _u.currency) === null || _v === void 0 ? void 0 : _v.$eq;
|
|
137
137
|
if (typeof eligibleMonetaryAmountCurrencyEq === 'string') {
|
|
138
138
|
matchStages.push({
|
|
139
139
|
$match: {
|
|
@@ -144,7 +144,7 @@ class MongoRepository {
|
|
|
144
144
|
}
|
|
145
145
|
});
|
|
146
146
|
}
|
|
147
|
-
const eligibleSeatingTypeCodeValueEq = (
|
|
147
|
+
const eligibleSeatingTypeCodeValueEq = (_x = (_w = params.eligibleSeatingType) === null || _w === void 0 ? void 0 : _w.codeValue) === null || _x === void 0 ? void 0 : _x.$eq;
|
|
148
148
|
if (typeof eligibleSeatingTypeCodeValueEq === 'string') {
|
|
149
149
|
matchStages.push({
|
|
150
150
|
$match: {
|
|
@@ -155,7 +155,7 @@ class MongoRepository {
|
|
|
155
155
|
}
|
|
156
156
|
});
|
|
157
157
|
}
|
|
158
|
-
const appliesToMovieTicketServiceTypeExist = (
|
|
158
|
+
const appliesToMovieTicketServiceTypeExist = (_0 = (_z = (_y = params.priceSpecification) === null || _y === void 0 ? void 0 : _y.appliesToMovieTicket) === null || _z === void 0 ? void 0 : _z.serviceType) === null || _0 === void 0 ? void 0 : _0.$exists;
|
|
159
159
|
if (typeof appliesToMovieTicketServiceTypeExist === 'boolean') {
|
|
160
160
|
matchStages.push({
|
|
161
161
|
$match: {
|
|
@@ -165,7 +165,7 @@ class MongoRepository {
|
|
|
165
165
|
}
|
|
166
166
|
});
|
|
167
167
|
}
|
|
168
|
-
const appliesToMovieTicketServiceTypeEq = (
|
|
168
|
+
const appliesToMovieTicketServiceTypeEq = (_3 = (_2 = (_1 = params.priceSpecification) === null || _1 === void 0 ? void 0 : _1.appliesToMovieTicket) === null || _2 === void 0 ? void 0 : _2.serviceType) === null || _3 === void 0 ? void 0 : _3.$eq;
|
|
169
169
|
if (typeof appliesToMovieTicketServiceTypeEq === 'string') {
|
|
170
170
|
matchStages.push({
|
|
171
171
|
$match: {
|
|
@@ -176,7 +176,7 @@ class MongoRepository {
|
|
|
176
176
|
}
|
|
177
177
|
});
|
|
178
178
|
}
|
|
179
|
-
const appliesToMovieTicketServiceOutputTypeOfEq = (
|
|
179
|
+
const appliesToMovieTicketServiceOutputTypeOfEq = (_7 = (_6 = (_5 = (_4 = params.priceSpecification) === null || _4 === void 0 ? void 0 : _4.appliesToMovieTicket) === null || _5 === void 0 ? void 0 : _5.serviceOutput) === null || _6 === void 0 ? void 0 : _6.typeOf) === null || _7 === void 0 ? void 0 : _7.$eq;
|
|
180
180
|
if (typeof appliesToMovieTicketServiceOutputTypeOfEq === 'string') {
|
|
181
181
|
matchStages.push({
|
|
182
182
|
$match: {
|
|
@@ -187,7 +187,7 @@ class MongoRepository {
|
|
|
187
187
|
}
|
|
188
188
|
});
|
|
189
189
|
}
|
|
190
|
-
const appliesToMovieTicketServiceOutputTypeOfNin = (
|
|
190
|
+
const appliesToMovieTicketServiceOutputTypeOfNin = (_11 = (_10 = (_9 = (_8 = params.priceSpecification) === null || _8 === void 0 ? void 0 : _8.appliesToMovieTicket) === null || _9 === void 0 ? void 0 : _9.serviceOutput) === null || _10 === void 0 ? void 0 : _10.typeOf) === null || _11 === void 0 ? void 0 : _11.$nin;
|
|
191
191
|
if (Array.isArray(appliesToMovieTicketServiceOutputTypeOfNin)) {
|
|
192
192
|
matchStages.push({
|
|
193
193
|
$match: {
|
|
@@ -198,7 +198,7 @@ class MongoRepository {
|
|
|
198
198
|
});
|
|
199
199
|
}
|
|
200
200
|
if (params.priceSpecification !== undefined && params.priceSpecification !== null) {
|
|
201
|
-
const priceSpecificationPriceGte = (
|
|
201
|
+
const priceSpecificationPriceGte = (_12 = params.priceSpecification.price) === null || _12 === void 0 ? void 0 : _12.$gte;
|
|
202
202
|
if (typeof priceSpecificationPriceGte === 'number') {
|
|
203
203
|
matchStages.push({
|
|
204
204
|
$match: {
|
|
@@ -209,7 +209,7 @@ class MongoRepository {
|
|
|
209
209
|
}
|
|
210
210
|
});
|
|
211
211
|
}
|
|
212
|
-
const priceSpecificationPriceLte = (
|
|
212
|
+
const priceSpecificationPriceLte = (_13 = params.priceSpecification.price) === null || _13 === void 0 ? void 0 : _13.$lte;
|
|
213
213
|
if (typeof priceSpecificationPriceLte === 'number') {
|
|
214
214
|
matchStages.push({
|
|
215
215
|
$match: {
|
|
@@ -220,7 +220,7 @@ class MongoRepository {
|
|
|
220
220
|
}
|
|
221
221
|
});
|
|
222
222
|
}
|
|
223
|
-
const accountsReceivableGte = (
|
|
223
|
+
const accountsReceivableGte = (_15 = (_14 = params.priceSpecification.accounting) === null || _14 === void 0 ? void 0 : _14.accountsReceivable) === null || _15 === void 0 ? void 0 : _15.$gte;
|
|
224
224
|
if (typeof accountsReceivableGte === 'number') {
|
|
225
225
|
matchStages.push({
|
|
226
226
|
$match: {
|
|
@@ -231,7 +231,7 @@ class MongoRepository {
|
|
|
231
231
|
}
|
|
232
232
|
});
|
|
233
233
|
}
|
|
234
|
-
const accountsReceivableLte = (
|
|
234
|
+
const accountsReceivableLte = (_17 = (_16 = params.priceSpecification.accounting) === null || _16 === void 0 ? void 0 : _16.accountsReceivable) === null || _17 === void 0 ? void 0 : _17.$lte;
|
|
235
235
|
if (typeof accountsReceivableLte === 'number') {
|
|
236
236
|
matchStages.push({
|
|
237
237
|
$match: {
|
|
@@ -242,7 +242,7 @@ class MongoRepository {
|
|
|
242
242
|
}
|
|
243
243
|
});
|
|
244
244
|
}
|
|
245
|
-
const accountingCodeValueEq = (
|
|
245
|
+
const accountingCodeValueEq = (_20 = (_19 = (_18 = params.priceSpecification.accounting) === null || _18 === void 0 ? void 0 : _18.operatingRevenue) === null || _19 === void 0 ? void 0 : _19.codeValue) === null || _20 === void 0 ? void 0 : _20.$eq;
|
|
246
246
|
if (typeof accountingCodeValueEq === 'string') {
|
|
247
247
|
matchStages.push({
|
|
248
248
|
$match: {
|
|
@@ -253,7 +253,7 @@ class MongoRepository {
|
|
|
253
253
|
}
|
|
254
254
|
});
|
|
255
255
|
}
|
|
256
|
-
const accountingCodeValueIn = (
|
|
256
|
+
const accountingCodeValueIn = (_23 = (_22 = (_21 = params.priceSpecification.accounting) === null || _21 === void 0 ? void 0 : _21.operatingRevenue) === null || _22 === void 0 ? void 0 : _22.codeValue) === null || _23 === void 0 ? void 0 : _23.$in;
|
|
257
257
|
if (Array.isArray(accountingCodeValueIn)) {
|
|
258
258
|
matchStages.push({
|
|
259
259
|
$match: {
|
|
@@ -264,7 +264,7 @@ class MongoRepository {
|
|
|
264
264
|
}
|
|
265
265
|
});
|
|
266
266
|
}
|
|
267
|
-
const referenceQuantityValueEq = (
|
|
267
|
+
const referenceQuantityValueEq = (_25 = (_24 = params.priceSpecification.referenceQuantity) === null || _24 === void 0 ? void 0 : _24.value) === null || _25 === void 0 ? void 0 : _25.$eq;
|
|
268
268
|
if (typeof referenceQuantityValueEq === 'number') {
|
|
269
269
|
matchStages.push({
|
|
270
270
|
$match: {
|
|
@@ -276,7 +276,7 @@ class MongoRepository {
|
|
|
276
276
|
});
|
|
277
277
|
}
|
|
278
278
|
}
|
|
279
|
-
const availabilityEq = (
|
|
279
|
+
const availabilityEq = (_26 = params.availability) === null || _26 === void 0 ? void 0 : _26.$eq;
|
|
280
280
|
if (typeof availabilityEq === 'string') {
|
|
281
281
|
matchStages.push({
|
|
282
282
|
$match: {
|
|
@@ -284,7 +284,7 @@ class MongoRepository {
|
|
|
284
284
|
}
|
|
285
285
|
});
|
|
286
286
|
}
|
|
287
|
-
const availableAtOrFromIdEq = (
|
|
287
|
+
const availableAtOrFromIdEq = (_28 = (_27 = params.availableAtOrFrom) === null || _27 === void 0 ? void 0 : _27.id) === null || _28 === void 0 ? void 0 : _28.$eq;
|
|
288
288
|
if (typeof availableAtOrFromIdEq === 'string') {
|
|
289
289
|
matchStages.push({
|
|
290
290
|
$match: {
|
|
@@ -295,7 +295,7 @@ class MongoRepository {
|
|
|
295
295
|
}
|
|
296
296
|
});
|
|
297
297
|
}
|
|
298
|
-
const availableAtOrFromIdIn = (
|
|
298
|
+
const availableAtOrFromIdIn = (_30 = (_29 = params.availableAtOrFrom) === null || _29 === void 0 ? void 0 : _29.id) === null || _30 === void 0 ? void 0 : _30.$in;
|
|
299
299
|
if (Array.isArray(availableAtOrFromIdIn)) {
|
|
300
300
|
matchStages.push({
|
|
301
301
|
$match: {
|
|
@@ -306,7 +306,7 @@ class MongoRepository {
|
|
|
306
306
|
}
|
|
307
307
|
});
|
|
308
308
|
}
|
|
309
|
-
const addOnItemOfferedIdEq = (
|
|
309
|
+
const addOnItemOfferedIdEq = (_33 = (_32 = (_31 = params.addOn) === null || _31 === void 0 ? void 0 : _31.itemOffered) === null || _32 === void 0 ? void 0 : _32.id) === null || _33 === void 0 ? void 0 : _33.$eq;
|
|
310
310
|
if (typeof addOnItemOfferedIdEq === 'string') {
|
|
311
311
|
matchStages.push({
|
|
312
312
|
$match: {
|
|
@@ -314,7 +314,7 @@ class MongoRepository {
|
|
|
314
314
|
}
|
|
315
315
|
});
|
|
316
316
|
}
|
|
317
|
-
const addOnItemOfferedIdIn = (
|
|
317
|
+
const addOnItemOfferedIdIn = (_36 = (_35 = (_34 = params.addOn) === null || _34 === void 0 ? void 0 : _34.itemOffered) === null || _35 === void 0 ? void 0 : _35.id) === null || _36 === void 0 ? void 0 : _36.$in;
|
|
318
318
|
if (Array.isArray(addOnItemOfferedIdIn)) {
|
|
319
319
|
matchStages.push({
|
|
320
320
|
$match: {
|
|
@@ -322,7 +322,7 @@ class MongoRepository {
|
|
|
322
322
|
}
|
|
323
323
|
});
|
|
324
324
|
}
|
|
325
|
-
const hasMerchantReturnPolicyIdEq = (
|
|
325
|
+
const hasMerchantReturnPolicyIdEq = (_38 = (_37 = params.hasMerchantReturnPolicy) === null || _37 === void 0 ? void 0 : _37.id) === null || _38 === void 0 ? void 0 : _38.$eq;
|
|
326
326
|
if (typeof hasMerchantReturnPolicyIdEq === 'string') {
|
|
327
327
|
matchStages.push({
|
|
328
328
|
$match: {
|
|
@@ -333,7 +333,7 @@ class MongoRepository {
|
|
|
333
333
|
}
|
|
334
334
|
});
|
|
335
335
|
}
|
|
336
|
-
const additionalPropertyAll = (
|
|
336
|
+
const additionalPropertyAll = (_39 = params.additionalProperty) === null || _39 === void 0 ? void 0 : _39.$all;
|
|
337
337
|
if (Array.isArray(additionalPropertyAll)) {
|
|
338
338
|
matchStages.push({
|
|
339
339
|
$match: {
|
|
@@ -344,7 +344,7 @@ class MongoRepository {
|
|
|
344
344
|
}
|
|
345
345
|
});
|
|
346
346
|
}
|
|
347
|
-
const additionalPropertyElemMatch = (
|
|
347
|
+
const additionalPropertyElemMatch = (_40 = params.additionalProperty) === null || _40 === void 0 ? void 0 : _40.$elemMatch;
|
|
348
348
|
if (additionalPropertyElemMatch !== undefined && additionalPropertyElemMatch !== null) {
|
|
349
349
|
matchStages.push({
|
|
350
350
|
$match: {
|
|
@@ -572,11 +572,9 @@ class MongoRepository {
|
|
|
572
572
|
: [];
|
|
573
573
|
let offers = [];
|
|
574
574
|
if (sortedOfferIds.length > 0) {
|
|
575
|
-
const searchOffersConditions = Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({
|
|
576
|
-
|
|
577
|
-
parentOffer:
|
|
578
|
-
? { includedInDataCatalog: { id: { $in: [params.offerCatalog.id] } } }
|
|
579
|
-
: { id: { $in: sortedOfferIds } }) }, (typeof ((_a = params.availableAtOrFrom) === null || _a === void 0 ? void 0 : _a.id) === 'string')
|
|
575
|
+
const searchOffersConditions = Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, (params.useIncludeInDataCatalog)
|
|
576
|
+
? { includedInDataCatalog: { id: { $in: [params.offerCatalog.id] } } }
|
|
577
|
+
: { parentOffer: { id: { $in: sortedOfferIds } } }), (typeof ((_a = params.availableAtOrFrom) === null || _a === void 0 ? void 0 : _a.id) === 'string')
|
|
580
578
|
? { availableAtOrFrom: { id: { $eq: params.availableAtOrFrom.id } } }
|
|
581
579
|
: undefined), { priceSpecification: {
|
|
582
580
|
appliesToMovieTicket: Object.assign(Object.assign({}, (Array.isArray(params.unacceptedPaymentMethod) && params.unacceptedPaymentMethod.length > 0)
|
|
@@ -153,6 +153,29 @@ class MongoRepository {
|
|
|
153
153
|
.exec();
|
|
154
154
|
});
|
|
155
155
|
}
|
|
156
|
+
/**
|
|
157
|
+
* 型を統一する
|
|
158
|
+
*/
|
|
159
|
+
optimizeAll() {
|
|
160
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
161
|
+
let result = yield this.offerCatalogModel.updateMany({ typeOf: { $ne: 'OfferCatalog' } }, { $set: { typeOf: 'OfferCatalog' } })
|
|
162
|
+
.exec();
|
|
163
|
+
// tslint:disable-next-line:no-console
|
|
164
|
+
console.log(result);
|
|
165
|
+
result = yield this.offerCatalogModel.updateMany({ ticketTypes: { $exists: true } }, {
|
|
166
|
+
$unset: { ticketTypes: 1 }
|
|
167
|
+
})
|
|
168
|
+
.exec();
|
|
169
|
+
// tslint:disable-next-line:no-console
|
|
170
|
+
console.log(result);
|
|
171
|
+
result = yield this.offerCatalogModel.updateMany({ id: { $exists: true } }, {
|
|
172
|
+
$unset: { id: 1 }
|
|
173
|
+
})
|
|
174
|
+
.exec();
|
|
175
|
+
// tslint:disable-next-line:no-console
|
|
176
|
+
console.log(result);
|
|
177
|
+
});
|
|
178
|
+
}
|
|
156
179
|
updateManyById(params) {
|
|
157
180
|
return __awaiter(this, void 0, void 0, function* () {
|
|
158
181
|
if (!Array.isArray(params.id.$in) || params.id.$in.length === 0) {
|
package/lib/chevre/settings.js
CHANGED
|
@@ -63,12 +63,6 @@ exports.USE_ASSET_TRANSACTION_SYNC_PROCESSING = process.env.USE_ASSET_TRANSACTIO
|
|
|
63
63
|
exports.USE_NEW_EVENT_AVAILABILITY_KEY_FROM = (typeof process.env.USE_NEW_EVENT_AVAILABILITY_KEY_FROM === 'string')
|
|
64
64
|
? moment(process.env.USE_NEW_EVENT_AVAILABILITY_KEY_FROM)
|
|
65
65
|
: moment('2023-08-31T15:00:00Z');
|
|
66
|
-
// export const USE_NEW_STOCK_HOLDER_REPO_FROM: moment.Moment = (typeof process.env.USE_NEW_STOCK_HOLDER_REPO_FROM === 'string')
|
|
67
|
-
// ? moment(process.env.USE_NEW_STOCK_HOLDER_REPO_FROM)
|
|
68
|
-
// : moment('2024-11-30T15:00:00Z');
|
|
69
|
-
// export const USE_NEW_STOCK_HOLDER_REPO_IDS: string[] = (typeof process.env.USE_NEW_STOCK_HOLDER_REPO_IDS === 'string')
|
|
70
|
-
// ? process.env.USE_NEW_STOCK_HOLDER_REPO_IDS.split(' ')
|
|
71
|
-
// : [];
|
|
72
66
|
exports.USE_ADVANCE_BOOKING_REQUIREMENT = process.env.USE_ADVANCE_BOOKING_REQUIREMENT === '1';
|
|
73
67
|
exports.USE_OBJECT_AS_PAY_TRANSACTION_AMOUNT = process.env.USE_OBJECT_AS_PAY_TRANSACTION_AMOUNT === '1';
|
|
74
68
|
exports.USE_DELETE_EVENT_BY_ORDER = process.env.USE_DELETE_EVENT_BY_ORDER === '1';
|
package/package.json
CHANGED
|
@@ -9,8 +9,8 @@
|
|
|
9
9
|
}
|
|
10
10
|
],
|
|
11
11
|
"dependencies": {
|
|
12
|
-
"@chevre/factory": "4.329.0-alpha.
|
|
13
|
-
"@cinerino/sdk": "3.167.0-alpha.
|
|
12
|
+
"@chevre/factory": "4.329.0-alpha.14",
|
|
13
|
+
"@cinerino/sdk": "3.167.0-alpha.6",
|
|
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.8.0-alpha.
|
|
120
|
+
"version": "21.8.0-alpha.65"
|
|
121
121
|
}
|