@chevre/domain 22.5.0-alpha.1 → 22.5.0-alpha.2
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/lib/chevre/repo/paymentService.js +0 -10
- package/lib/chevre/repo/product.d.ts +3 -0
- package/lib/chevre/repo/product.js +13 -2
- package/lib/chevre/service/aggregation/event/aggregateScreeningEvent.js +6 -4
- package/lib/chevre/service/aggregation/event/findEventOffers.js +3 -2
- package/lib/chevre/service/offer/event/searchEventTicketOffers.js +25 -17
- package/lib/chevre/service/offer/product/searchProductOffers.js +4 -3
- package/package.json +3 -3
|
@@ -65,16 +65,6 @@ class PaymentServiceRepo {
|
|
|
65
65
|
typeOf: { $in: typeOfIn }
|
|
66
66
|
});
|
|
67
67
|
}
|
|
68
|
-
// discontinue(2024-08-20~)
|
|
69
|
-
// const hasOfferCatalogIdEq = params.hasOfferCatalog?.id?.$eq;
|
|
70
|
-
// if (typeof hasOfferCatalogIdEq === 'string') {
|
|
71
|
-
// andConditions.push({
|
|
72
|
-
// 'hasOfferCatalog.id': {
|
|
73
|
-
// $exists: true,
|
|
74
|
-
// $eq: hasOfferCatalogIdEq
|
|
75
|
-
// }
|
|
76
|
-
// });
|
|
77
|
-
// }
|
|
78
68
|
const idEq = (_e = params.id) === null || _e === void 0 ? void 0 : _e.$eq;
|
|
79
69
|
if (typeof idEq === 'string') {
|
|
80
70
|
andConditions.push({ _id: { $eq: idEq } });
|
|
@@ -95,6 +95,9 @@ export declare class ProductRepo {
|
|
|
95
95
|
typeOf: factory.service.paymentService.PaymentServiceType.PaymentCard;
|
|
96
96
|
id: string;
|
|
97
97
|
}): Promise<factory.product.IAvailableChannel>;
|
|
98
|
+
/**
|
|
99
|
+
* 指定カタログの設定されたプロダクトを削除する
|
|
100
|
+
*/
|
|
98
101
|
deleteByHasOfferCatalog(params: {
|
|
99
102
|
project: {
|
|
100
103
|
id: string;
|
|
@@ -69,8 +69,15 @@ class ProductRepo {
|
|
|
69
69
|
}
|
|
70
70
|
const hasOfferCatalogIdEq = (_f = (_e = params.hasOfferCatalog) === null || _e === void 0 ? void 0 : _e.id) === null || _f === void 0 ? void 0 : _f.$eq;
|
|
71
71
|
if (typeof hasOfferCatalogIdEq === 'string') {
|
|
72
|
+
// migrate to itemListElement(2024-09-30~)
|
|
73
|
+
// andConditions.push({
|
|
74
|
+
// 'hasOfferCatalog.id': {
|
|
75
|
+
// $exists: true,
|
|
76
|
+
// $eq: hasOfferCatalogIdEq
|
|
77
|
+
// }
|
|
78
|
+
// });
|
|
72
79
|
andConditions.push({
|
|
73
|
-
'hasOfferCatalog.id': {
|
|
80
|
+
'hasOfferCatalog.itemListElement.id': {
|
|
74
81
|
$exists: true,
|
|
75
82
|
$eq: hasOfferCatalogIdEq
|
|
76
83
|
}
|
|
@@ -338,11 +345,15 @@ class ProductRepo {
|
|
|
338
345
|
return availableChannel;
|
|
339
346
|
});
|
|
340
347
|
}
|
|
348
|
+
/**
|
|
349
|
+
* 指定カタログの設定されたプロダクトを削除する
|
|
350
|
+
*/
|
|
341
351
|
deleteByHasOfferCatalog(params) {
|
|
342
352
|
return __awaiter(this, void 0, void 0, function* () {
|
|
343
353
|
return this.productModel.deleteMany({
|
|
344
354
|
'project.id': { $eq: params.project.id },
|
|
345
|
-
'hasOfferCatalog.id': { $exists: true, $eq: params.hasOfferCatalog.id }
|
|
355
|
+
// 'hasOfferCatalog.id': { $exists: true, $eq: params.hasOfferCatalog.id } // migrate to itemListElement(2024-09-30~)
|
|
356
|
+
'hasOfferCatalog.itemListElement.id': { $exists: true, $eq: params.hasOfferCatalog.id }
|
|
346
357
|
})
|
|
347
358
|
.exec();
|
|
348
359
|
});
|
|
@@ -160,7 +160,7 @@ function aggregateOfferByEvent(params) {
|
|
|
160
160
|
}
|
|
161
161
|
function calculateOfferCount(params) {
|
|
162
162
|
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
163
|
-
var _a, _b, _c;
|
|
163
|
+
var _a, _b, _c, _d;
|
|
164
164
|
let offerCount = 0;
|
|
165
165
|
try {
|
|
166
166
|
const eventOffers = params.event.offers;
|
|
@@ -175,13 +175,15 @@ function calculateOfferCount(params) {
|
|
|
175
175
|
if (eventService === undefined) {
|
|
176
176
|
throw new factory.errors.NotFound(factory.product.ProductType.EventService);
|
|
177
177
|
}
|
|
178
|
-
|
|
178
|
+
// const firstCatalogIdOfProduct = eventService.hasOfferCatalog?.id; // migrate to itemListElement(2024-09-30~)
|
|
179
|
+
const firstCatalogIdOfProduct = (_c = (_b = eventService.hasOfferCatalog) === null || _b === void 0 ? void 0 : _b.itemListElement.at(0)) === null || _c === void 0 ? void 0 : _c.id;
|
|
180
|
+
if (typeof firstCatalogIdOfProduct === 'string') {
|
|
179
181
|
const catalogs = yield repos.offerCatalog.search({
|
|
180
182
|
limit: 1,
|
|
181
183
|
page: 1,
|
|
182
|
-
id: { $in: [
|
|
184
|
+
id: { $in: [firstCatalogIdOfProduct] }
|
|
183
185
|
});
|
|
184
|
-
const numberOfItems = (
|
|
186
|
+
const numberOfItems = (_d = catalogs.shift()) === null || _d === void 0 ? void 0 : _d.numberOfItems;
|
|
185
187
|
if (typeof numberOfItems === 'number') {
|
|
186
188
|
offerCount = numberOfItems;
|
|
187
189
|
}
|
|
@@ -17,7 +17,7 @@ const factory = require("../../../factory");
|
|
|
17
17
|
*/
|
|
18
18
|
function findEventOffers(params) {
|
|
19
19
|
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
20
|
-
var _a, _b;
|
|
20
|
+
var _a, _b, _c;
|
|
21
21
|
let availableOffers = [];
|
|
22
22
|
try {
|
|
23
23
|
// 興行設定があれば興行のカタログを参照する
|
|
@@ -33,7 +33,8 @@ function findEventOffers(params) {
|
|
|
33
33
|
if (eventService === undefined) {
|
|
34
34
|
throw new factory.errors.NotFound(factory.product.ProductType.EventService);
|
|
35
35
|
}
|
|
36
|
-
const offerCatalogId =
|
|
36
|
+
// const offerCatalogId = eventService.hasOfferCatalog?.id; // migrate to itemListElement(2024-09-30~)
|
|
37
|
+
const offerCatalogId = (_c = (_b = eventService.hasOfferCatalog) === null || _b === void 0 ? void 0 : _b.itemListElement.at(0)) === null || _c === void 0 ? void 0 : _c.id;
|
|
37
38
|
if (typeof offerCatalogId === 'string') {
|
|
38
39
|
// サブカタログIDを決定
|
|
39
40
|
let subOfferCatalogId = offerCatalogId;
|
|
@@ -17,7 +17,7 @@ const factory_1 = require("../factory");
|
|
|
17
17
|
function searchTicketOffersByItemOffered(params) {
|
|
18
18
|
// tslint:disable-next-line:max-func-body-length
|
|
19
19
|
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
20
|
-
var _a, _b, _c, _d, _e, _f, _g;
|
|
20
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
21
21
|
let catalogId;
|
|
22
22
|
const eventService = (yield repos.product.projectFields({
|
|
23
23
|
limit: 1,
|
|
@@ -29,8 +29,10 @@ function searchTicketOffersByItemOffered(params) {
|
|
|
29
29
|
if (eventService === undefined) {
|
|
30
30
|
throw new factory.errors.NotFound(factory.product.ProductType.EventService);
|
|
31
31
|
}
|
|
32
|
-
|
|
33
|
-
|
|
32
|
+
// const firstCatalogIdOfProduct = eventService.hasOfferCatalog?.id; // migrate to itemListElement(2024-09-30~)
|
|
33
|
+
const firstCatalogIdOfProduct = (_c = (_b = eventService.hasOfferCatalog) === null || _b === void 0 ? void 0 : _b.itemListElement.at(0)) === null || _c === void 0 ? void 0 : _c.id;
|
|
34
|
+
if (typeof firstCatalogIdOfProduct === 'string') {
|
|
35
|
+
catalogId = firstCatalogIdOfProduct;
|
|
34
36
|
}
|
|
35
37
|
if (typeof catalogId !== 'string') {
|
|
36
38
|
throw new factory.errors.NotFound('itemOffered.hasOfferCatalog');
|
|
@@ -49,7 +51,7 @@ function searchTicketOffersByItemOffered(params) {
|
|
|
49
51
|
throw new factory.errors.NotImplemented('id specification on addSortIndex not implemented');
|
|
50
52
|
}
|
|
51
53
|
// 明示的にカタログ指定可能にする
|
|
52
|
-
if (typeof ((
|
|
54
|
+
if (typeof ((_d = params.includedInDataCatalog) === null || _d === void 0 ? void 0 : _d.id) === 'string' && params.includedInDataCatalog.id.length > 0) {
|
|
53
55
|
if (isOfferCatalogItem) {
|
|
54
56
|
// no op
|
|
55
57
|
}
|
|
@@ -69,7 +71,7 @@ function searchTicketOffersByItemOffered(params) {
|
|
|
69
71
|
throw new factory.errors.NotFound('OfferCatalogItem');
|
|
70
72
|
}
|
|
71
73
|
// 強制的にサブカタログの適用決済カード条件に変更
|
|
72
|
-
const appliesToMovieTicketBySubCatalog = (
|
|
74
|
+
const appliesToMovieTicketBySubCatalog = (_f = (_e = offerCatalogItem.relatedOffer) === null || _e === void 0 ? void 0 : _e.priceSpecification) === null || _f === void 0 ? void 0 : _f.appliesToMovieTicket;
|
|
73
75
|
if (Array.isArray(appliesToMovieTicketBySubCatalog)) {
|
|
74
76
|
priceSpecificationCondition = {
|
|
75
77
|
appliesToMovieTicket: {
|
|
@@ -90,7 +92,7 @@ function searchTicketOffersByItemOffered(params) {
|
|
|
90
92
|
}
|
|
91
93
|
const { offers, sortedOfferIds } = yield repos.offer.searchByOfferCatalogIdWithSortIndex({
|
|
92
94
|
offerCatalog: { id: subOfferCatalogId, isOfferCatalogItem },
|
|
93
|
-
availableAtOrFrom: { id: (
|
|
95
|
+
availableAtOrFrom: { id: (_g = params.store) === null || _g === void 0 ? void 0 : _g.id },
|
|
94
96
|
unacceptedPaymentMethod: params.unacceptedPaymentMethod,
|
|
95
97
|
excludeAppliesToMovieTicket: params.excludeAppliesToMovieTicket,
|
|
96
98
|
priceSpecification: priceSpecificationCondition,
|
|
@@ -118,7 +120,7 @@ function searchTicketOffersByItemOffered(params) {
|
|
|
118
120
|
const availableOffers = yield repos.offer.searchAllByIdsAndOfferCatalogId({
|
|
119
121
|
ids: params.ids,
|
|
120
122
|
includedInDataCatalog: { id: includedInDataCatalogIds, isOfferCatalogItem },
|
|
121
|
-
availableAtOrFrom: { id: (
|
|
123
|
+
availableAtOrFrom: { id: (_h = params.store) === null || _h === void 0 ? void 0 : _h.id },
|
|
122
124
|
unacceptedPaymentMethod: params.unacceptedPaymentMethod,
|
|
123
125
|
excludeAppliesToMovieTicket: params.excludeAppliesToMovieTicket,
|
|
124
126
|
onlyValid: params.onlyValid === true
|
|
@@ -354,7 +356,7 @@ exports.searchEventTicketOffers = searchEventTicketOffers;
|
|
|
354
356
|
*/
|
|
355
357
|
function searchOfferAppliesToMovieTicket(params) {
|
|
356
358
|
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
357
|
-
var _a, _b, _c;
|
|
359
|
+
var _a, _b, _c, _d;
|
|
358
360
|
// optimize(2024-07-18~)
|
|
359
361
|
const event = yield repos.event.projectEventFieldsById({ id: params.event.id }, ['project', 'startDate', 'typeOf', 'superEvent.id', 'offers.itemOffered.id', 'offers.unacceptedPaymentMethod']);
|
|
360
362
|
// let soundFormatTypes: string[] = [];
|
|
@@ -390,8 +392,10 @@ function searchOfferAppliesToMovieTicket(params) {
|
|
|
390
392
|
if (eventService === undefined) {
|
|
391
393
|
throw new factory.errors.NotFound(factory.product.ProductType.EventService);
|
|
392
394
|
}
|
|
393
|
-
|
|
394
|
-
|
|
395
|
+
// const firstCatalogIdOfProduct = eventService.hasOfferCatalog?.id; // migrate to itemListElement(2024-09-30~)
|
|
396
|
+
const firstCatalogIdOfProduct = (_c = (_b = eventService.hasOfferCatalog) === null || _b === void 0 ? void 0 : _b.itemListElement.at(0)) === null || _c === void 0 ? void 0 : _c.id;
|
|
397
|
+
if (typeof firstCatalogIdOfProduct === 'string') {
|
|
398
|
+
catalogId = firstCatalogIdOfProduct;
|
|
395
399
|
}
|
|
396
400
|
}
|
|
397
401
|
if (typeof catalogId !== 'string') {
|
|
@@ -408,7 +412,7 @@ function searchOfferAppliesToMovieTicket(params) {
|
|
|
408
412
|
return repos.offer.searchAvaialbleAppliesToMovieTicketByOfferCatalogId({
|
|
409
413
|
// subOfferCatalog: { id: subOfferCatalogId, isOfferCatalogItem },
|
|
410
414
|
subOfferCatalog: { id: subOfferCatalogId },
|
|
411
|
-
availableAtOrFrom: { id: (
|
|
415
|
+
availableAtOrFrom: { id: (_d = params.store) === null || _d === void 0 ? void 0 : _d.id },
|
|
412
416
|
unacceptedPaymentMethod: unacceptedPaymentMethod,
|
|
413
417
|
excludeAppliesToMovieTicket: excludeAppliesToMovieTicket,
|
|
414
418
|
onlyValid: params.onlyValid === true,
|
|
@@ -424,7 +428,7 @@ exports.searchOfferAppliesToMovieTicket = searchOfferAppliesToMovieTicket;
|
|
|
424
428
|
*/
|
|
425
429
|
function searchOfferCatalogItems(params) {
|
|
426
430
|
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
427
|
-
var _a, _b;
|
|
431
|
+
var _a, _b, _c;
|
|
428
432
|
if (typeof params.limit !== 'number') {
|
|
429
433
|
throw new factory.errors.Argument('limit', 'must be number');
|
|
430
434
|
}
|
|
@@ -448,8 +452,10 @@ function searchOfferCatalogItems(params) {
|
|
|
448
452
|
if (eventService === undefined) {
|
|
449
453
|
throw new factory.errors.NotFound(factory.product.ProductType.EventService);
|
|
450
454
|
}
|
|
451
|
-
|
|
452
|
-
|
|
455
|
+
// const firstCatalogIdOfProduct = eventService.hasOfferCatalog?.id; // migrate to itemListElement(2024-09-30~)
|
|
456
|
+
const firstCatalogIdOfProduct = (_c = (_b = eventService.hasOfferCatalog) === null || _b === void 0 ? void 0 : _b.itemListElement.at(0)) === null || _c === void 0 ? void 0 : _c.id;
|
|
457
|
+
if (typeof firstCatalogIdOfProduct === 'string') {
|
|
458
|
+
catalogId = firstCatalogIdOfProduct;
|
|
453
459
|
}
|
|
454
460
|
}
|
|
455
461
|
if (typeof catalogId !== 'string') {
|
|
@@ -494,7 +500,7 @@ exports.searchOfferCatalogItems = searchOfferCatalogItems;
|
|
|
494
500
|
*/
|
|
495
501
|
function searchOfferCatalogItemAvailability(params) {
|
|
496
502
|
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
497
|
-
var _a, _b;
|
|
503
|
+
var _a, _b, _c;
|
|
498
504
|
const { considerUnacceptedPaymentMethod } = params.options;
|
|
499
505
|
if (typeof params.limit !== 'number') {
|
|
500
506
|
throw new factory.errors.Argument('limit', 'must be number');
|
|
@@ -519,8 +525,10 @@ function searchOfferCatalogItemAvailability(params) {
|
|
|
519
525
|
if (eventService === undefined) {
|
|
520
526
|
throw new factory.errors.NotFound(factory.product.ProductType.EventService);
|
|
521
527
|
}
|
|
522
|
-
|
|
523
|
-
|
|
528
|
+
// const firstCatalogIdOfProduct = eventService.hasOfferCatalog?.id; // migrate to itemListElement(2024-09-30~)
|
|
529
|
+
const firstCatalogIdOfProduct = (_c = (_b = eventService.hasOfferCatalog) === null || _b === void 0 ? void 0 : _b.itemListElement.at(0)) === null || _c === void 0 ? void 0 : _c.id;
|
|
530
|
+
if (typeof firstCatalogIdOfProduct === 'string') {
|
|
531
|
+
catalogId = firstCatalogIdOfProduct;
|
|
524
532
|
}
|
|
525
533
|
}
|
|
526
534
|
if (typeof catalogId !== 'string') {
|
|
@@ -17,7 +17,7 @@ const factory = require("../../../factory");
|
|
|
17
17
|
function searchProductOffers(params) {
|
|
18
18
|
// tslint:disable-next-line:max-func-body-length
|
|
19
19
|
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
20
|
-
var _a, _b;
|
|
20
|
+
var _a, _b, _c;
|
|
21
21
|
// プロダクト検索
|
|
22
22
|
const productWithOffers = (yield repos.product.projectFields({
|
|
23
23
|
limit: 1,
|
|
@@ -29,7 +29,8 @@ function searchProductOffers(params) {
|
|
|
29
29
|
if (productWithOffers === undefined) {
|
|
30
30
|
throw new factory.errors.NotFound('Product');
|
|
31
31
|
}
|
|
32
|
-
const offerCatalogId =
|
|
32
|
+
// const offerCatalogId = productWithOffers.hasOfferCatalog?.id; // migrate to itemListElement(2024-09-30~)
|
|
33
|
+
const offerCatalogId = (_b = (_a = productWithOffers.hasOfferCatalog) === null || _a === void 0 ? void 0 : _a.itemListElement.at(0)) === null || _b === void 0 ? void 0 : _b.id;
|
|
33
34
|
if (typeof offerCatalogId !== 'string') {
|
|
34
35
|
return [];
|
|
35
36
|
}
|
|
@@ -49,7 +50,7 @@ function searchProductOffers(params) {
|
|
|
49
50
|
throw new factory.errors.NotImplemented('id specification on addSortIndex not implemented');
|
|
50
51
|
}
|
|
51
52
|
// 明示的にカタログ指定可能にする
|
|
52
|
-
if (typeof ((
|
|
53
|
+
if (typeof ((_c = params.includedInDataCatalog) === null || _c === void 0 ? void 0 : _c.id) === 'string' && params.includedInDataCatalog.id.length > 0) {
|
|
53
54
|
if (isOfferCatalogItem) {
|
|
54
55
|
// no op
|
|
55
56
|
}
|
package/package.json
CHANGED
|
@@ -9,8 +9,8 @@
|
|
|
9
9
|
}
|
|
10
10
|
],
|
|
11
11
|
"dependencies": {
|
|
12
|
-
"@chevre/factory": "4.
|
|
13
|
-
"@cinerino/sdk": "10.
|
|
12
|
+
"@chevre/factory": "4.386.0-alpha.0",
|
|
13
|
+
"@cinerino/sdk": "10.12.0-alpha.0",
|
|
14
14
|
"@motionpicture/coa-service": "9.5.0",
|
|
15
15
|
"@motionpicture/gmo-service": "5.3.0",
|
|
16
16
|
"@sendgrid/mail": "6.4.0",
|
|
@@ -110,5 +110,5 @@
|
|
|
110
110
|
"postversion": "git push origin --tags",
|
|
111
111
|
"prepublishOnly": "npm run clean && npm run build && npm test && npm run doc"
|
|
112
112
|
},
|
|
113
|
-
"version": "22.5.0-alpha.
|
|
113
|
+
"version": "22.5.0-alpha.2"
|
|
114
114
|
}
|