@chevre/domain 20.2.0-alpha.32 → 20.2.0-alpha.33
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/offer.d.ts +3 -0
- package/lib/chevre/repo/offer.js +4 -2
- package/lib/chevre/service/aggregation/event/aggregateScreeningEvent.js +2 -16
- package/lib/chevre/service/aggregation/event/aggregateUseActionsOnEvent.js +2 -7
- package/lib/chevre/service/assetTransaction/registerService.js +4 -1
- package/lib/chevre/service/assetTransaction/reserve.js +2 -1
- 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 +18 -5
- package/lib/chevre/service/offer/product/searchProductOffers.d.ts +1 -0
- package/lib/chevre/service/offer/product/searchProductOffers.js +1 -1
- package/lib/chevre/service/offer/product.d.ts +1 -0
- package/lib/chevre/service/offer/product.js +6 -2
- package/lib/chevre/service/transaction/orderProgramMembership.js +2 -1
- package/package.json +1 -1
package/lib/chevre/repo/offer.js
CHANGED
|
@@ -346,8 +346,10 @@ class MongoRepository {
|
|
|
346
346
|
let offers = [];
|
|
347
347
|
if (sortedOfferIds.length > 0) {
|
|
348
348
|
offers = yield this.search({ id: { $in: sortedOfferIds } });
|
|
349
|
-
|
|
350
|
-
|
|
349
|
+
if (params.sort) {
|
|
350
|
+
// sorting
|
|
351
|
+
offers = offers.sort((a, b) => sortedOfferIds.indexOf(String(a.id)) - sortedOfferIds.indexOf(String(b.id)));
|
|
352
|
+
}
|
|
351
353
|
}
|
|
352
354
|
return offers;
|
|
353
355
|
});
|
|
@@ -93,13 +93,6 @@ function aggregateByEvent(params) {
|
|
|
93
93
|
screeningRoom: screeningRoom
|
|
94
94
|
})(repos);
|
|
95
95
|
debug('offers aggregated', aggregateOffer);
|
|
96
|
-
// 入場ゲートごとの集計
|
|
97
|
-
// const aggregateEntranceGate = await aggregateEntranceGateByEvent({
|
|
98
|
-
// aggregateDate: now,
|
|
99
|
-
// event,
|
|
100
|
-
// entranceGates: movieTheater.hasEntranceGate
|
|
101
|
-
// })(repos);
|
|
102
|
-
// debug('entrances aggregated', aggregateEntranceGate);
|
|
103
96
|
// 値がundefinedの場合に更新しないように注意
|
|
104
97
|
const update = {
|
|
105
98
|
$set: Object.assign(Object.assign(Object.assign(Object.assign({ updatedAt: new Date(), // $setオブジェクトが空だとMongoエラーになるので
|
|
@@ -200,20 +193,13 @@ function findOffers(params) {
|
|
|
200
193
|
const eventService = yield repos.product.findById({ id: eventOffers.itemOffered.id });
|
|
201
194
|
if (typeof ((_b = eventService.hasOfferCatalog) === null || _b === void 0 ? void 0 : _b.id) === 'string') {
|
|
202
195
|
availableOffers = yield repos.offer.findOffersByOfferCatalogId({
|
|
203
|
-
offerCatalog: { id: eventService.hasOfferCatalog.id }
|
|
196
|
+
offerCatalog: { id: eventService.hasOfferCatalog.id },
|
|
197
|
+
sort: false // ソート不要(2023-01-27~)
|
|
204
198
|
});
|
|
205
199
|
}
|
|
206
200
|
}
|
|
207
201
|
else {
|
|
208
|
-
// hasOfferCatalog参照廃止(2022-09-02~)
|
|
209
202
|
throw new factory.errors.NotFound('event.offers.itemOffered.id');
|
|
210
|
-
// if (typeof params.event.hasOfferCatalog?.id === 'string') {
|
|
211
|
-
// availableOffers = await repos.offer.findOffersByOfferCatalogId({
|
|
212
|
-
// offerCatalog: {
|
|
213
|
-
// id: params.event.hasOfferCatalog.id
|
|
214
|
-
// }
|
|
215
|
-
// });
|
|
216
|
-
// }
|
|
217
203
|
}
|
|
218
204
|
}
|
|
219
205
|
catch (error) {
|
|
@@ -92,18 +92,13 @@ function findOffers(params) {
|
|
|
92
92
|
const eventService = yield repos.product.findById({ id: eventOffers.itemOffered.id });
|
|
93
93
|
if (typeof ((_b = eventService.hasOfferCatalog) === null || _b === void 0 ? void 0 : _b.id) === 'string') {
|
|
94
94
|
availableOffers = yield repos.offer.findOffersByOfferCatalogId({
|
|
95
|
-
offerCatalog: { id: eventService.hasOfferCatalog.id }
|
|
95
|
+
offerCatalog: { id: eventService.hasOfferCatalog.id },
|
|
96
|
+
sort: false // ソート不要(2023-01-27~)
|
|
96
97
|
});
|
|
97
98
|
}
|
|
98
99
|
}
|
|
99
100
|
else {
|
|
100
|
-
// hasOfferCatalog参照廃止(2022-09-02~)
|
|
101
101
|
throw new factory.errors.NotFound('event.offers.itemOffered.id');
|
|
102
|
-
// if (typeof params.event.hasOfferCatalog?.id === 'string') {
|
|
103
|
-
// availableOffers = await repos.offer.findOffersByOfferCatalogId({
|
|
104
|
-
// offerCatalog: { id: params.event.hasOfferCatalog.id }
|
|
105
|
-
// });
|
|
106
|
-
// }
|
|
107
102
|
}
|
|
108
103
|
}
|
|
109
104
|
catch (error) {
|
|
@@ -93,7 +93,10 @@ exports.start = start;
|
|
|
93
93
|
function createTransactionObject(params) {
|
|
94
94
|
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
95
95
|
// オファー検索
|
|
96
|
-
const offers = yield (0, searchProductOffers_1.searchProductOffers)({
|
|
96
|
+
const offers = yield (0, searchProductOffers_1.searchProductOffers)({
|
|
97
|
+
itemOffered: { id: String(params.product.id) },
|
|
98
|
+
sort: false // ソート不要(2023-01-27~)
|
|
99
|
+
})(repos);
|
|
97
100
|
const transactionObject = [];
|
|
98
101
|
for (const acceptedOffer of params.acceptedOffers) {
|
|
99
102
|
const offer = offers.find((o) => o.id === acceptedOffer.id);
|
|
@@ -93,7 +93,8 @@ function addReservations(params) {
|
|
|
93
93
|
// イベントオファー検索
|
|
94
94
|
const { ticketOffers, unitPriceOffers } = yield OfferService.event.searchEventTicketOffers({
|
|
95
95
|
ids: acceptedOfferIds,
|
|
96
|
-
event: { id: event.id }
|
|
96
|
+
event: { id: event.id },
|
|
97
|
+
sort: false // ソート不要(2023-01-27~)
|
|
97
98
|
})(repos);
|
|
98
99
|
// 冗長なfindOffersByOfferCatalogId処理を削除(2023-01-26~)
|
|
99
100
|
const availableOffers = unitPriceOffers;
|
|
@@ -288,7 +288,8 @@ function validateAcceptedOffers(params) {
|
|
|
288
288
|
ids: offerIds,
|
|
289
289
|
event: { id: params.event.id },
|
|
290
290
|
seller: params.seller,
|
|
291
|
-
store: params.store
|
|
291
|
+
store: params.store,
|
|
292
|
+
sort: false // ソート不要(2023-01-27~)
|
|
292
293
|
})(repos);
|
|
293
294
|
// 利用可能なチケットオファーであれば受け入れる
|
|
294
295
|
const acceptedOffers = (Array.isArray(acceptedOffersWithoutDetail))
|
|
@@ -76,6 +76,7 @@ declare function searchEventTicketOffers(params: {
|
|
|
76
76
|
*/
|
|
77
77
|
kbnEisyahousiki: string;
|
|
78
78
|
};
|
|
79
|
+
sort: boolean;
|
|
79
80
|
}): ISearchEventTicketOffersOperation<{
|
|
80
81
|
ticketOffers: factory.product.ITicketOffer[];
|
|
81
82
|
unitPriceOffers: factory.unitPriceOffer.IUnitPriceOffer[];
|
|
@@ -31,7 +31,8 @@ function searchTransportationEventTicketOffers(params) {
|
|
|
31
31
|
if (typeof ((_b = transportation.hasOfferCatalog) === null || _b === void 0 ? void 0 : _b.id) === 'string') {
|
|
32
32
|
availableOffers = yield repos.offer.findOffersByOfferCatalogId({
|
|
33
33
|
ids: params.ids,
|
|
34
|
-
offerCatalog: { id: transportation.hasOfferCatalog.id }
|
|
34
|
+
offerCatalog: { id: transportation.hasOfferCatalog.id },
|
|
35
|
+
sort: params.sort
|
|
35
36
|
});
|
|
36
37
|
}
|
|
37
38
|
}
|
|
@@ -145,7 +146,8 @@ function searchScreeningEventTicketOffers(params) {
|
|
|
145
146
|
if (typeof ((_b = eventService.hasOfferCatalog) === null || _b === void 0 ? void 0 : _b.id) === 'string') {
|
|
146
147
|
availableOffers = yield repos.offer.findOffersByOfferCatalogId({
|
|
147
148
|
ids: params.ids,
|
|
148
|
-
offerCatalog: { id: eventService.hasOfferCatalog.id }
|
|
149
|
+
offerCatalog: { id: eventService.hasOfferCatalog.id },
|
|
150
|
+
sort: params.sort
|
|
149
151
|
});
|
|
150
152
|
}
|
|
151
153
|
}
|
|
@@ -331,7 +333,10 @@ function searchAddOns(params) {
|
|
|
331
333
|
const productWithAddOns = yield repos.product.findById({ id: productId });
|
|
332
334
|
const offerCatalogId = (_b = productWithAddOns.hasOfferCatalog) === null || _b === void 0 ? void 0 : _b.id;
|
|
333
335
|
if (typeof offerCatalogId === 'string') {
|
|
334
|
-
offers = yield repos.offer.findOffersByOfferCatalogId({
|
|
336
|
+
offers = yield repos.offer.findOffersByOfferCatalogId({
|
|
337
|
+
offerCatalog: { id: offerCatalogId },
|
|
338
|
+
sort: true
|
|
339
|
+
});
|
|
335
340
|
offers = offers.map((o) => {
|
|
336
341
|
return Object.assign(Object.assign({ additionalProperty: Array.isArray(o.additionalProperty) ? o.additionalProperty : [], alternateName: o.alternateName, availability: o.availability, availableAtOrFrom: o.availableAtOrFrom, color: o.color, description: o.description, id: o.id, identifier: o.identifier, itemOffered: {
|
|
337
342
|
description: productWithAddOns.description,
|
|
@@ -376,12 +381,20 @@ function searchEventTicketOffers(params) {
|
|
|
376
381
|
default:
|
|
377
382
|
// Chevreで券種オファーを検索
|
|
378
383
|
if (event.typeOf === factory.eventType.ScreeningEvent) {
|
|
379
|
-
const searchOffersResult = yield searchScreeningEventTicketOffers({
|
|
384
|
+
const searchOffersResult = yield searchScreeningEventTicketOffers({
|
|
385
|
+
ids: params.ids,
|
|
386
|
+
event,
|
|
387
|
+
sort: params.sort
|
|
388
|
+
})(repos);
|
|
380
389
|
offers = searchOffersResult.ticketOffers;
|
|
381
390
|
unitPriceOffers = searchOffersResult.unitPriceOffers;
|
|
382
391
|
}
|
|
383
392
|
else if (event.typeOf === factory.eventType.Event) {
|
|
384
|
-
const searchOffersResult = yield searchTransportationEventTicketOffers({
|
|
393
|
+
const searchOffersResult = yield searchTransportationEventTicketOffers({
|
|
394
|
+
ids: params.ids,
|
|
395
|
+
event,
|
|
396
|
+
sort: params.sort
|
|
397
|
+
})(repos);
|
|
385
398
|
offers = searchOffersResult.ticketOffers;
|
|
386
399
|
unitPriceOffers = searchOffersResult.unitPriceOffers;
|
|
387
400
|
}
|
|
@@ -23,7 +23,7 @@ function searchProductOffers(params) {
|
|
|
23
23
|
if (typeof offerCatalogId !== 'string') {
|
|
24
24
|
return [];
|
|
25
25
|
}
|
|
26
|
-
const offers = yield repos.offer.findOffersByOfferCatalogId({ offerCatalog: { id: offerCatalogId } });
|
|
26
|
+
const offers = yield repos.offer.findOffersByOfferCatalogId({ offerCatalog: { id: offerCatalogId }, sort: params.sort });
|
|
27
27
|
return offers.map((o) => {
|
|
28
28
|
const unitSpec = o.priceSpecification;
|
|
29
29
|
const compoundPriceSpecification = {
|
|
@@ -58,7 +58,10 @@ function search(params) {
|
|
|
58
58
|
return offers;
|
|
59
59
|
}
|
|
60
60
|
}
|
|
61
|
-
offers = yield (0, searchProductOffers_1.searchProductOffers)({
|
|
61
|
+
offers = yield (0, searchProductOffers_1.searchProductOffers)({
|
|
62
|
+
itemOffered: { id: params.itemOffered.id },
|
|
63
|
+
sort: params.sort
|
|
64
|
+
})(repos);
|
|
62
65
|
// 店舗条件によって対象を絞る
|
|
63
66
|
const storeId = (_b = params.availableAt) === null || _b === void 0 ? void 0 : _b.id;
|
|
64
67
|
if (typeof storeId === 'string') {
|
|
@@ -198,7 +201,8 @@ function fixProductAndOffers(params) {
|
|
|
198
201
|
if (product === undefined) {
|
|
199
202
|
throw new factory.errors.NotFound('Product');
|
|
200
203
|
}
|
|
201
|
-
const availableOffers = yield search(Object.assign({ project: { id: params.project.id }, itemOffered: { id: String(product.id) }, onlyValid: true }, (typeof ((_c = params.location) === null || _c === void 0 ? void 0 : _c.id) === 'string') ? { availableAt: { id: params.location.id } } : undefined)
|
|
204
|
+
const availableOffers = yield search(Object.assign(Object.assign({ project: { id: params.project.id }, itemOffered: { id: String(product.id) }, onlyValid: true }, (typeof ((_c = params.location) === null || _c === void 0 ? void 0 : _c.id) === 'string') ? { availableAt: { id: params.location.id } } : undefined), { sort: false // ソート不要(2023-01-27~)
|
|
205
|
+
}))(repos);
|
|
202
206
|
return { product, availableOffers };
|
|
203
207
|
});
|
|
204
208
|
}
|
|
@@ -218,7 +218,8 @@ function processAuthorizeProductOffer(params) {
|
|
|
218
218
|
project: { id: params.project.id },
|
|
219
219
|
itemOffered: { id: params.product.id },
|
|
220
220
|
seller: { id: String(seller.id) },
|
|
221
|
-
onlyValid: true
|
|
221
|
+
onlyValid: true,
|
|
222
|
+
sort: false // ソート不要(2023-01-27~)
|
|
222
223
|
})(repos);
|
|
223
224
|
const acceptedProductOffer = offers.find((o) => o.identifier === acceptedOffer.identifier);
|
|
224
225
|
if (acceptedProductOffer === undefined) {
|
package/package.json
CHANGED