@chevre/domain 21.8.0-alpha.62 → 21.8.0-alpha.63
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/searchEventTicketOffers.ts +1 -0
- package/example/src/chevre/searchOffersByCatalog.ts +3 -2
- package/lib/chevre/repo/offer.d.ts +17 -8
- package/lib/chevre/repo/offer.js +53 -17
- package/lib/chevre/service/aggregation/event/aggregateScreeningEvent.js +3 -41
- package/lib/chevre/service/aggregation/event/aggregateUseActionsOnEvent.js +2 -40
- package/lib/chevre/service/aggregation/event/findEventOffers.d.ts +14 -0
- package/lib/chevre/service/aggregation/event/findEventOffers.js +51 -0
- package/lib/chevre/service/assetTransaction/registerService.js +2 -1
- package/lib/chevre/service/assetTransaction/reserve.js +3 -2
- package/lib/chevre/service/offer/event/authorize.js +2 -1
- package/lib/chevre/service/offer/event/searchEventTicketOffers.d.ts +1 -0
- package/lib/chevre/service/offer/event/searchEventTicketOffers.js +15 -8
- package/lib/chevre/service/offer/product/searchProductOffers.d.ts +1 -0
- package/lib/chevre/service/offer/product/searchProductOffers.js +12 -5
- package/lib/chevre/service/offer/product.d.ts +1 -0
- package/lib/chevre/service/offer/product.js +3 -2
- package/package.json +1 -1
- /package/example/src/chevre/{migrateAggregateOffers.ts → syncCatalogs2aggregateOffers.ts} +0 -0
|
@@ -14,9 +14,10 @@ async function main() {
|
|
|
14
14
|
page: 1,
|
|
15
15
|
// ids: ['xx', 'xxx', '1001', '901'],
|
|
16
16
|
offerCatalog: {
|
|
17
|
-
id: '
|
|
17
|
+
id: '0004'
|
|
18
18
|
},
|
|
19
|
-
excludeAppliesToMovieTicket: false
|
|
19
|
+
excludeAppliesToMovieTicket: false,
|
|
20
|
+
useIncludeInDataCatalog: true
|
|
20
21
|
});
|
|
21
22
|
// console.log(offers);
|
|
22
23
|
console.log(offers.map((offer) => {
|
|
@@ -24,14 +24,26 @@ export declare class MongoRepository {
|
|
|
24
24
|
[field: string]: AnyExpression;
|
|
25
25
|
};
|
|
26
26
|
/**
|
|
27
|
-
* カタログID
|
|
27
|
+
* カタログIDで単価オファーを全て検索する
|
|
28
28
|
* 必ずカタログデータから単価オファーIDを参照する
|
|
29
29
|
*/
|
|
30
|
-
|
|
30
|
+
searchAllByOfferCatalogId(params: {
|
|
31
|
+
offerCatalog: {
|
|
32
|
+
id: string;
|
|
33
|
+
};
|
|
34
|
+
projection?: IProjection;
|
|
35
|
+
}): Promise<{
|
|
36
|
+
offers: IUnitPriceOfferFromAggregateOffer[];
|
|
37
|
+
}>;
|
|
38
|
+
/**
|
|
39
|
+
* 単価オファーIDとカタログIDで単価オファーを検索する
|
|
40
|
+
* 必ずカタログデータから単価オファーIDを参照する
|
|
41
|
+
*/
|
|
42
|
+
searchByIdsAndOfferCatalogId(params: {
|
|
31
43
|
/**
|
|
32
|
-
* 指定したID
|
|
44
|
+
* 指定したIDの単価オファーだけ取得
|
|
33
45
|
*/
|
|
34
|
-
ids
|
|
46
|
+
ids: string[];
|
|
35
47
|
offerCatalog: {
|
|
36
48
|
id: string;
|
|
37
49
|
};
|
|
@@ -52,10 +64,6 @@ export declare class MongoRepository {
|
|
|
52
64
|
* カタログ内ソートインデックスはsortedOfferIdsで判断する
|
|
53
65
|
*/
|
|
54
66
|
searchByOfferCatalogIdWithSortIndex(params: {
|
|
55
|
-
/**
|
|
56
|
-
* 指定したIDの単価オファーだけ取得する場合
|
|
57
|
-
*/
|
|
58
|
-
ids?: string[];
|
|
59
67
|
offerCatalog: {
|
|
60
68
|
id: string;
|
|
61
69
|
};
|
|
@@ -65,6 +73,7 @@ export declare class MongoRepository {
|
|
|
65
73
|
unacceptedPaymentMethod?: string[];
|
|
66
74
|
excludeAppliesToMovieTicket: boolean;
|
|
67
75
|
onlyValid?: boolean;
|
|
76
|
+
useIncludeInDataCatalog: boolean;
|
|
68
77
|
limit?: number;
|
|
69
78
|
page?: number;
|
|
70
79
|
projection?: IProjection;
|
package/lib/chevre/repo/offer.js
CHANGED
|
@@ -440,14 +440,45 @@ class MongoRepository {
|
|
|
440
440
|
return projectStage;
|
|
441
441
|
}
|
|
442
442
|
/**
|
|
443
|
-
* カタログID
|
|
443
|
+
* カタログIDで単価オファーを全て検索する
|
|
444
444
|
* 必ずカタログデータから単価オファーIDを参照する
|
|
445
445
|
*/
|
|
446
|
-
|
|
446
|
+
searchAllByOfferCatalogId(params) {
|
|
447
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
448
|
+
const matchStages = [{ $match: { _id: { $eq: params.offerCatalog.id } } }];
|
|
449
|
+
const itemListElements = yield this.offerCatalogModel.aggregate([
|
|
450
|
+
{ $unwind: '$itemListElement' },
|
|
451
|
+
...matchStages,
|
|
452
|
+
{
|
|
453
|
+
$project: {
|
|
454
|
+
_id: 0,
|
|
455
|
+
id: '$itemListElement.id'
|
|
456
|
+
}
|
|
457
|
+
}
|
|
458
|
+
])
|
|
459
|
+
.exec();
|
|
460
|
+
const sortedOfferIds = (Array.isArray(itemListElements))
|
|
461
|
+
? itemListElements.map((element) => element.id)
|
|
462
|
+
: [];
|
|
463
|
+
let offers = [];
|
|
464
|
+
if (sortedOfferIds.length > 0) {
|
|
465
|
+
const searchOffersConditions = {
|
|
466
|
+
parentOffer: { id: { $in: sortedOfferIds } }
|
|
467
|
+
};
|
|
468
|
+
offers = yield this.search(searchOffersConditions, params.projection);
|
|
469
|
+
}
|
|
470
|
+
return { offers };
|
|
471
|
+
});
|
|
472
|
+
}
|
|
473
|
+
/**
|
|
474
|
+
* 単価オファーIDとカタログIDで単価オファーを検索する
|
|
475
|
+
* 必ずカタログデータから単価オファーIDを参照する
|
|
476
|
+
*/
|
|
477
|
+
searchByIdsAndOfferCatalogId(params) {
|
|
447
478
|
var _a;
|
|
448
479
|
return __awaiter(this, void 0, void 0, function* () {
|
|
449
480
|
const unitPriceOfferIds = params.ids;
|
|
450
|
-
let aggregateOfferIds
|
|
481
|
+
let aggregateOfferIds; // 集計オファーIDでフィルターする場合
|
|
451
482
|
if (Array.isArray(unitPriceOfferIds)) {
|
|
452
483
|
// 解釈を集計オファーIDに変更する必要がある(2023-09-11~)
|
|
453
484
|
// 単価オファーIDリスト→集計オファーIDに変換→カタログ条件にセット
|
|
@@ -508,20 +539,23 @@ class MongoRepository {
|
|
|
508
539
|
searchByOfferCatalogIdWithSortIndex(params) {
|
|
509
540
|
var _a;
|
|
510
541
|
return __awaiter(this, void 0, void 0, function* () {
|
|
511
|
-
const unitPriceOfferIds = params.ids;
|
|
512
|
-
let aggregateOfferIds
|
|
513
|
-
if (Array.isArray(unitPriceOfferIds)) {
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
542
|
+
// const unitPriceOfferIds = params.ids;
|
|
543
|
+
// let aggregateOfferIds: string[] | undefined; // 集計オファーIDでフィルターする場合
|
|
544
|
+
// if (Array.isArray(unitPriceOfferIds)) {
|
|
545
|
+
// // 解釈を集計オファーIDに変更する必要がある(2023-09-11~)
|
|
546
|
+
// // 単価オファーIDリスト→集計オファーIDに変換→カタログ条件にセット
|
|
547
|
+
// const searchDistinctAggregateOfferIdsResult = await this.aggregateOfferModel.distinct<string>(
|
|
548
|
+
// '_id',
|
|
549
|
+
// { 'offers.id': { $in: unitPriceOfferIds } }
|
|
550
|
+
// )
|
|
551
|
+
// .exec();
|
|
552
|
+
// aggregateOfferIds = searchDistinctAggregateOfferIdsResult;
|
|
553
|
+
// }
|
|
520
554
|
// aggregateで再実装(2023-01-26~)
|
|
521
555
|
const matchStages = [{ $match: { _id: { $eq: params.offerCatalog.id } } }];
|
|
522
|
-
if (Array.isArray(aggregateOfferIds)) {
|
|
523
|
-
|
|
524
|
-
}
|
|
556
|
+
// if (Array.isArray(aggregateOfferIds)) {
|
|
557
|
+
// matchStages.push({ $match: { 'itemListElement.id': { $exists: true, $in: aggregateOfferIds } } });
|
|
558
|
+
// }
|
|
525
559
|
const itemListElements = yield this.offerCatalogModel.aggregate([
|
|
526
560
|
{ $unwind: '$itemListElement' },
|
|
527
561
|
...matchStages,
|
|
@@ -538,9 +572,11 @@ class MongoRepository {
|
|
|
538
572
|
: [];
|
|
539
573
|
let offers = [];
|
|
540
574
|
if (sortedOfferIds.length > 0) {
|
|
541
|
-
const searchOffersConditions = Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(
|
|
575
|
+
const searchOffersConditions = Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({
|
|
542
576
|
// aggregateOffer.idで検索する(2023-09-09~)
|
|
543
|
-
parentOffer:
|
|
577
|
+
parentOffer: Object.assign({}, (params.useIncludeInDataCatalog)
|
|
578
|
+
? { includedInDataCatalog: { id: { $in: [params.offerCatalog.id] } } }
|
|
579
|
+
: { id: { $in: sortedOfferIds } }) }, (typeof ((_a = params.availableAtOrFrom) === null || _a === void 0 ? void 0 : _a.id) === 'string')
|
|
544
580
|
? { availableAtOrFrom: { id: { $eq: params.availableAtOrFrom.id } } }
|
|
545
581
|
: undefined), { priceSpecification: {
|
|
546
582
|
appliesToMovieTicket: Object.assign(Object.assign({}, (Array.isArray(params.unacceptedPaymentMethod) && params.unacceptedPaymentMethod.length > 0)
|
|
@@ -18,6 +18,7 @@ const moment = require("moment-timezone");
|
|
|
18
18
|
const event_1 = require("../../../repo/event");
|
|
19
19
|
const factory = require("../../../factory");
|
|
20
20
|
const settings_1 = require("../../../settings");
|
|
21
|
+
const findEventOffers_1 = require("./findEventOffers");
|
|
21
22
|
const debug = createDebug('chevre-domain:service');
|
|
22
23
|
/**
|
|
23
24
|
* イベントデータをID指定で集計する
|
|
@@ -31,7 +32,7 @@ function aggregateScreeningEvent(params) {
|
|
|
31
32
|
let aggregatingEvents = [event];
|
|
32
33
|
// プロジェクト限定(2023-02-22~)
|
|
33
34
|
if (settings_1.settings.useOfferRateLimitProjects.includes(event.project.id)) {
|
|
34
|
-
const availableOffers = yield
|
|
35
|
+
const availableOffers = yield (0, findEventOffers_1.findEventOffers)({ event })(repos);
|
|
35
36
|
const offerRateLimitExists = availableOffers.some((o) => { var _a; return typeof ((_a = o.validRateLimit) === null || _a === void 0 ? void 0 : _a.scope) === 'string'; });
|
|
36
37
|
if (offerRateLimitExists) {
|
|
37
38
|
// 同location、かつ同時間帯、のイベントに関しても集計する(ttts暫定対応)
|
|
@@ -133,7 +134,7 @@ function aggregateOfferByEvent(params) {
|
|
|
133
134
|
var _a, _b, _c;
|
|
134
135
|
// プロジェクト限定(2023-02-22~)
|
|
135
136
|
if (settings_1.settings.useAggregateOfferProjects.includes(params.event.project.id)) {
|
|
136
|
-
const availableOffers = yield
|
|
137
|
+
const availableOffers = yield (0, findEventOffers_1.findEventOffers)(params)(repos);
|
|
137
138
|
// オファーごとの予約集計
|
|
138
139
|
const offersWithAggregateReservation = [];
|
|
139
140
|
for (const o of availableOffers) {
|
|
@@ -163,45 +164,6 @@ function aggregateOfferByEvent(params) {
|
|
|
163
164
|
}
|
|
164
165
|
});
|
|
165
166
|
}
|
|
166
|
-
/**
|
|
167
|
-
* イベントオファー検索
|
|
168
|
-
* NotFoundエラーをハンドリングする
|
|
169
|
-
*/
|
|
170
|
-
function findOffers(params) {
|
|
171
|
-
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
172
|
-
var _a, _b;
|
|
173
|
-
let availableOffers = [];
|
|
174
|
-
try {
|
|
175
|
-
// 興行設定があれば興行のカタログを参照する(2022-08-31~)
|
|
176
|
-
const eventOffers = params.event.offers;
|
|
177
|
-
if (typeof ((_a = eventOffers === null || eventOffers === void 0 ? void 0 : eventOffers.itemOffered) === null || _a === void 0 ? void 0 : _a.id) === 'string') {
|
|
178
|
-
const eventService = yield repos.product.findById({ id: eventOffers.itemOffered.id }, ['hasOfferCatalog'], []);
|
|
179
|
-
if (typeof ((_b = eventService.hasOfferCatalog) === null || _b === void 0 ? void 0 : _b.id) === 'string') {
|
|
180
|
-
const { offers } = yield repos.offer.searchByOfferCatalogId({
|
|
181
|
-
offerCatalog: { id: eventService.hasOfferCatalog.id },
|
|
182
|
-
excludeAppliesToMovieTicket: false
|
|
183
|
-
// sort: false // ソート不要(2023-01-27~) // 完全廃止(2023-09-04~)
|
|
184
|
-
});
|
|
185
|
-
availableOffers = offers;
|
|
186
|
-
}
|
|
187
|
-
}
|
|
188
|
-
else {
|
|
189
|
-
throw new factory.errors.NotFound('event.offers.itemOffered.id');
|
|
190
|
-
}
|
|
191
|
-
}
|
|
192
|
-
catch (error) {
|
|
193
|
-
let throwsError = true;
|
|
194
|
-
// 万が一カタログが見つからない場合に対応
|
|
195
|
-
if (error instanceof factory.errors.NotFound) {
|
|
196
|
-
throwsError = false;
|
|
197
|
-
}
|
|
198
|
-
if (throwsError) {
|
|
199
|
-
throw error;
|
|
200
|
-
}
|
|
201
|
-
}
|
|
202
|
-
return availableOffers;
|
|
203
|
-
});
|
|
204
|
-
}
|
|
205
167
|
function calculateOfferCount(params) {
|
|
206
168
|
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
207
169
|
var _a, _b, _c;
|
|
@@ -15,6 +15,7 @@ exports.aggregateUseActionsOnEvent = void 0;
|
|
|
15
15
|
*/
|
|
16
16
|
const createDebug = require("debug");
|
|
17
17
|
const factory = require("../../../factory");
|
|
18
|
+
const findEventOffers_1 = require("./findEventOffers");
|
|
18
19
|
const debug = createDebug('chevre-domain:service');
|
|
19
20
|
function aggregateUseActionsOnEvent(params) {
|
|
20
21
|
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
@@ -88,45 +89,6 @@ function findEntranceGates(params) {
|
|
|
88
89
|
return movieTheater === null || movieTheater === void 0 ? void 0 : movieTheater.hasEntranceGate;
|
|
89
90
|
});
|
|
90
91
|
}
|
|
91
|
-
/**
|
|
92
|
-
* イベントオファー検索
|
|
93
|
-
* NotFoundエラーをハンドリングする
|
|
94
|
-
*/
|
|
95
|
-
function findOffers(params) {
|
|
96
|
-
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
97
|
-
var _a, _b;
|
|
98
|
-
let availableOffers = [];
|
|
99
|
-
try {
|
|
100
|
-
// 興行設定があれば興行のカタログを参照する(2022-08-31~)
|
|
101
|
-
const eventOffers = params.event.offers;
|
|
102
|
-
if (typeof ((_a = eventOffers === null || eventOffers === void 0 ? void 0 : eventOffers.itemOffered) === null || _a === void 0 ? void 0 : _a.id) === 'string') {
|
|
103
|
-
const eventService = yield repos.product.findById({ id: eventOffers.itemOffered.id }, ['hasOfferCatalog'], []);
|
|
104
|
-
if (typeof ((_b = eventService.hasOfferCatalog) === null || _b === void 0 ? void 0 : _b.id) === 'string') {
|
|
105
|
-
const { offers } = yield repos.offer.searchByOfferCatalogId({
|
|
106
|
-
offerCatalog: { id: eventService.hasOfferCatalog.id },
|
|
107
|
-
excludeAppliesToMovieTicket: false
|
|
108
|
-
// sort: false // ソート不要(2023-01-27~) // 完全廃止(2023-09-04~)
|
|
109
|
-
});
|
|
110
|
-
availableOffers = offers;
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
|
-
else {
|
|
114
|
-
throw new factory.errors.NotFound('event.offers.itemOffered.id');
|
|
115
|
-
}
|
|
116
|
-
}
|
|
117
|
-
catch (error) {
|
|
118
|
-
let throwsError = true;
|
|
119
|
-
// 万が一カタログが見つからない場合に対応
|
|
120
|
-
if (error instanceof factory.errors.NotFound) {
|
|
121
|
-
throwsError = false;
|
|
122
|
-
}
|
|
123
|
-
if (throwsError) {
|
|
124
|
-
throw error;
|
|
125
|
-
}
|
|
126
|
-
}
|
|
127
|
-
return availableOffers;
|
|
128
|
-
});
|
|
129
|
-
}
|
|
130
92
|
/**
|
|
131
93
|
* 入場ゲートごとに集計する
|
|
132
94
|
*/
|
|
@@ -135,7 +97,7 @@ function aggregateEntranceGateByEvent(params) {
|
|
|
135
97
|
// 入場ゲートの予約使用アクション集計
|
|
136
98
|
const places = [];
|
|
137
99
|
if (Array.isArray(params.entranceGates) && params.entranceGates.length > 0) {
|
|
138
|
-
const availableOffers = yield
|
|
100
|
+
const availableOffers = yield (0, findEventOffers_1.findEventOffers)(params)(repos);
|
|
139
101
|
// 念のため、identifierの存在する入場ゲートに絞る
|
|
140
102
|
const entranceGates = params.entranceGates.filter((e) => {
|
|
141
103
|
return typeof e.identifier === 'string' && e.identifier.length > 0;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { IMinimizedIndividualEvent } from '../../../repo/event';
|
|
2
|
+
import { MongoRepository as OfferRepo } from '../../../repo/offer';
|
|
3
|
+
import { MongoRepository as ProductRepo } from '../../../repo/product';
|
|
4
|
+
import * as factory from '../../../factory';
|
|
5
|
+
/**
|
|
6
|
+
* イベントオファー検索
|
|
7
|
+
* NotFoundエラーをハンドリングする
|
|
8
|
+
*/
|
|
9
|
+
export declare function findEventOffers(params: {
|
|
10
|
+
event: IMinimizedIndividualEvent<factory.eventType.ScreeningEvent> | IMinimizedIndividualEvent<factory.eventType.Event>;
|
|
11
|
+
}): (repos: {
|
|
12
|
+
product: ProductRepo;
|
|
13
|
+
offer: OfferRepo;
|
|
14
|
+
}) => Promise<factory.unitPriceOffer.IUnitPriceOffer[]>;
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.findEventOffers = void 0;
|
|
13
|
+
const factory = require("../../../factory");
|
|
14
|
+
/**
|
|
15
|
+
* イベントオファー検索
|
|
16
|
+
* NotFoundエラーをハンドリングする
|
|
17
|
+
*/
|
|
18
|
+
function findEventOffers(params) {
|
|
19
|
+
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
20
|
+
var _a, _b;
|
|
21
|
+
let availableOffers = [];
|
|
22
|
+
try {
|
|
23
|
+
// 興行設定があれば興行のカタログを参照する
|
|
24
|
+
const eventOffers = params.event.offers;
|
|
25
|
+
if (typeof ((_a = eventOffers === null || eventOffers === void 0 ? void 0 : eventOffers.itemOffered) === null || _a === void 0 ? void 0 : _a.id) === 'string') {
|
|
26
|
+
const eventService = yield repos.product.findById({ id: eventOffers.itemOffered.id }, ['hasOfferCatalog'], []);
|
|
27
|
+
if (typeof ((_b = eventService.hasOfferCatalog) === null || _b === void 0 ? void 0 : _b.id) === 'string') {
|
|
28
|
+
const { offers } = yield repos.offer.searchAllByOfferCatalogId({
|
|
29
|
+
offerCatalog: { id: eventService.hasOfferCatalog.id }
|
|
30
|
+
});
|
|
31
|
+
availableOffers = offers;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
else {
|
|
35
|
+
throw new factory.errors.NotFound('event.offers.itemOffered.id');
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
catch (error) {
|
|
39
|
+
let throwsError = true;
|
|
40
|
+
// 万が一カタログが見つからない場合に対応
|
|
41
|
+
if (error instanceof factory.errors.NotFound) {
|
|
42
|
+
throwsError = false;
|
|
43
|
+
}
|
|
44
|
+
if (throwsError) {
|
|
45
|
+
throw error;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
return availableOffers;
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
exports.findEventOffers = findEventOffers;
|
|
@@ -94,7 +94,8 @@ function createTransactionObject(params) {
|
|
|
94
94
|
ids: params.acceptedOffers.map((o) => o.id),
|
|
95
95
|
itemOffered: { id: String(params.product.id) },
|
|
96
96
|
onlyValid: true,
|
|
97
|
-
addSortIndex: false
|
|
97
|
+
addSortIndex: false,
|
|
98
|
+
useIncludeInDataCatalog: false
|
|
98
99
|
})(repos);
|
|
99
100
|
const transactionObject = [];
|
|
100
101
|
for (const acceptedOffer of params.acceptedOffers) {
|
|
@@ -120,7 +120,8 @@ function addReservations(params) {
|
|
|
120
120
|
store: { id: (_a = params.availableAtOrFrom) === null || _a === void 0 ? void 0 : _a.id },
|
|
121
121
|
onlyValid: true,
|
|
122
122
|
addSortIndex: false,
|
|
123
|
-
validateOfferRateLimit: true
|
|
123
|
+
validateOfferRateLimit: true,
|
|
124
|
+
useIncludeInDataCatalog: false
|
|
124
125
|
})(repos);
|
|
125
126
|
ticketOffers = searchEventTicketOffersResult.ticketOffers;
|
|
126
127
|
availableOffers = searchEventTicketOffersResult.unitPriceOffers;
|
|
@@ -476,7 +477,7 @@ function searchAvailableAddOns(params) {
|
|
|
476
477
|
if (Array.isArray(params.ticketOffer.addOn)) {
|
|
477
478
|
const addOnProductIds = [...new Set(params.ticketOffer.addOn.map((o) => String(o.itemOffered.id)))];
|
|
478
479
|
for (const addOnProductId of addOnProductIds) {
|
|
479
|
-
const { offers, product } = yield OfferService.product.search(Object.assign({ ids: params.ids, project: { id: params.project.id }, itemOffered: { id: addOnProductId }, onlyValid: true, addSortIndex: false }, (typeof ((_a = params.availableAtOrFrom) === null || _a === void 0 ? void 0 : _a.id) === 'string')
|
|
480
|
+
const { offers, product } = yield OfferService.product.search(Object.assign({ ids: params.ids, project: { id: params.project.id }, itemOffered: { id: addOnProductId }, onlyValid: true, addSortIndex: false, useIncludeInDataCatalog: false }, (typeof ((_a = params.availableAtOrFrom) === null || _a === void 0 ? void 0 : _a.id) === 'string')
|
|
480
481
|
? { availableAt: { id: params.availableAtOrFrom.id } }
|
|
481
482
|
: undefined))(repos);
|
|
482
483
|
availableAddOns.push(...offers.map((o) => {
|
|
@@ -239,7 +239,8 @@ function validateAcceptedOffers(params) {
|
|
|
239
239
|
store: params.store,
|
|
240
240
|
onlyValid: true,
|
|
241
241
|
addSortIndex: false,
|
|
242
|
-
validateOfferRateLimit: true
|
|
242
|
+
validateOfferRateLimit: true,
|
|
243
|
+
useIncludeInDataCatalog: false
|
|
243
244
|
})(repos);
|
|
244
245
|
// 利用可能なチケットオファーであれば受け入れる
|
|
245
246
|
const acceptedOffers = (Array.isArray(acceptedOffersWithoutDetail))
|
|
@@ -47,6 +47,7 @@ declare function searchEventTicketOffers(params: {
|
|
|
47
47
|
page?: number;
|
|
48
48
|
addSortIndex: boolean;
|
|
49
49
|
validateOfferRateLimit: boolean;
|
|
50
|
+
useIncludeInDataCatalog: boolean;
|
|
50
51
|
}): ISearchEventTicketOffersOperation<{
|
|
51
52
|
ticketOffers: ITicketOfferWithSortIndex[];
|
|
52
53
|
unitPriceOffers: factory.unitPriceOffer.IUnitPriceOffer[];
|
|
@@ -27,32 +27,37 @@ function searchTicketOffersByItemOffered(params) {
|
|
|
27
27
|
throw new factory.errors.NotFound('itemOffered.hasOfferCatalog');
|
|
28
28
|
}
|
|
29
29
|
if (params.withSortIndex) {
|
|
30
|
+
// addSortIndexの場合はid指定廃止(2023-09-13~)
|
|
31
|
+
if (Array.isArray(params.ids)) {
|
|
32
|
+
throw new factory.errors.NotImplemented('id specification on addSortIndex not implemented');
|
|
33
|
+
}
|
|
30
34
|
const { offers, sortedOfferIds } = yield repos.offer.searchByOfferCatalogIdWithSortIndex({
|
|
31
|
-
ids: params.ids,
|
|
35
|
+
// ids: params.ids,
|
|
32
36
|
offerCatalog: { id: catalogId },
|
|
33
37
|
availableAtOrFrom: { id: (_d = params.store) === null || _d === void 0 ? void 0 : _d.id },
|
|
34
38
|
unacceptedPaymentMethod: params.unacceptedPaymentMethod,
|
|
35
39
|
excludeAppliesToMovieTicket: params.excludeAppliesToMovieTicket,
|
|
36
40
|
onlyValid: params.onlyValid === true,
|
|
37
|
-
|
|
41
|
+
useIncludeInDataCatalog: params.useIncludeInDataCatalog,
|
|
38
42
|
limit: params.limit,
|
|
39
43
|
page: params.page
|
|
40
|
-
// sort: false // 完全廃止(2023-09-04~)
|
|
41
44
|
});
|
|
42
45
|
return { availableOffers: offers, sortedOfferIds };
|
|
43
46
|
}
|
|
44
47
|
else {
|
|
45
|
-
|
|
48
|
+
// addSortIndexの場合はid指定廃止(2023-09-13~)
|
|
49
|
+
if (!Array.isArray(params.ids)) {
|
|
50
|
+
throw new factory.errors.ArgumentNull('ids', 'ids must be specified');
|
|
51
|
+
}
|
|
52
|
+
const { offers } = yield repos.offer.searchByIdsAndOfferCatalogId({
|
|
46
53
|
ids: params.ids,
|
|
47
54
|
offerCatalog: { id: catalogId },
|
|
48
55
|
availableAtOrFrom: { id: (_e = params.store) === null || _e === void 0 ? void 0 : _e.id },
|
|
49
56
|
unacceptedPaymentMethod: params.unacceptedPaymentMethod,
|
|
50
57
|
excludeAppliesToMovieTicket: params.excludeAppliesToMovieTicket,
|
|
51
58
|
onlyValid: params.onlyValid === true,
|
|
52
|
-
// Mongoのpagingを利用するオプション(2023-02-21~)
|
|
53
59
|
limit: params.limit,
|
|
54
60
|
page: params.page
|
|
55
|
-
// sort: false // 完全廃止(2023-09-04~)
|
|
56
61
|
});
|
|
57
62
|
return { availableOffers: offers };
|
|
58
63
|
}
|
|
@@ -102,7 +107,8 @@ function searchEventTicketOffersByEvent(params) {
|
|
|
102
107
|
onlyValid: params.onlyValid,
|
|
103
108
|
unacceptedPaymentMethod,
|
|
104
109
|
excludeAppliesToMovieTicket,
|
|
105
|
-
withSortIndex: params.addSortIndex
|
|
110
|
+
withSortIndex: params.addSortIndex,
|
|
111
|
+
useIncludeInDataCatalog: params.useIncludeInDataCatalog
|
|
106
112
|
})(repos);
|
|
107
113
|
// 冗長な検索について最適化(2023-03-03~)
|
|
108
114
|
const { soundFormatChargeSpecs, videoFormatChargeSpecs, movieTicketTypeChargeSpecs } = yield searchPriceSpecs4event({
|
|
@@ -266,7 +272,8 @@ function searchEventTicketOffers(params) {
|
|
|
266
272
|
page: params.page,
|
|
267
273
|
addSortIndex: params.addSortIndex,
|
|
268
274
|
validateOfferRateLimit: params.validateOfferRateLimit,
|
|
269
|
-
onlyValid: params.onlyValid === true
|
|
275
|
+
onlyValid: params.onlyValid === true,
|
|
276
|
+
useIncludeInDataCatalog: params.useIncludeInDataCatalog
|
|
270
277
|
})(repos);
|
|
271
278
|
offers = searchOffersResult.ticketOffers;
|
|
272
279
|
unitPriceOffers = searchOffersResult.unitPriceOffers;
|
|
@@ -27,27 +27,34 @@ function searchProductOffers(params) {
|
|
|
27
27
|
let offers;
|
|
28
28
|
let sortedOfferIds;
|
|
29
29
|
if (params.addSortIndex) {
|
|
30
|
+
// addSortIndexの場合はid指定廃止(2023-09-13~)
|
|
31
|
+
if (Array.isArray(params.ids)) {
|
|
32
|
+
throw new factory.errors.NotImplemented('id specification on addSortIndex not implemented');
|
|
33
|
+
}
|
|
30
34
|
const searchByOfferCatalogIdResult = yield repos.offer.searchByOfferCatalogIdWithSortIndex({
|
|
31
|
-
ids: params.ids,
|
|
35
|
+
// ids: params.ids,
|
|
32
36
|
offerCatalog: { id: offerCatalogId },
|
|
33
37
|
excludeAppliesToMovieTicket: false,
|
|
34
38
|
limit: params.limit,
|
|
35
39
|
page: params.page,
|
|
36
|
-
// sort: false, // 完全廃止(2023-09-04~)
|
|
37
40
|
onlyValid: params.onlyValid === true,
|
|
38
|
-
availableAtOrFrom: params.availableAt
|
|
41
|
+
availableAtOrFrom: params.availableAt,
|
|
42
|
+
useIncludeInDataCatalog: params.useIncludeInDataCatalog
|
|
39
43
|
});
|
|
40
44
|
offers = searchByOfferCatalogIdResult.offers;
|
|
41
45
|
sortedOfferIds = searchByOfferCatalogIdResult.sortedOfferIds;
|
|
42
46
|
}
|
|
43
47
|
else {
|
|
44
|
-
|
|
48
|
+
// addSortIndexの場合はid指定廃止(2023-09-13~)
|
|
49
|
+
if (!Array.isArray(params.ids)) {
|
|
50
|
+
throw new factory.errors.ArgumentNull('ids', 'ids must be specified');
|
|
51
|
+
}
|
|
52
|
+
const searchByOfferCatalogIdResult = yield repos.offer.searchByIdsAndOfferCatalogId({
|
|
45
53
|
ids: params.ids,
|
|
46
54
|
offerCatalog: { id: offerCatalogId },
|
|
47
55
|
excludeAppliesToMovieTicket: false,
|
|
48
56
|
limit: params.limit,
|
|
49
57
|
page: params.page,
|
|
50
|
-
// sort: false, // 完全廃止(2023-09-04~)
|
|
51
58
|
onlyValid: params.onlyValid === true,
|
|
52
59
|
availableAtOrFrom: params.availableAt
|
|
53
60
|
});
|
|
@@ -66,7 +66,8 @@ function search(params) {
|
|
|
66
66
|
itemOffered: { id: params.itemOffered.id },
|
|
67
67
|
availableAt: params.availableAt,
|
|
68
68
|
onlyValid: params.onlyValid,
|
|
69
|
-
addSortIndex: params.addSortIndex
|
|
69
|
+
addSortIndex: params.addSortIndex,
|
|
70
|
+
useIncludeInDataCatalog: params.useIncludeInDataCatalog
|
|
70
71
|
})(repos);
|
|
71
72
|
return { offers, product };
|
|
72
73
|
// Mongoへ移行(2023-03-01~)
|
|
@@ -211,7 +212,7 @@ function fixProductAndOffers(params) {
|
|
|
211
212
|
if (product === undefined) {
|
|
212
213
|
throw new factory.errors.NotFound('Product');
|
|
213
214
|
}
|
|
214
|
-
const { offers } = yield search(Object.assign({ ids: params.object.map((o) => String(o.id)), project: { id: params.project.id }, itemOffered: { id: String(product.id) }, onlyValid: true, addSortIndex: false }, (typeof ((_c = params.location) === null || _c === void 0 ? void 0 : _c.id) === 'string') ? { availableAt: { id: params.location.id } } : undefined))(repos);
|
|
215
|
+
const { offers } = yield search(Object.assign({ ids: params.object.map((o) => String(o.id)), project: { id: params.project.id }, itemOffered: { id: String(product.id) }, onlyValid: true, addSortIndex: false, useIncludeInDataCatalog: false }, (typeof ((_c = params.location) === null || _c === void 0 ? void 0 : _c.id) === 'string') ? { availableAt: { id: params.location.id } } : undefined))(repos);
|
|
215
216
|
return { product, availableOffers: offers };
|
|
216
217
|
});
|
|
217
218
|
}
|
package/package.json
CHANGED
|
File without changes
|