@chevre/domain 25.2.0-alpha.40 → 25.2.0-alpha.42
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/offerInCatalogReadOnly.d.ts +1 -1
- package/lib/chevre/repo/offer/unitPriceInCatalog.d.ts +1 -1
- package/lib/chevre/repo/offer/unitPriceInCatalog.js +54 -7
- package/lib/chevre/service/offer/eventServiceByCOA/authorize/validateAcceptedOffers.js +2 -1
- package/lib/chevre/service/task/onResourceUpdated/onAggregateOfferUpdated.js +1 -1
- package/lib/chevre/service/transaction/placeOrder/confirm/prepareUnitPriceOfferConditions.js +1 -1
- package/lib/chevre/service/transaction/returnOrder/preStart.js +1 -1
- package/package.json +2 -2
|
@@ -129,6 +129,6 @@ declare abstract class OfferInCatalogReadOnlyRepo {
|
|
|
129
129
|
id: string;
|
|
130
130
|
}[]>;
|
|
131
131
|
abstract count(params: Omit<factory.unitPriceOffer.ISearchConditions, 'limit' | 'page' | 'sort'>): Promise<number>;
|
|
132
|
-
abstract
|
|
132
|
+
abstract findUnitPriceOffers(params: factory.unitPriceOffer.ISearchConditions, projection?: IProjection): Promise<IOfferInCatalog[]>;
|
|
133
133
|
}
|
|
134
134
|
export { KeyOfOffer, IProjection, IOfferInCatalog, IPriceSpecificationConditionsOnSearchWithSortIndex, OfferInCatalogReadOnlyRepo };
|
|
@@ -138,7 +138,7 @@ export declare class OfferRepo implements OfferInCatalogReadOnlyRepo {
|
|
|
138
138
|
unacceptedPaymentMethod: string[];
|
|
139
139
|
}): Promise<boolean>;
|
|
140
140
|
count(params: Omit<factory.unitPriceOffer.ISearchConditions, 'limit' | 'page' | 'sort'>): Promise<number>;
|
|
141
|
-
|
|
141
|
+
findUnitPriceOffers(params: factory.unitPriceOffer.ISearchConditions, projection?: IProjection): Promise<IOfferInCatalog[]>;
|
|
142
142
|
/**
|
|
143
143
|
* サブカタログから集計オファーIDリストを検索する
|
|
144
144
|
*/
|
|
@@ -109,7 +109,7 @@ class OfferRepo {
|
|
|
109
109
|
const searchOffersConditions = {
|
|
110
110
|
parentOffer: { id: { $in: sortedOfferIds } }
|
|
111
111
|
};
|
|
112
|
-
offers = await this.
|
|
112
|
+
offers = await this.findUnitPriceOffers(searchOffersConditions, params.projection);
|
|
113
113
|
}
|
|
114
114
|
return { offers };
|
|
115
115
|
}
|
|
@@ -165,7 +165,7 @@ class OfferRepo {
|
|
|
165
165
|
? { availableAtOrFrom: { id: { $eq: params.availableAtOrFrom.id } } } // store.idでのフィルターをmongoで処理(2023-01-27~)
|
|
166
166
|
: undefined
|
|
167
167
|
};
|
|
168
|
-
offers = await this.
|
|
168
|
+
offers = await this.findUnitPriceOffers(searchOffersConditions, params.projection);
|
|
169
169
|
}
|
|
170
170
|
return offers;
|
|
171
171
|
}
|
|
@@ -227,7 +227,7 @@ class OfferRepo {
|
|
|
227
227
|
...(typeof params.limit === 'number') ? { limit: params.limit } : undefined,
|
|
228
228
|
...(typeof params.page === 'number') ? { page: params.page } : undefined
|
|
229
229
|
};
|
|
230
|
-
offers = await this.
|
|
230
|
+
offers = await this.findUnitPriceOffers(searchOffersConditions, params.projection);
|
|
231
231
|
}
|
|
232
232
|
return { offers, sortedOfferIds };
|
|
233
233
|
}
|
|
@@ -384,19 +384,63 @@ class OfferRepo {
|
|
|
384
384
|
.exec();
|
|
385
385
|
return (result.length > 0) ? result[0].offerCount : 0;
|
|
386
386
|
}
|
|
387
|
-
|
|
387
|
+
// findUnitPriceOffersへ移行(2026-07-23~)
|
|
388
|
+
// /**
|
|
389
|
+
// * @deprecated use findUnitPriceOffers
|
|
390
|
+
// */
|
|
391
|
+
// public async search(
|
|
392
|
+
// params: factory.unitPriceOffer.ISearchConditions,
|
|
393
|
+
// projection?: IProjection
|
|
394
|
+
// ): Promise<IOfferInCatalog[]> {
|
|
395
|
+
// const matchStages = AggregateOfferRepo.CREATE_MATCH_STAGE(params);
|
|
396
|
+
// const projectStage = OfferRepo.CREATE_AGGREGATE_OFFERS_PROJECTION({ ...projection });
|
|
397
|
+
// const sortByPrice = params.sort?.['priceSpecification.price'];
|
|
398
|
+
// const sortByIdentifier = params.sort?.identifier;
|
|
399
|
+
// const aggregate = this.aggregateOfferModel.aggregate<IOfferInCatalog>([
|
|
400
|
+
// {
|
|
401
|
+
// $unwind: {
|
|
402
|
+
// path: '$offers',
|
|
403
|
+
// includeArrayIndex: OFFERS_ARRAY_INDEX_NAME
|
|
404
|
+
// }
|
|
405
|
+
// },
|
|
406
|
+
// ...matchStages,
|
|
407
|
+
// ...(typeof sortByPrice === 'number' || typeof sortByIdentifier === 'number')
|
|
408
|
+
// ? [
|
|
409
|
+
// {
|
|
410
|
+
// $sort: {
|
|
411
|
+
// ...(typeof sortByPrice === 'number')
|
|
412
|
+
// ? { 'offers.priceSpecification.price': sortByPrice }
|
|
413
|
+
// : undefined,
|
|
414
|
+
// ...(typeof sortByIdentifier === 'number')
|
|
415
|
+
// ? { 'offers.identifier': sortByIdentifier }
|
|
416
|
+
// : undefined
|
|
417
|
+
// }
|
|
418
|
+
// }
|
|
419
|
+
// ]
|
|
420
|
+
// : [],
|
|
421
|
+
// { $project: projectStage }
|
|
422
|
+
// ]);
|
|
423
|
+
// /* istanbul ignore else */
|
|
424
|
+
// if (typeof params.limit === 'number' && params.limit > 0) {
|
|
425
|
+
// const page: number = (typeof params.page === 'number' && params.page > 0) ? params.page : 1;
|
|
426
|
+
// aggregate.limit(params.limit * page)
|
|
427
|
+
// .skip(params.limit * (page - 1));
|
|
428
|
+
// }
|
|
429
|
+
// return aggregate.exec();
|
|
430
|
+
// }
|
|
431
|
+
async findUnitPriceOffers(params, projection) {
|
|
388
432
|
const matchStages = aggregateOffer_1.AggregateOfferRepo.CREATE_MATCH_STAGE(params);
|
|
389
433
|
const projectStage = OfferRepo.CREATE_AGGREGATE_OFFERS_PROJECTION({ ...projection });
|
|
390
434
|
const sortByPrice = params.sort?.['priceSpecification.price'];
|
|
391
435
|
const sortByIdentifier = params.sort?.identifier;
|
|
392
436
|
const aggregate = this.aggregateOfferModel.aggregate([
|
|
437
|
+
...matchStages, // match -> unwind(2026-07-23~)
|
|
393
438
|
{
|
|
394
439
|
$unwind: {
|
|
395
440
|
path: '$offers',
|
|
396
441
|
includeArrayIndex: OFFERS_ARRAY_INDEX_NAME
|
|
397
442
|
}
|
|
398
443
|
},
|
|
399
|
-
...matchStages,
|
|
400
444
|
...(typeof sortByPrice === 'number' || typeof sortByIdentifier === 'number')
|
|
401
445
|
? [
|
|
402
446
|
{
|
|
@@ -416,8 +460,11 @@ class OfferRepo {
|
|
|
416
460
|
/* istanbul ignore else */
|
|
417
461
|
if (typeof params.limit === 'number' && params.limit > 0) {
|
|
418
462
|
const page = (typeof params.page === 'number' && params.page > 0) ? params.page : 1;
|
|
419
|
-
|
|
420
|
-
|
|
463
|
+
// support skip -> limit(2026-07-23~)
|
|
464
|
+
// aggregate.limit(params.limit * page)
|
|
465
|
+
// .skip(params.limit * (page - 1));
|
|
466
|
+
aggregate.skip(params.limit * (page - 1))
|
|
467
|
+
.limit(params.limit);
|
|
421
468
|
}
|
|
422
469
|
return aggregate.exec();
|
|
423
470
|
}
|
|
@@ -310,7 +310,8 @@ function validateAcceptedOffers(params) {
|
|
|
310
310
|
// 指定された単価オファーを検索
|
|
311
311
|
// ticketCodeで検索(2023-03-22~)
|
|
312
312
|
if (offerIdentifiers.length > 0) {
|
|
313
|
-
availableUnitPriceOffers = await repos.offer.search({
|
|
313
|
+
// availableUnitPriceOffers = await repos.offer.search({
|
|
314
|
+
availableUnitPriceOffers = await repos.offer.findUnitPriceOffers({
|
|
314
315
|
identifier: { $in: offerIdentifiers },
|
|
315
316
|
project: { id: { $eq: params.project.id } }
|
|
316
317
|
});
|
|
@@ -11,7 +11,7 @@ function createInformOfferTasks(params, setting) {
|
|
|
11
11
|
}
|
|
12
12
|
// const informResources = settings.onResourceUpdated.informResource;
|
|
13
13
|
const informResources = setting?.onResourceUpdated?.informResource;
|
|
14
|
-
const offers = await repos.offer.
|
|
14
|
+
const offers = await repos.offer.findUnitPriceOffers({
|
|
15
15
|
id: { $in: params.ids }
|
|
16
16
|
}, { typeOf: 1, name: 1, priceSpecification: 1, additionalProperty: 1, identifier: 1, project: 1 });
|
|
17
17
|
const offers4inform = offers.map(({ id, typeOf, name, priceSpecification, additionalProperty, identifier, project }) => {
|
package/lib/chevre/service/transaction/placeOrder/confirm/prepareUnitPriceOfferConditions.js
CHANGED
|
@@ -88,7 +88,7 @@ function prepareUnitPriceOfferConditions(params) {
|
|
|
88
88
|
}
|
|
89
89
|
const conditions = [];
|
|
90
90
|
const offerIds = [...new Set(params.acceptedOffers.map((o) => String(o.id)))];
|
|
91
|
-
const unitPriceOffers = await repos.offer.
|
|
91
|
+
const unitPriceOffers = await repos.offer.findUnitPriceOffers({
|
|
92
92
|
id: { $in: offerIds }
|
|
93
93
|
}, {
|
|
94
94
|
acceptedPaymentMethod: 1,
|
package/package.json
CHANGED
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"@aws-sdk/client-cognito-identity-provider": "3.1090.0",
|
|
13
13
|
"@aws-sdk/credential-providers": "3.1090.0",
|
|
14
|
-
"@chevre/factory": "10.0.0
|
|
14
|
+
"@chevre/factory": "10.0.0",
|
|
15
15
|
"@motionpicture/coa-service": "10.0.0",
|
|
16
16
|
"@motionpicture/gmo-service": "6.1.0-alpha.0",
|
|
17
17
|
"@sendgrid/client": "8.1.4",
|
|
@@ -88,5 +88,5 @@
|
|
|
88
88
|
"postversion": "git push origin --tags",
|
|
89
89
|
"prepublishOnly": "npm run clean && npm run build"
|
|
90
90
|
},
|
|
91
|
-
"version": "25.2.0-alpha.
|
|
91
|
+
"version": "25.2.0-alpha.42"
|
|
92
92
|
}
|