@chevre/domain 21.22.0-alpha.2 → 21.22.0

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.
@@ -8,6 +8,8 @@ enum ROLE_NAME {
8
8
  Customer = 'customer',
9
9
  POS = 'pos'
10
10
  }
11
+ const CLIENT_ID = '5glmsqlnlmbri3bgruddoe78lb';
12
+ const CUSTOMER_TYPE = 'POS';
11
13
 
12
14
  // tslint:disable-next-line:max-func-body-length
13
15
  async function main() {
@@ -18,8 +20,8 @@ async function main() {
18
20
 
19
21
  const cursor = memberRepo.getCursor(
20
22
  {
21
- 'member.hasRole.roleName': { $in: [ROLE_NAME.Customer, ROLE_NAME.POS] }
22
- // 'member.id': { $eq: '3eo6okferrsdpfd9j2ce1iv9k7' }
23
+ 'member.hasRole.roleName': { $in: [ROLE_NAME.Customer, ROLE_NAME.POS] },
24
+ 'member.id': { $eq: CLIENT_ID }
23
25
  },
24
26
  {
25
27
  // _id: 1,
@@ -37,7 +39,10 @@ async function main() {
37
39
  offeredBy: { id: { $eq: iamMember.project.id } },
38
40
  availableAtOrFrom: { id: { $eq: iamMember.member.id } }
39
41
  });
40
- const alreadyMigrated = existingOffers.length === 1;
42
+ const alreadyMigrated = existingOffers.length === 1
43
+ && Array.isArray(existingOffers[0].eligibleCustomerType)
44
+ && existingOffers[0].eligibleCustomerType.length === 1
45
+ && existingOffers[0].eligibleCustomerType[0].codeValue === CUSTOMER_TYPE;
41
46
 
42
47
  if (alreadyMigrated) {
43
48
  console.log(
@@ -46,8 +51,11 @@ async function main() {
46
51
  console.log(
47
52
  'updating project...',
48
53
  iamMember.project.id, iamMember.member.id, iamMember.member.typeOf, iamMember.member.name, i);
49
- await makesOfferRepo.create({
54
+ await makesOfferRepo.updateOne({
50
55
  availableAtOrFrom: { id: iamMember.member.id },
56
+ eligibleCustomerType: [{
57
+ codeValue: CUSTOMER_TYPE
58
+ }],
51
59
  offeredBy: { id: iamMember.project.id }
52
60
  });
53
61
  updateCount += 1;
@@ -15,11 +15,10 @@ async function main() {
15
15
  limit: 10,
16
16
  page: 1,
17
17
  subOfferCatalog: {
18
- id: '0001',
19
- isOfferCatalogItem: false
18
+ id: '0001'
19
+ // isOfferCatalogItem: false
20
20
  },
21
21
  excludeAppliesToMovieTicket: false,
22
- useIncludeInDataCatalog: true,
23
22
  unacceptedPaymentMethod: []
24
23
  });
25
24
  console.log(result);
@@ -28,7 +27,6 @@ async function main() {
28
27
  result = await (await chevre.service.offer.createService()).event.searchOfferAppliesToMovieTicket({
29
28
  event: { id: 'cllkq475p' },
30
29
  onlyValid: true,
31
- useIncludeInDataCatalog: true,
32
30
  limit: 100,
33
31
  page: 1
34
32
  // ...(typeof availableAtId === 'string') ? { store: { id: availableAtId } } : undefined
@@ -146,14 +146,12 @@ export declare class MongoRepository {
146
146
  * サブカタログID
147
147
  */
148
148
  id: string;
149
- isOfferCatalogItem: boolean;
150
149
  };
151
150
  availableAtOrFrom?: {
152
151
  id?: string;
153
152
  };
154
153
  unacceptedPaymentMethod?: string[];
155
154
  excludeAppliesToMovieTicket: boolean;
156
- useIncludeInDataCatalog: boolean;
157
155
  onlyValid?: boolean;
158
156
  limit?: number;
159
157
  page?: number;
@@ -622,17 +622,19 @@ class MongoRepository {
622
622
  searchAvaialbleAppliesToMovieTicketByOfferCatalogId(params) {
623
623
  var _a;
624
624
  return __awaiter(this, void 0, void 0, function* () {
625
- let sortedOfferIds = [];
626
- if (!params.useIncludeInDataCatalog) {
627
- // useIncludeInDataCatalogでない場合のみ集計オファーIDリストを検索する
628
- sortedOfferIds = yield this.searchAggregateOfferIdsBySubOfferCatalog({
629
- id: params.subOfferCatalog.id,
630
- isOfferCatalogItem: params.subOfferCatalog.isOfferCatalogItem
631
- });
632
- }
633
- const searchOffersConditions = Object.assign(Object.assign(Object.assign({}, (params.useIncludeInDataCatalog)
634
- ? { includedInDataCatalog: { id: { $in: [params.subOfferCatalog.id] } } }
635
- : { parentOffer: { id: { $in: sortedOfferIds } } }), (typeof ((_a = params.availableAtOrFrom) === null || _a === void 0 ? void 0 : _a.id) === 'string')
625
+ // let sortedOfferIds: string[] = [];
626
+ // if (!params.useIncludeInDataCatalog) {
627
+ // // useIncludeInDataCatalogでない場合のみ集計オファーIDリストを検索する
628
+ // sortedOfferIds = await this.searchAggregateOfferIdsBySubOfferCatalog({
629
+ // id: params.subOfferCatalog.id,
630
+ // isOfferCatalogItem: params.subOfferCatalog.isOfferCatalogItem
631
+ // });
632
+ // }
633
+ const searchOffersConditions = Object.assign(Object.assign({
634
+ // ...(params.useIncludeInDataCatalog)
635
+ // ? { includedInDataCatalog: { id: { $in: [params.subOfferCatalog.id] } } }
636
+ // : { parentOffer: { id: { $in: sortedOfferIds } } },
637
+ includedInDataCatalog: { id: { $in: [params.subOfferCatalog.id] } } }, (typeof ((_a = params.availableAtOrFrom) === null || _a === void 0 ? void 0 : _a.id) === 'string')
636
638
  ? { availableAtOrFrom: { id: { $eq: params.availableAtOrFrom.id } } }
637
639
  : undefined), { priceSpecification: {
638
640
  appliesToMovieTicket: Object.assign({
@@ -76,7 +76,6 @@ declare function searchOfferAppliesToMovieTicket(params: {
76
76
  * 有効なオファーのみ対象とするか
77
77
  */
78
78
  onlyValid?: boolean;
79
- useIncludeInDataCatalog: boolean;
80
79
  }): (repos: {
81
80
  event: EventRepo;
82
81
  offer: OfferRepo;
@@ -397,19 +397,20 @@ function searchOfferAppliesToMovieTicket(params) {
397
397
  }
398
398
  // サブカタログIDを決定
399
399
  let subOfferCatalogId = catalogId;
400
- let isOfferCatalogItem = false;
400
+ // let isOfferCatalogItem: boolean = false;
401
401
  const offerCatalogFirstElement = yield repos.offerCatalog.findFirstItemListElementById({ id: catalogId });
402
402
  if (offerCatalogFirstElement.typeOf === 'OfferCatalog') {
403
403
  subOfferCatalogId = offerCatalogFirstElement.id;
404
- isOfferCatalogItem = true;
404
+ // isOfferCatalogItem = true;
405
405
  }
406
406
  return repos.offer.searchAvaialbleAppliesToMovieTicketByOfferCatalogId({
407
- subOfferCatalog: { id: subOfferCatalogId, isOfferCatalogItem },
407
+ // subOfferCatalog: { id: subOfferCatalogId, isOfferCatalogItem },
408
+ subOfferCatalog: { id: subOfferCatalogId },
408
409
  availableAtOrFrom: { id: (_c = params.store) === null || _c === void 0 ? void 0 : _c.id },
409
410
  unacceptedPaymentMethod: unacceptedPaymentMethod,
410
411
  excludeAppliesToMovieTicket: excludeAppliesToMovieTicket,
411
412
  onlyValid: params.onlyValid === true,
412
- useIncludeInDataCatalog: params.useIncludeInDataCatalog,
413
+ // useIncludeInDataCatalog: params.useIncludeInDataCatalog,
413
414
  limit: params.limit,
414
415
  page: params.page
415
416
  });
package/package.json CHANGED
@@ -110,5 +110,5 @@
110
110
  "postversion": "git push origin --tags",
111
111
  "prepublishOnly": "npm run clean && npm run build && npm test && npm run doc"
112
112
  },
113
- "version": "21.22.0-alpha.2"
113
+ "version": "21.22.0"
114
114
  }