@chevre/domain 21.2.0-alpha.80 → 21.2.0-alpha.81

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.
@@ -13,6 +13,16 @@ async function main() {
13
13
  hasMerchantReturnPolicy: { itemCondition: { id: { $eq: '646dc7848b3c1437d43dbfeb' } } }
14
14
  });
15
15
  console.log('sellers:', sellers);
16
+
17
+ const assetTransactionRepo = new chevre.repository.AssetTransaction(mongoose.connection);
18
+ const reserveTransactions = await assetTransactionRepo.search({
19
+ limit: 1,
20
+ typeOf: chevre.factory.assetTransactionType.Reserve,
21
+ object: {
22
+ reservationFor: { id: { $eq: 'xxx' } }
23
+ }
24
+ });
25
+ console.log('reserveTransactions:', reserveTransactions);
16
26
  }
17
27
 
18
28
  main()
@@ -75,7 +75,7 @@ export declare class MongoRepository {
75
75
  confirm<T extends factory.assetTransactionType>(params: {
76
76
  typeOf: T;
77
77
  id: string;
78
- object?: Pick<factory.action.reserve.IReservationPackageAsObject, 'underName'>;
78
+ object?: Pick<factory.assetTransaction.reserve.IObject, 'underName'>;
79
79
  result: factory.assetTransaction.IResult<T>;
80
80
  potentialActions: factory.assetTransaction.IPotentialActions<T>;
81
81
  }): Promise<void>;
@@ -327,14 +327,14 @@ class MongoRepository {
327
327
  * 取引を確定する
328
328
  */
329
329
  confirm(params) {
330
- var _a, _b, _c;
330
+ var _a, _b;
331
331
  return __awaiter(this, void 0, void 0, function* () {
332
332
  const doc = yield this.transactionModel.findOneAndUpdate({
333
333
  _id: { $eq: params.id },
334
334
  typeOf: { $eq: params.typeOf },
335
335
  status: { $eq: factory.transactionStatusType.InProgress }
336
336
  }, Object.assign({ status: factory.transactionStatusType.Confirmed, endDate: new Date(), result: params.result, potentialActions: params.potentialActions }, (typeof ((_b = (_a = params.object) === null || _a === void 0 ? void 0 : _a.underName) === null || _b === void 0 ? void 0 : _b.typeOf) === 'string')
337
- ? { 'object.underName': (_c = params.object) === null || _c === void 0 ? void 0 : _c.underName }
337
+ ? { 'object.underName': params.object.underName }
338
338
  : undefined), {
339
339
  new: true,
340
340
  projection: { _id: 1 }
@@ -135,6 +135,18 @@ schema.index({ 'object.reservationNumber': 1, startDate: -1 }, {
135
135
  'object.reservationNumber': { $exists: true }
136
136
  }
137
137
  });
138
+ schema.index({ 'object.reservations.id': 1, startDate: -1 }, {
139
+ name: 'searchByObjectReservationsId',
140
+ partialFilterExpression: { 'object.reservations.id': { $exists: true } }
141
+ });
142
+ schema.index({ 'object.reservations.reservationNumber': 1, startDate: -1 }, {
143
+ name: 'searchByObjectReservationsReservationNumber',
144
+ partialFilterExpression: { 'object.reservations.reservationNumber': { $exists: true } }
145
+ });
146
+ schema.index({ 'object.reservations.reservationFor.id': 1, startDate: -1 }, {
147
+ name: 'searchByObjectReservationsReservationForId',
148
+ partialFilterExpression: { 'object.reservations.reservationFor.id': { $exists: true } }
149
+ });
138
150
  schema.index({ 'object.membershipNumber': 1, startDate: -1 }, {
139
151
  name: 'searchByObjectMembershipNumber',
140
152
  partialFilterExpression: {
@@ -63,9 +63,9 @@ declare const schema: Schema<any, import("mongoose").Model<any, any, any, any, a
63
63
  reservationFor?: any;
64
64
  subReservation?: any;
65
65
  broker?: any;
66
+ underName?: any;
66
67
  price?: any;
67
68
  priceCurrency?: string | undefined;
68
- underName?: any;
69
69
  issuedThrough?: any;
70
70
  reservedTicket?: any;
71
71
  additionalTicketText?: string | undefined;
@@ -91,9 +91,9 @@ declare const schema: Schema<any, import("mongoose").Model<any, any, any, any, a
91
91
  reservationFor?: any;
92
92
  subReservation?: any;
93
93
  broker?: any;
94
+ underName?: any;
94
95
  price?: any;
95
96
  priceCurrency?: string | undefined;
96
- underName?: any;
97
97
  issuedThrough?: any;
98
98
  reservedTicket?: any;
99
99
  additionalTicketText?: string | undefined;
@@ -119,9 +119,9 @@ declare const schema: Schema<any, import("mongoose").Model<any, any, any, any, a
119
119
  reservationFor?: any;
120
120
  subReservation?: any;
121
121
  broker?: any;
122
+ underName?: any;
122
123
  price?: any;
123
124
  priceCurrency?: string | undefined;
124
- underName?: any;
125
125
  issuedThrough?: any;
126
126
  reservedTicket?: any;
127
127
  additionalTicketText?: string | undefined;
@@ -75,6 +75,7 @@ export declare function createPotentialActions(params: factory.assetTransaction.
75
75
  }): {
76
76
  potentialActions: factory.assetTransaction.reserve.IPotentialActions;
77
77
  reservationPackage?: factory.action.reserve.IReservationPackageAsObject;
78
+ underName?: factory.reservation.IUnderName<factory.reservationType.EventReservation>;
78
79
  };
79
80
  export declare function createPendingReservationAction(params: {
80
81
  transaction: factory.assetTransaction.ITransaction<factory.assetTransactionType.Reserve>;
@@ -449,9 +449,9 @@ function createPotentialActions(params) {
449
449
  const pendingReservations = (Array.isArray(transaction.object.subReservation)) ? transaction.object.subReservation : [];
450
450
  let reserveActionAttributes = [];
451
451
  let reservationPackage;
452
+ let underName;
452
453
  if (pendingReservations.length > 0) {
453
454
  // ReservationPackageに対応(2022-12-22~)
454
- let underName;
455
455
  // purpose:Orderの指定があれば、underName,issuedByを調整(2022-05-23~)
456
456
  if (typeof ((_a = params.order) === null || _a === void 0 ? void 0 : _a.typeOf) === 'string') {
457
457
  const ordre2reservationUnderNameResult = ordre2reservationUnderName({ order: params.order });
@@ -468,12 +468,18 @@ function createPotentialActions(params) {
468
468
  underName
469
469
  }));
470
470
  });
471
- reservationPackage = Object.assign({ reservationFor, reservationNumber: transaction.object.reservationNumber, reservationStatus: (typeof params.transaction.object.reservationStatus === 'string')
471
+ reservationPackage = {
472
+ reservationFor,
473
+ reservationNumber: transaction.object.reservationNumber,
474
+ reservationStatus: (typeof params.transaction.object.reservationStatus === 'string')
472
475
  ? params.transaction.object.reservationStatus
473
- : factory.reservationStatusType.ReservationPending,
476
+ : factory.reservationStatusType.ReservationPending,
474
477
  // 不要なので廃止(2023-01-19~)
475
478
  // subReservation: pendingReservations,
476
- typeOf: factory.reservationType.ReservationPackage }, (typeof (underName === null || underName === void 0 ? void 0 : underName.typeOf) === 'string') ? { underName } : undefined);
479
+ typeOf: factory.reservationType.ReservationPackage
480
+ // 廃止(2023-05-31~)→予約取引から取得に変更
481
+ // ...(typeof underName?.typeOf === 'string') ? { underName } : undefined
482
+ };
477
483
  reserveActionAttributes = [{
478
484
  project: transaction.project,
479
485
  typeOf: factory.actionType.ReserveAction,
@@ -490,7 +496,8 @@ function createPotentialActions(params) {
490
496
  potentialActions: {
491
497
  reserve: reserveActionAttributes
492
498
  },
493
- reservationPackage
499
+ reservationPackage,
500
+ underName
494
501
  };
495
502
  }
496
503
  exports.createPotentialActions = createPotentialActions;
@@ -698,7 +698,6 @@ function onReservationsCreated(params) {
698
698
  */
699
699
  function confirm(params) {
700
700
  return (repos) => __awaiter(this, void 0, void 0, function* () {
701
- var _a;
702
701
  let transaction;
703
702
  // 取引存在確認
704
703
  if (typeof params.id === 'string') {
@@ -717,13 +716,14 @@ function confirm(params) {
717
716
  throw new factory.errors.ArgumentNull('Transaction ID or Transaction Number');
718
717
  }
719
718
  const order = yield fixOrderAsPurpose(params, transaction)(repos);
720
- const { potentialActions, reservationPackage } = (0, factory_1.createPotentialActions)(Object.assign(Object.assign({}, params), { transaction: transaction, order }));
719
+ const { potentialActions, underName } = (0, factory_1.createPotentialActions)(Object.assign(Object.assign({}, params), { transaction,
720
+ order }));
721
721
  // 取引確定
722
722
  const result = {};
723
723
  yield repos.assetTransaction.confirm(Object.assign({ typeOf: factory.assetTransactionType.Reserve, id: transaction.id, result: result, potentialActions: (settings_1.USE_ASSET_TRANSACTION_SYNC_PROCESSING)
724
724
  ? { reserve: [] }
725
- : potentialActions }, (typeof ((_a = reservationPackage === null || reservationPackage === void 0 ? void 0 : reservationPackage.underName) === null || _a === void 0 ? void 0 : _a.typeOf) === 'string')
726
- ? { object: { underName: reservationPackage.underName } }
725
+ : potentialActions }, (typeof (underName === null || underName === void 0 ? void 0 : underName.typeOf) === 'string')
726
+ ? { object: { underName } }
727
727
  : undefined));
728
728
  if (settings_1.USE_ASSET_TRANSACTION_SYNC_PROCESSING) {
729
729
  // sync対応(2023-01-13~)
@@ -24,7 +24,7 @@ function confirmReservation(actionAttributesList) {
24
24
  let confirmedReservations = [];
25
25
  if (actionAttributesList.length > 0) {
26
26
  yield Promise.all(actionAttributesList.map((actionAttributes) => __awaiter(this, void 0, void 0, function* () {
27
- var _a, _b;
27
+ var _a;
28
28
  const reservationPackage = actionAttributes.object;
29
29
  const action = yield repos.action.start(actionAttributes);
30
30
  try {
@@ -42,9 +42,9 @@ function confirmReservation(actionAttributesList) {
42
42
  // 予約取引に保管されたunderNameを使用する(2023-05-30~)
43
43
  if (typeof ((_a = reserveTransaction.object.underName) === null || _a === void 0 ? void 0 : _a.typeOf) === 'string') {
44
44
  underName = reserveTransaction.object.underName;
45
- }
46
- else if (typeof ((_b = reservationPackage.underName) === null || _b === void 0 ? void 0 : _b.typeOf) === 'string') {
47
- underName = reservationPackage.underName;
45
+ // 廃止(2023-05-31~)→予約取引から取得に変更
46
+ // } else if (typeof reservationPackage.underName?.typeOf === 'string') {
47
+ // underName = reservationPackage.underName;
48
48
  }
49
49
  // ReservationPackageに対応(2022-12-22~)
50
50
  if (reservationPackage.typeOf === factory.reservationType.ReservationPackage) {
package/package.json CHANGED
@@ -9,7 +9,7 @@
9
9
  }
10
10
  ],
11
11
  "dependencies": {
12
- "@chevre/factory": "4.313.0-alpha.19",
12
+ "@chevre/factory": "4.313.0-alpha.20",
13
13
  "@cinerino/sdk": "3.157.0-alpha.5",
14
14
  "@motionpicture/coa-service": "9.2.0",
15
15
  "@motionpicture/gmo-service": "5.2.0",
@@ -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.2.0-alpha.80"
120
+ "version": "21.2.0-alpha.81"
121
121
  }