@chevre/domain 21.8.0-alpha.40 → 21.8.0-alpha.41

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.
@@ -5,24 +5,24 @@ import * as mongoose from 'mongoose';
5
5
  import { chevre } from '../../../lib/index';
6
6
 
7
7
  async function main() {
8
- await mongoose.connect(<string>process.env.MONGOLAB_URI, { autoIndex: false });
8
+ await mongoose.connect(<string>process.env.MONGOLAB_URI);
9
9
 
10
10
  const offerRepo = new chevre.repository.Offer(mongoose.connection);
11
11
 
12
12
  const { offers } = await offerRepo.findOffersByOfferCatalogId({
13
13
  limit: 100,
14
14
  page: 1,
15
- // ids: ['aldzf0vrk', 'xxx', '1001'],
15
+ // ids: ['al96nqj7z', 'xxx', '1001'],
16
16
  // ids: ['xx', 'xxx'],
17
17
  offerCatalog: {
18
- id: 'bllroybre'
18
+ id: '0001'
19
19
  // id: 'xxx'
20
20
  },
21
21
  excludeAppliesToMovieTicket: false
22
+ // useOffersAsPrimary: true
22
23
  });
23
- // console.log(offers);
24
24
  console.log(offers.map((offer) => {
25
- return `${offer.project?.id} ${offer.identifier} ${offer.priceSpecification?.price} ${offer.name?.ja} ${offer.id}`;
25
+ return `${offer.project?.id} ${offer.identifier} ${offer.priceSpecification?.price} ${offer.name?.ja} ${offer.id} ${(<any>offer).offerIndex}`;
26
26
  }));
27
27
  console.log(offers.length);
28
28
  console.log('USE_AGGREGATE_OFFERS_AS_PRIMARY:', process.env.USE_AGGREGATE_OFFERS_AS_PRIMARY);
@@ -65,6 +65,10 @@ export declare class MongoRepository {
65
65
  limit?: number;
66
66
  page?: number;
67
67
  projection?: IProjection;
68
+ /**
69
+ * 強制的にoffersコレクションを使用する
70
+ */
71
+ useOffersAsPrimary?: boolean;
68
72
  }): Promise<{
69
73
  offers: factory.unitPriceOffer.IUnitPriceOffer[];
70
74
  sortedOfferIds: string[];
@@ -834,7 +834,10 @@ class MongoRepository {
834
834
  ? { sort: { identifier: factory.sortType.Ascending } }
835
835
  : undefined), (typeof params.limit === 'number') ? { limit: params.limit } : undefined), (typeof params.page === 'number') ? { page: params.page } : undefined);
836
836
  // USE_AGGREGATE_OFFERS_AS_PRIMARY_ON_SEARCH_BY_CATALOG対応(2023-09-06~)
837
- offers = yield this.search(searchOffersConditions, params.projection, settings_1.USE_AGGREGATE_OFFERS_AS_PRIMARY_ON_SEARCH_BY_CATALOG);
837
+ const useOffersAsPrimary = (params.useOffersAsPrimary === true)
838
+ ? true
839
+ : !settings_1.USE_AGGREGATE_OFFERS_AS_PRIMARY_ON_SEARCH_BY_CATALOG;
840
+ offers = yield this.search(searchOffersConditions, params.projection, useOffersAsPrimary);
838
841
  // 完全廃止(基本的にsortedOfferIdsと合わせて利用する想定)(2023-09-04~)
839
842
  // if (params.sort) {
840
843
  // // sorting
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.8.0-alpha.40"
120
+ "version": "21.8.0-alpha.41"
121
121
  }