@chevre/domain 20.1.0-alpha.4 → 20.1.0-alpha.6

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.
@@ -1,4 +1,5 @@
1
1
  // tslint:disable:no-console
2
+ import * as moment from 'moment';
2
3
  import * as mongoose from 'mongoose';
3
4
 
4
5
  import { chevre } from '../../../lib/index';
@@ -13,7 +14,14 @@ async function main() {
13
14
  const cursor = eventRepo.getCursor(
14
15
  {
15
16
  'project.id': { $eq: project.id },
16
- typeOf: { $eq: chevre.factory.eventType.ScreeningEvent }
17
+ typeOf: { $eq: chevre.factory.eventType.ScreeningEvent },
18
+ // 'superEvent.location.branchCode': { $eq: '118', $exists: true },
19
+ endDate: {
20
+ $exists: true,
21
+ $lt: moment()
22
+ .add(-1, 'month')
23
+ .toDate()
24
+ }
17
25
  },
18
26
  {
19
27
  // _id: 1,
@@ -89,6 +89,24 @@ schema.index({ 'parentOrganization.id': 1, branchCode: 1 }, {
89
89
  'parentOrganization.id': { $exists: true }
90
90
  }
91
91
  });
92
+ schema.index({ 'containsPlace.branchCode': 1, branchCode: 1 }, {
93
+ name: 'searchByContainsPlaceBranchCode',
94
+ partialFilterExpression: {
95
+ 'containsPlace.branchCode': { $exists: true }
96
+ }
97
+ });
98
+ schema.index({ 'containsPlace.containsPlace.branchCode': 1, branchCode: 1 }, {
99
+ name: 'searchByContainsPlaceContainsPlaceBranchCode',
100
+ partialFilterExpression: {
101
+ 'containsPlace.containsPlace.branchCode': { $exists: true }
102
+ }
103
+ });
104
+ schema.index({ 'containsPlace.containsPlace.containsPlace.branchCode': 1, branchCode: 1 }, {
105
+ name: 'searchByContainsPlaceContainsPlaceContainsPlaceBranchCode',
106
+ partialFilterExpression: {
107
+ 'containsPlace.containsPlace.containsPlace.branchCode': { $exists: true }
108
+ }
109
+ });
92
110
  mongoose.model(modelName, schema)
93
111
  .on('index',
94
112
  // tslint:disable-next-line:no-single-line-block-comment
@@ -63,7 +63,8 @@ function createAcquiredFrom(params) {
63
63
  // 最低限の情報に絞る
64
64
  const seller = params.order.seller;
65
65
  return {
66
- project: { typeOf: params.order.project.typeOf, id: params.order.project.id },
66
+ // 最適化(2022-11-15~)
67
+ // project: { typeOf: params.order.project.typeOf, id: params.order.project.id },
67
68
  id: seller.id,
68
69
  typeOf: seller.typeOf,
69
70
  name: (typeof seller.name === 'string')
@@ -40,12 +40,11 @@ function addOffers2Seat(params) {
40
40
  && categoryCode.inCodeSet.identifier === factory.categoryCode.CategorySetIdentifier.SeatingType;
41
41
  });
42
42
  }));
43
+ // 最適化(2022-11-15~)
43
44
  const priceSpecification = {
44
- // 不要な属性を除外(2022-11-02~)
45
- // project: params.project,
46
45
  typeOf: factory.priceSpecificationType.CompoundPriceSpecification,
47
- priceCurrency: factory.priceCurrency.JPY,
48
- valueAddedTaxIncluded: true,
46
+ // priceCurrency: factory.priceCurrency.JPY,
47
+ // valueAddedTaxIncluded: true,
49
48
  priceComponent: priceComponent
50
49
  };
51
50
  let availability = (unavailableOffer !== undefined)
@@ -55,9 +54,10 @@ function addOffers2Seat(params) {
55
54
  availability = params.availability;
56
55
  }
57
56
  return Object.assign(Object.assign({}, params.seat), { offers: [{
58
- project: params.project,
57
+ // 最適化(2022-11-15~)
58
+ // project: params.project,
59
59
  typeOf: factory.offerType.Offer,
60
- priceCurrency: factory.priceCurrency.JPY,
60
+ // priceCurrency: factory.priceCurrency.JPY,
61
61
  availability: availability,
62
62
  priceSpecification: priceSpecification
63
63
  }] });
@@ -42,7 +42,8 @@ function getOrderWithToken(params) {
42
42
  };
43
43
  const seller4orderToken = {
44
44
  id: params.order.seller.id,
45
- project: params.order.seller.project,
45
+ // 最適化(2022-11-15~)
46
+ // project: params.order.seller.project,
46
47
  typeOf: params.order.seller.typeOf
47
48
  };
48
49
  const order4token = {
@@ -120,9 +120,6 @@ function createStartPlaceOrderInProgressParams(params) {
120
120
  id: customer.id,
121
121
  identifier: customer.identifier,
122
122
  memberOf: customer.memberOf
123
- // ↓不要なので廃止(2022-05-26~)
124
- // paramsにadditionalPropertyの指定があれば反映する
125
- // ...(Array.isArray(params.agent.additionalProperty)) ? { additionalProperty: params.agent.additionalProperty } : []
126
123
  };
127
124
  return {
128
125
  project: { typeOf: factory.organizationType.Project, id: params.project.id },
@@ -19,12 +19,12 @@ function createSendEmailMessageActions(params) {
19
19
  // 注文配送メール送信設定
20
20
  const sendEmailMessageActions = [];
21
21
  const project = params.transaction.project;
22
+ const maskedCustomer = (0, order_1.createMaskedCustomer)(params.order);
22
23
  const sendActionPurpose = {
23
- // project: params.order.project,
24
24
  typeOf: params.order.typeOf,
25
25
  seller: params.order.seller,
26
26
  // mask
27
- customer: (0, order_1.createMaskedCustomer)(params.order),
27
+ customer: { typeOf: maskedCustomer.typeOf, id: maskedCustomer.id, name: maskedCustomer.name },
28
28
  confirmationNumber: params.order.confirmationNumber,
29
29
  orderNumber: params.order.orderNumber,
30
30
  price: params.order.price,
@@ -34,13 +34,11 @@ function createSeller(params) {
34
34
  var _a;
35
35
  const seller = params.transaction.seller;
36
36
  return {
37
- project: { typeOf: params.transaction.project.typeOf, id: params.transaction.project.id },
37
+ // 最適化(2022-11-15~)
38
+ // project: { typeOf: params.transaction.project.typeOf, id: params.transaction.project.id },
38
39
  id: seller.id,
39
40
  name: (typeof seller.name === 'string') ? seller.name : String((_a = seller.name) === null || _a === void 0 ? void 0 : _a.ja),
40
41
  typeOf: seller.typeOf
41
- // ↓最適化(2022-05-20~)
42
- // ...(typeof seller.telephone === 'string') ? { telephone: seller.telephone } : undefined,
43
- // ...(typeof seller.url === 'string') ? { url: seller.url } : undefined
44
42
  };
45
43
  }
46
44
  function createCustomer(params) {
@@ -17,12 +17,12 @@ function createReturnMoneyTransferActions(params) {
17
17
  return __awaiter(this, void 0, void 0, function* () {
18
18
  const order = params.order;
19
19
  const returnMoneyTransferActions = [];
20
+ const maskedCustomer = (0, order_1.createMaskedCustomer)(order);
20
21
  const purpose = {
21
- // project: order.project,
22
22
  typeOf: order.typeOf,
23
23
  seller: order.seller,
24
24
  // mask
25
- customer: (0, order_1.createMaskedCustomer)(order),
25
+ customer: { typeOf: maskedCustomer.typeOf, id: maskedCustomer.id, name: maskedCustomer.name },
26
26
  confirmationNumber: order.confirmationNumber,
27
27
  orderNumber: order.orderNumber,
28
28
  price: order.price,
@@ -62,11 +62,9 @@ function createReturnMoneyTransferActions(params) {
62
62
  },
63
63
  agent: order.project,
64
64
  recipient: {
65
- // project: { typeOf: transaction.project.typeOf, id: transaction.project.id },
66
65
  typeOf: order.seller.typeOf,
67
66
  id: order.seller.id,
68
67
  name: order.seller.name
69
- // url: order.seller.url
70
68
  },
71
69
  potentialActions: {},
72
70
  purpose,
@@ -47,14 +47,13 @@ function createReturnPointAwardActions(params) {
47
47
  console.error('JSON.parse(awardAccountsStr) throws', error);
48
48
  }
49
49
  }
50
- // const transaction = params.transaction;
51
50
  const order = params.order;
51
+ const maskedCustomer = (0, order_1.createMaskedCustomer)(order);
52
52
  const purpose = {
53
- // project: order.project,
54
53
  typeOf: order.typeOf,
55
54
  seller: order.seller,
56
55
  // mask
57
- customer: (0, order_1.createMaskedCustomer)(order),
56
+ customer: { typeOf: maskedCustomer.typeOf, id: maskedCustomer.id, name: maskedCustomer.name },
58
57
  confirmationNumber: order.confirmationNumber,
59
58
  orderNumber: order.orderNumber,
60
59
  price: order.price,
@@ -62,11 +61,9 @@ function createReturnPointAwardActions(params) {
62
61
  orderDate: order.orderDate
63
62
  };
64
63
  const recipient = {
65
- // project: { typeOf: transaction.project.typeOf, id: transaction.project.id },
66
64
  typeOf: order.seller.typeOf,
67
65
  id: order.seller.id,
68
66
  name: order.seller.name
69
- // url: order.seller.url
70
67
  };
71
68
  // ポイントインセンティブの数だけ、返却アクションを作成
72
69
  returnPointAwardActions.push(...pointAwardIdentifiers.map((pointAwardIdentifier) => {
@@ -53,26 +53,13 @@ function updateAgent(params) {
53
53
  const newAgent = {
54
54
  typeOf: transaction.agent.typeOf,
55
55
  id: transaction.agent.id
56
- // 不要なので廃止(2022-05-26~)
57
- // ...(Array.isArray(params.agent.additionalProperty)) ? { additionalProperty: params.agent.additionalProperty } : {},
58
- // ...(typeof params.agent.age === 'string') ? { age: params.agent.age } : {},
59
- // ...(typeof params.agent.address === 'string') ? { address: params.agent.address } : {},
60
- // ...(typeof params.agent.email === 'string') ? { email: params.agent.email } : {},
61
- // ...(typeof params.agent.familyName === 'string') ? { familyName: params.agent.familyName } : {},
62
- // ...(typeof params.agent.gender === 'string') ? { gender: params.agent.gender } : {},
63
- // ...(typeof params.agent.givenName === 'string') ? { givenName: params.agent.givenName } : {},
64
- // ...(typeof params.agent.name === 'string') ? { name: params.agent.name } : {},
65
- // ...(typeof formattedTelephone === 'string') ? { telephone: formattedTelephone } : {},
66
- // ...(typeof params.agent.url === 'string') ? { url: params.agent.url } : {}
67
56
  };
68
57
  // 注文取引の場合、object.customerにも適用
69
58
  let customer;
70
59
  if (transaction.typeOf === factory.transactionType.PlaceOrder) {
71
60
  // いったんtransaction.object.customer?.typeOfは取引開始時にセットされている前提
72
61
  if (typeof ((_a = transaction.object.customer) === null || _a === void 0 ? void 0 : _a.typeOf) === 'string') {
73
- customer = Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({ typeOf: transaction.object.customer.typeOf, id: transaction.object.customer.id }, (transaction.object.customer.typeOf === factory.organizationType.Organization)
74
- ? { project: transaction.object.customer.project }
75
- : undefined), (Array.isArray(transaction.object.customer.identifier))
62
+ customer = Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({ typeOf: transaction.object.customer.typeOf, id: transaction.object.customer.id }, (Array.isArray(transaction.object.customer.identifier))
76
63
  ? { identifier: transaction.object.customer.identifier }
77
64
  : undefined), (transaction.object.customer.typeOf === factory.personType.Person
78
65
  && typeof ((_b = transaction.object.customer.memberOf) === null || _b === void 0 ? void 0 : _b.typeOf) === 'string')
package/package.json CHANGED
@@ -9,8 +9,8 @@
9
9
  }
10
10
  ],
11
11
  "dependencies": {
12
- "@chevre/factory": "4.277.0-alpha.0",
13
- "@cinerino/sdk": "3.132.0",
12
+ "@chevre/factory": "4.277.0",
13
+ "@cinerino/sdk": "3.132.1",
14
14
  "@motionpicture/coa-service": "9.2.0",
15
15
  "@motionpicture/gmo-service": "5.2.0",
16
16
  "@sendgrid/mail": "6.4.0",
@@ -120,5 +120,5 @@
120
120
  "postversion": "git push origin --tags",
121
121
  "prepublishOnly": "npm run clean && npm run build && npm test && npm run doc"
122
122
  },
123
- "version": "20.1.0-alpha.4"
123
+ "version": "20.1.0-alpha.6"
124
124
  }