@chevre/domain 21.8.0-alpha.44 → 21.8.0-alpha.45
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 +3 -1
- package/example/src/chevre/searchOffersByCatalog.ts +1 -0
- package/lib/chevre/repo/offer.d.ts +3 -0
- package/lib/chevre/repo/offer.js +7 -1
- package/lib/chevre/service/offer/factory.d.ts +10 -4
- package/lib/chevre/service/offer/factory.js +3 -3
- package/lib/chevre/service/offer/product/searchProductOffers.d.ts +8 -1
- package/lib/chevre/service/offer/product/searchProductOffers.js +2 -1
- package/package.json +1 -1
|
@@ -30,7 +30,8 @@ async function main() {
|
|
|
30
30
|
validateOfferRateLimit: true,
|
|
31
31
|
addSortIndex: true,
|
|
32
32
|
limit: 100,
|
|
33
|
-
page: 1
|
|
33
|
+
page: 1,
|
|
34
|
+
useOffersAsPrimaryForcible: false
|
|
34
35
|
// ...(typeof availableAtId === 'string') ? { store: { id: availableAtId } } : undefined
|
|
35
36
|
})({
|
|
36
37
|
event: eventRepo,
|
|
@@ -39,6 +40,7 @@ async function main() {
|
|
|
39
40
|
priceSpecification: priceSpecificationRepo,
|
|
40
41
|
product: productRepo
|
|
41
42
|
});
|
|
43
|
+
console.log(ticketOffers);
|
|
42
44
|
console.log(ticketOffers.map((o) => o.sortIndex));
|
|
43
45
|
console.log(ticketOffers.length);
|
|
44
46
|
}
|
|
@@ -21,6 +21,7 @@ async function main() {
|
|
|
21
21
|
excludeAppliesToMovieTicket: false,
|
|
22
22
|
useOffersAsPrimaryForcible: false
|
|
23
23
|
});
|
|
24
|
+
console.log(offers);
|
|
24
25
|
console.log(offers.map((offer) => {
|
|
25
26
|
return `${offer.project?.id} ${offer.identifier} ${offer.priceSpecification?.price} ${offer.name?.ja} ${offer.id} ${(<any>offer).offerIndex}`;
|
|
26
27
|
}));
|
package/lib/chevre/repo/offer.js
CHANGED
|
@@ -731,6 +731,9 @@ class MongoRepository {
|
|
|
731
731
|
let projectStage = {
|
|
732
732
|
_id: 0,
|
|
733
733
|
offerIndex: `$${OFFERS_ARRAY_INDEX_NAME}`,
|
|
734
|
+
parentOffer: {
|
|
735
|
+
id: '$_id'
|
|
736
|
+
},
|
|
734
737
|
typeOf: '$offers.typeOf',
|
|
735
738
|
project: '$project',
|
|
736
739
|
id: '$offers.id',
|
|
@@ -769,7 +772,10 @@ class MongoRepository {
|
|
|
769
772
|
if (positiveProjectionFields.length > 0) {
|
|
770
773
|
projectStage = {
|
|
771
774
|
_id: 0,
|
|
772
|
-
offerIndex: `$${OFFERS_ARRAY_INDEX_NAME}
|
|
775
|
+
offerIndex: `$${OFFERS_ARRAY_INDEX_NAME}`,
|
|
776
|
+
parentOffer: {
|
|
777
|
+
id: '$_id'
|
|
778
|
+
}
|
|
773
779
|
};
|
|
774
780
|
positiveProjectionFields.forEach((field) => {
|
|
775
781
|
projectStage[field] = `$offers.${field}`;
|
|
@@ -1,10 +1,19 @@
|
|
|
1
1
|
import * as factory from '../../factory';
|
|
2
2
|
type IMovieTicketTypeChargeSpecification = factory.priceSpecification.IPriceSpecification<factory.priceSpecificationType.MovieTicketTypeChargeSpecification>;
|
|
3
3
|
type ICategoryCodeChargeSpecification = factory.priceSpecification.IPriceSpecification<factory.priceSpecificationType.CategoryCodeChargeSpecification>;
|
|
4
|
+
type ITicketOffer = factory.product.ITicketOffer & {
|
|
5
|
+
offerIndex?: number;
|
|
6
|
+
parentOffer?: {
|
|
7
|
+
id: string;
|
|
8
|
+
};
|
|
9
|
+
};
|
|
4
10
|
declare function createCompoundPriceSpec4event(params: {
|
|
5
11
|
eligibleQuantity: factory.quantitativeValue.IQuantitativeValue<factory.unitCode.C62>;
|
|
6
12
|
offer: factory.unitPriceOffer.IUnitPriceOffer & {
|
|
7
13
|
offerIndex?: number;
|
|
14
|
+
parentOffer?: {
|
|
15
|
+
id: string;
|
|
16
|
+
};
|
|
8
17
|
};
|
|
9
18
|
movieTicketTypeChargeSpecs: IMovieTicketTypeChargeSpecification[];
|
|
10
19
|
videoFormatChargeSpecs: ICategoryCodeChargeSpecification[];
|
|
@@ -13,8 +22,5 @@ declare function createCompoundPriceSpec4event(params: {
|
|
|
13
22
|
availability?: factory.itemAvailability;
|
|
14
23
|
addOn: factory.product.IMinimizedTicketAddOn[];
|
|
15
24
|
sortIndex?: number;
|
|
16
|
-
}):
|
|
17
|
-
sortIndex?: number;
|
|
18
|
-
offerIndex?: number;
|
|
19
|
-
};
|
|
25
|
+
}): ITicketOffer;
|
|
20
26
|
export { createCompoundPriceSpec4event };
|
|
@@ -75,12 +75,12 @@ function createCompoundPriceSpec4event(params) {
|
|
|
75
75
|
priceComponent
|
|
76
76
|
};
|
|
77
77
|
// 必要な属性のみに限定(2023-02-24~)
|
|
78
|
-
const { name, description, alternateName, color, typeOf, id, availability, availableAtOrFrom, category, eligibleMembershipType, eligibleSeatingType, eligibleMonetaryAmount, eligibleSubReservation, priceCurrency, validFrom, validThrough, validRateLimit, additionalProperty, identifier, itemOffered, offerIndex } = params.offer;
|
|
79
|
-
return Object.assign(Object.assign(Object.assign({ name, description, alternateName, color, typeOf, id,
|
|
78
|
+
const { name, description, alternateName, color, typeOf, id, availability, availableAtOrFrom, category, eligibleMembershipType, eligibleSeatingType, eligibleMonetaryAmount, eligibleSubReservation, priceCurrency, validFrom, validThrough, validRateLimit, additionalProperty, identifier, itemOffered, offerIndex, parentOffer } = params.offer;
|
|
79
|
+
return Object.assign(Object.assign(Object.assign(Object.assign({ name, description, alternateName, color, typeOf, id,
|
|
80
80
|
availableAtOrFrom, category,
|
|
81
81
|
eligibleMembershipType, eligibleSeatingType, eligibleMonetaryAmount, eligibleSubReservation,
|
|
82
82
|
priceCurrency,
|
|
83
83
|
validFrom, validThrough, validRateLimit, additionalProperty,
|
|
84
|
-
identifier, itemOffered, addOn: params.addOn, eligibleQuantity: params.eligibleQuantity, priceSpecification: compoundPriceSpecification }, (typeof params.availability === 'string') ? { availability: params.availability } : { availability }), (typeof params.sortIndex === 'number') ? { sortIndex: params.sortIndex } : undefined), (typeof offerIndex === 'number') ? { offerIndex } : undefined);
|
|
84
|
+
identifier, itemOffered, addOn: params.addOn, eligibleQuantity: params.eligibleQuantity, priceSpecification: compoundPriceSpecification }, (typeof params.availability === 'string') ? { availability: params.availability } : { availability }), (typeof params.sortIndex === 'number') ? { sortIndex: params.sortIndex } : undefined), (typeof offerIndex === 'number') ? { offerIndex } : undefined), (typeof (parentOffer === null || parentOffer === void 0 ? void 0 : parentOffer.id) === 'string') ? { parentOffer: { id: parentOffer.id } } : undefined);
|
|
85
85
|
}
|
|
86
86
|
exports.createCompoundPriceSpec4event = createCompoundPriceSpec4event;
|
|
@@ -1,6 +1,12 @@
|
|
|
1
1
|
import * as factory from '../../../factory';
|
|
2
2
|
import { MongoRepository as OfferRepo } from '../../../repo/offer';
|
|
3
3
|
import { MongoRepository as ProductRepo } from '../../../repo/product';
|
|
4
|
+
type ITicketOffer = factory.product.ITicketOffer & {
|
|
5
|
+
offerIndex?: number;
|
|
6
|
+
parentOffer?: {
|
|
7
|
+
id: string;
|
|
8
|
+
};
|
|
9
|
+
};
|
|
4
10
|
/**
|
|
5
11
|
* プロダクトオファーを検索する
|
|
6
12
|
*/
|
|
@@ -23,4 +29,5 @@ export declare function searchProductOffers(params: {
|
|
|
23
29
|
}): (repos: {
|
|
24
30
|
offer: OfferRepo;
|
|
25
31
|
product: ProductRepo;
|
|
26
|
-
}) => Promise<
|
|
32
|
+
}) => Promise<ITicketOffer[]>;
|
|
33
|
+
export {};
|
|
@@ -35,6 +35,7 @@ function searchProductOffers(params) {
|
|
|
35
35
|
useOffersAsPrimaryForcible: params.useOffersAsPrimaryForcible
|
|
36
36
|
});
|
|
37
37
|
return offers.map((o) => {
|
|
38
|
+
var _a;
|
|
38
39
|
let sortIndex;
|
|
39
40
|
if (params.addSortIndex) {
|
|
40
41
|
sortIndex = sortedOfferIds.indexOf(String(o.id));
|
|
@@ -48,7 +49,7 @@ function searchProductOffers(params) {
|
|
|
48
49
|
...(unitSpec !== undefined) ? [unitSpec] : []
|
|
49
50
|
]
|
|
50
51
|
};
|
|
51
|
-
return Object.assign(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: o.itemOffered, name: o.name, priceCurrency: o.priceCurrency, typeOf: o.typeOf, priceSpecification: compoundPriceSpecification }, (o.validFrom instanceof Date) ? { validFrom: o.validFrom } : undefined), (o.validThrough instanceof Date) ? { validThrough: o.validThrough } : undefined), (typeof sortIndex === 'number') ? { sortIndex } : undefined);
|
|
52
|
+
return Object.assign(Object.assign(Object.assign(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: o.itemOffered, name: o.name, priceCurrency: o.priceCurrency, typeOf: o.typeOf, priceSpecification: compoundPriceSpecification }, (o.validFrom instanceof Date) ? { validFrom: o.validFrom } : undefined), (o.validThrough instanceof Date) ? { validThrough: o.validThrough } : undefined), (typeof sortIndex === 'number') ? { sortIndex } : undefined), (typeof o.offerIndex === 'number') ? { offerIndex: o.offerIndex } : undefined), (typeof ((_a = o.parentOffer) === null || _a === void 0 ? void 0 : _a.id) === 'string') ? { parentOffer: { id: o.parentOffer.id } } : undefined);
|
|
52
53
|
});
|
|
53
54
|
});
|
|
54
55
|
}
|
package/package.json
CHANGED