@chevre/domain 21.9.0-alpha.8 → 21.9.0-alpha.9

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.
@@ -28,6 +28,7 @@ async function main() {
28
28
  const { ticketOffers } = await chevre.service.offer.event.searchEventTicketOffers({
29
29
  event: { id: 'ale6qiedq' },
30
30
  onlyValid: true,
31
+ priceSpecification: {},
31
32
  validateOfferRateLimit: true,
32
33
  addSortIndex: true,
33
34
  useIncludeInDataCatalog: true,
@@ -14,11 +14,17 @@ async function main() {
14
14
  page: 1,
15
15
  // ids: ['xx', 'xxx', '1001', '901'],
16
16
  subOfferCatalog: {
17
- id: 'xxx',
18
- isOfferCatalogItem: true
17
+ id: '0001',
18
+ isOfferCatalogItem: false
19
19
  },
20
20
  excludeAppliesToMovieTicket: false,
21
- useIncludeInDataCatalog: false
21
+ useIncludeInDataCatalog: false,
22
+ priceSpecification: {
23
+ // appliesToMovieTicket: {
24
+ // serviceOutput: { typeOf: { $eq: 'SurfRock' } },
25
+ // serviceType: { $exists: true }
26
+ // }
27
+ }
22
28
  });
23
29
  // console.log(offers);
24
30
  console.log(offers.map((offer) => {
@@ -84,6 +84,10 @@ export declare class MongoRepository {
84
84
  };
85
85
  unacceptedPaymentMethod?: string[];
86
86
  excludeAppliesToMovieTicket: boolean;
87
+ /**
88
+ * 適用決済カード条件
89
+ */
90
+ priceSpecification: Pick<factory.unitPriceOffer.IPriceSpecificationSearchConditions, 'appliesToMovieTicket'>;
87
91
  onlyValid?: boolean;
88
92
  useIncludeInDataCatalog: boolean;
89
93
  limit?: number;
@@ -507,7 +507,7 @@ class MongoRepository {
507
507
  * カタログ内ソートインデックスはsortedOfferIdsで判断する
508
508
  */
509
509
  searchByOfferCatalogIdWithSortIndex(params) {
510
- var _a;
510
+ var _a, _b, _c, _d, _e, _f, _g, _h;
511
511
  return __awaiter(this, void 0, void 0, function* () {
512
512
  const sortedOfferIds = yield this.searchAggregateOfferIdsBySubOfferCatalog({
513
513
  id: params.subOfferCatalog.id,
@@ -515,23 +515,30 @@ class MongoRepository {
515
515
  });
516
516
  let offers = [];
517
517
  if (sortedOfferIds.length > 0) {
518
- const searchOffersConditions = Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, (params.useIncludeInDataCatalog)
518
+ const appliesToMovieTicketServiceOutputTypeOfEq = (_d = (_c = (_b = (_a = params.priceSpecification) === null || _a === void 0 ? void 0 : _a.appliesToMovieTicket) === null || _b === void 0 ? void 0 : _b.serviceOutput) === null || _c === void 0 ? void 0 : _c.typeOf) === null || _d === void 0 ? void 0 : _d.$eq;
519
+ const appliesToMovieTicketServiceTypeExists = (_g = (_f = (_e = params.priceSpecification) === null || _e === void 0 ? void 0 : _e.appliesToMovieTicket) === null || _f === void 0 ? void 0 : _f.serviceType) === null || _g === void 0 ? void 0 : _g.$exists;
520
+ // 適用決済カード条件なしのみを検索するかどうか
521
+ const onlyNoAppliesToMovieTicket = params.excludeAppliesToMovieTicket || (appliesToMovieTicketServiceTypeExists === false);
522
+ const onlyAppliesToMovieTicket = !params.excludeAppliesToMovieTicket && (appliesToMovieTicketServiceTypeExists === true);
523
+ const priceSpecificationConditions = {
524
+ appliesToMovieTicket: Object.assign(Object.assign({ serviceOutput: {
525
+ typeOf: Object.assign(Object.assign({}, (Array.isArray(params.unacceptedPaymentMethod) && params.unacceptedPaymentMethod.length > 0)
526
+ // 利用不可決済方法区分条件を追加(2023-02-21~)
527
+ ? { $nin: params.unacceptedPaymentMethod }
528
+ : undefined), (typeof appliesToMovieTicketServiceOutputTypeOfEq === 'string')
529
+ ? { $eq: appliesToMovieTicketServiceOutputTypeOfEq }
530
+ : undefined)
531
+ } }, (onlyNoAppliesToMovieTicket)
532
+ ? { serviceType: { $exists: false } }
533
+ : undefined), (onlyAppliesToMovieTicket)
534
+ ? { serviceType: { $exists: true } }
535
+ : undefined)
536
+ };
537
+ const searchOffersConditions = Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({ priceSpecification: priceSpecificationConditions, onlyValid: params.onlyValid === true }, (params.useIncludeInDataCatalog)
519
538
  ? { includedInDataCatalog: { id: { $in: [params.subOfferCatalog.id] } } }
520
- : { parentOffer: { id: { $in: sortedOfferIds } } }), (typeof ((_a = params.availableAtOrFrom) === null || _a === void 0 ? void 0 : _a.id) === 'string')
539
+ : { parentOffer: { id: { $in: sortedOfferIds } } }), (typeof ((_h = params.availableAtOrFrom) === null || _h === void 0 ? void 0 : _h.id) === 'string')
521
540
  ? { availableAtOrFrom: { id: { $eq: params.availableAtOrFrom.id } } } // store.idでのフィルターをmongoで処理(2023-01-27~)
522
- : undefined), { priceSpecification: {
523
- appliesToMovieTicket: Object.assign(Object.assign({}, (Array.isArray(params.unacceptedPaymentMethod) && params.unacceptedPaymentMethod.length > 0)
524
- ? {
525
- serviceOutput: {
526
- typeOf: { $nin: params.unacceptedPaymentMethod }
527
- }
528
- }
529
- : undefined), (params.excludeAppliesToMovieTicket)
530
- ? {
531
- serviceType: { $exists: false }
532
- }
533
- : undefined)
534
- }, onlyValid: params.onlyValid === true }), (typeof params.limit === 'number' && typeof params.page === 'number')
541
+ : undefined), (typeof params.limit === 'number' && typeof params.page === 'number')
535
542
  // 明示的なソート指定を調整(決して重複しない属性が相応)(2023-09-07~)
536
543
  ? { sort: { identifier: factory.sortType.Ascending } }
537
544
  : undefined), (typeof params.limit === 'number') ? { limit: params.limit } : undefined), (typeof params.page === 'number') ? { page: params.page } : undefined);
@@ -82,9 +82,6 @@ export declare class MongoRepository {
82
82
  };
83
83
  }): Promise<import("mongodb").UpdateResult | undefined>;
84
84
  search(params: factory.offerCatalog.ISearchConditions): Promise<IAggregatedOfferCatalog[]>;
85
- /**
86
- * 強制的に親カタログのみ検索する
87
- */
88
85
  findItemListElementById(params: {
89
86
  id: string;
90
87
  project: {
@@ -282,20 +282,6 @@ class MongoRepository {
282
282
  return aggregate.exec();
283
283
  });
284
284
  }
285
- /**
286
- * 強制的に親カタログのみ検索する
287
- */
288
- // public async searchParentCatalogsForcibly(
289
- // params: factory.offerCatalog.ISearchConditions
290
- // ): Promise<IAggregatedOfferCatalog[]> {
291
- // return this.search({
292
- // ...params,
293
- // itemListElement: {
294
- // ...params.itemListElement,
295
- // typeOf: { $eq: factory.offerType.Offer }
296
- // }
297
- // });
298
- // }
299
285
  findItemListElementById(params) {
300
286
  return __awaiter(this, void 0, void 0, function* () {
301
287
  const doc = yield this.offerCatalogModel.findOne({
@@ -118,6 +118,7 @@ function addReservations(params) {
118
118
  event: { id: event.id },
119
119
  // 対応アプリケーション条件追加(2023-01-27~)
120
120
  store: { id: (_a = params.availableAtOrFrom) === null || _a === void 0 ? void 0 : _a.id },
121
+ priceSpecification: {},
121
122
  onlyValid: true,
122
123
  addSortIndex: false,
123
124
  validateOfferRateLimit: true,
@@ -237,6 +237,7 @@ function validateAcceptedOffers(params) {
237
237
  ids: offerIds,
238
238
  event: { id: params.event.id },
239
239
  store: params.store,
240
+ priceSpecification: {},
240
241
  onlyValid: true,
241
242
  addSortIndex: false,
242
243
  validateOfferRateLimit: true,
@@ -39,12 +39,7 @@ declare function searchEventTicketOffers(params: {
39
39
  * 有効期間内のみかどうか
40
40
  */
41
41
  onlyValid: boolean;
42
- /**
43
- * どの決済方法に対して
44
- */
45
- /**
46
- * COAムビチケ券種もほしい場合に指定
47
- */
42
+ priceSpecification: Pick<factory.unitPriceOffer.IPriceSpecificationSearchConditions, 'appliesToMovieTicket'>;
48
43
  limit?: number;
49
44
  page?: number;
50
45
  addSortIndex: boolean;
@@ -45,6 +45,7 @@ function searchTicketOffersByItemOffered(params) {
45
45
  availableAtOrFrom: { id: (_d = params.store) === null || _d === void 0 ? void 0 : _d.id },
46
46
  unacceptedPaymentMethod: params.unacceptedPaymentMethod,
47
47
  excludeAppliesToMovieTicket: params.excludeAppliesToMovieTicket,
48
+ priceSpecification: params.priceSpecification,
48
49
  onlyValid: params.onlyValid === true,
49
50
  useIncludeInDataCatalog: params.useIncludeInDataCatalog,
50
51
  limit: params.limit,
@@ -115,6 +116,7 @@ function searchEventTicketOffersByEvent(params) {
115
116
  onlyValid: params.onlyValid,
116
117
  unacceptedPaymentMethod,
117
118
  excludeAppliesToMovieTicket,
119
+ priceSpecification: params.priceSpecification,
118
120
  withSortIndex: params.addSortIndex,
119
121
  useIncludeInDataCatalog: params.useIncludeInDataCatalog
120
122
  })(repos);
@@ -276,6 +278,7 @@ function searchEventTicketOffers(params) {
276
278
  ids: params.ids,
277
279
  event,
278
280
  store: params.store,
281
+ priceSpecification: params.priceSpecification,
279
282
  limit: params.limit,
280
283
  page: params.page,
281
284
  addSortIndex: params.addSortIndex,
@@ -44,6 +44,7 @@ function searchProductOffers(params) {
44
44
  // ids: params.ids,
45
45
  subOfferCatalog: { id: subOfferCatalogId, isOfferCatalogItem },
46
46
  excludeAppliesToMovieTicket: false,
47
+ priceSpecification: {},
47
48
  limit: params.limit,
48
49
  page: params.page,
49
50
  onlyValid: params.onlyValid === true,
package/package.json CHANGED
@@ -117,5 +117,5 @@
117
117
  "postversion": "git push origin --tags",
118
118
  "prepublishOnly": "npm run clean && npm run build && npm test && npm run doc"
119
119
  },
120
- "version": "21.9.0-alpha.8"
120
+ "version": "21.9.0-alpha.9"
121
121
  }