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

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.
Files changed (107) hide show
  1. package/example/src/chevre/deleteEvents.ts +9 -1
  2. package/example/src/chevre/migrateAccountTitleAdditionalProperties.ts +157 -0
  3. package/example/src/chevre/migrateCreativeWorkAdditionalProperties.ts +116 -0
  4. package/example/src/chevre/migrateEventOffersSellerMakesOffer.ts +139 -0
  5. package/example/src/chevre/migrateEventProjectAttributes.ts +57 -0
  6. package/example/src/chevre/migratePlaceAdditionalProperties.ts +162 -0
  7. package/example/src/chevre/migrateSSKTEventCOAEndpoint.ts +64 -0
  8. package/example/src/chevre/searchEvents.ts +36 -16
  9. package/lib/chevre/repo/accountAction.d.ts +0 -18
  10. package/lib/chevre/repo/accountAction.js +402 -355
  11. package/lib/chevre/repo/accountTitle.d.ts +1 -0
  12. package/lib/chevre/repo/accountTitle.js +6 -1
  13. package/lib/chevre/repo/additionalProperty.d.ts +35 -0
  14. package/lib/chevre/repo/additionalProperty.js +205 -0
  15. package/lib/chevre/repo/categoryCode.d.ts +1 -0
  16. package/lib/chevre/repo/categoryCode.js +15 -1
  17. package/lib/chevre/repo/creativeWork.js +10 -1
  18. package/lib/chevre/repo/customer.d.ts +1 -0
  19. package/lib/chevre/repo/customer.js +5 -0
  20. package/lib/chevre/repo/event.d.ts +12 -4
  21. package/lib/chevre/repo/event.js +84 -48
  22. package/lib/chevre/repo/merchantReturnPolicy.d.ts +1 -0
  23. package/lib/chevre/repo/merchantReturnPolicy.js +5 -0
  24. package/lib/chevre/repo/mongoose/model/additionalProperty.d.ts +7 -0
  25. package/lib/chevre/repo/mongoose/model/additionalProperty.js +81 -0
  26. package/lib/chevre/repo/mongoose/model/categoryCode.js +18 -2
  27. package/lib/chevre/repo/mongoose/model/creativeWork.js +6 -0
  28. package/lib/chevre/repo/mongoose/model/event.js +53 -0
  29. package/lib/chevre/repo/mongoose/model/offer.js +7 -1
  30. package/lib/chevre/repo/mongoose/model/offerCatalog.js +21 -2
  31. package/lib/chevre/repo/mongoose/model/ownershipInfo.js +3 -15
  32. package/lib/chevre/repo/mongoose/model/place.js +42 -0
  33. package/lib/chevre/repo/offer.js +10 -1
  34. package/lib/chevre/repo/offerCatalog.js +10 -10
  35. package/lib/chevre/repo/place.d.ts +1 -0
  36. package/lib/chevre/repo/place.js +54 -7
  37. package/lib/chevre/repo/reservation.d.ts +13 -0
  38. package/lib/chevre/repo/reservation.js +28 -0
  39. package/lib/chevre/repo/transaction.js +20 -5
  40. package/lib/chevre/repository.d.ts +6 -3
  41. package/lib/chevre/repository.js +10 -5
  42. package/lib/chevre/service/account.d.ts +0 -4
  43. package/lib/chevre/service/account.js +24 -22
  44. package/lib/chevre/service/accountTransaction/deposit.d.ts +0 -2
  45. package/lib/chevre/service/accountTransaction/deposit.js +3 -3
  46. package/lib/chevre/service/accountTransaction/transfer.d.ts +0 -2
  47. package/lib/chevre/service/accountTransaction/transfer.js +3 -3
  48. package/lib/chevre/service/accountTransaction/withdraw.d.ts +0 -2
  49. package/lib/chevre/service/accountTransaction/withdraw.js +3 -3
  50. package/lib/chevre/service/assetTransaction/pay/potentialActions.js +9 -19
  51. package/lib/chevre/service/assetTransaction/reserve/factory.js +119 -115
  52. package/lib/chevre/service/assetTransaction/reserve.js +99 -89
  53. package/lib/chevre/service/delivery/factory.js +2 -1
  54. package/lib/chevre/service/event.js +20 -6
  55. package/lib/chevre/service/offer/event/authorize.d.ts +4 -0
  56. package/lib/chevre/service/offer/event/authorize.js +65 -27
  57. package/lib/chevre/service/offer/event/factory.d.ts +1 -1
  58. package/lib/chevre/service/offer/event/factory.js +17 -12
  59. package/lib/chevre/service/offer/eventServiceByCOA/factory.js +19 -9
  60. package/lib/chevre/service/offer/factory.js +7 -20
  61. package/lib/chevre/service/offer.js +6 -6
  62. package/lib/chevre/service/order/onOrderStatusChanged/factory.js +4 -2
  63. package/lib/chevre/service/order/onOrderStatusChanged.js +3 -2
  64. package/lib/chevre/service/order/placeOrder.js +13 -5
  65. package/lib/chevre/service/order/returnOrder.js +2 -1
  66. package/lib/chevre/service/order/sendOrder.js +2 -1
  67. package/lib/chevre/service/reserve/cancelReservation.js +135 -87
  68. package/lib/chevre/service/reserve/confirmReservation.js +65 -33
  69. package/lib/chevre/service/reserve/potentialActions/onReservationConfirmed.d.ts +1 -1
  70. package/lib/chevre/service/reserve/potentialActions/onReservationConfirmed.js +67 -30
  71. package/lib/chevre/service/task/confirmReserveTransaction.js +1 -1
  72. package/lib/chevre/service/transaction/orderProgramMembership.js +6 -8
  73. package/lib/chevre/service/transaction/placeOrder/exportTasks/factory.js +6 -3
  74. package/lib/chevre/service/transaction/placeOrderInProgress/factory.js +9 -4
  75. package/lib/chevre/service/transaction/placeOrderInProgress/potentialActions/givePointAward.js +2 -1
  76. package/lib/chevre/service/transaction/placeOrderInProgress/potentialActions/moneyTransfer.js +2 -1
  77. package/lib/chevre/service/transaction/placeOrderInProgress/potentialActions/registerService.js +2 -1
  78. package/lib/chevre/service/transaction/placeOrderInProgress/potentialActions/sendEmailMessage.js +4 -3
  79. package/lib/chevre/service/transaction/placeOrderInProgress/potentialActions.js +2 -1
  80. package/lib/chevre/service/transaction/placeOrderInProgress/result/acceptedOffers.js +10 -6
  81. package/lib/chevre/service/transaction/placeOrderInProgress/result.js +2 -4
  82. package/lib/chevre/service/transaction/placeOrderInProgress/validation/validateSeller.d.ts +3 -1
  83. package/lib/chevre/service/transaction/placeOrderInProgress/validation/validateSeller.js +3 -2
  84. package/lib/chevre/service/transaction/placeOrderInProgress.js +16 -2
  85. package/lib/chevre/service/transaction/returnOrder/potentialActions/returnMoneyTransfer.js +4 -5
  86. package/lib/chevre/service/transaction/returnOrder/potentialActions/returnPaymentMethod.js +6 -3
  87. package/lib/chevre/service/transaction/returnOrder/potentialActions/returnPointAward.js +4 -6
  88. package/lib/chevre/service/transaction/returnOrder/potentialActions/sendEmailMessage.js +2 -1
  89. package/lib/chevre/service/transaction/returnOrder.js +10 -1
  90. package/lib/chevre/service/transaction.js +1 -14
  91. package/package.json +4 -4
  92. package/example/src/chevre/accountBlanceTest.ts +0 -24
  93. package/example/src/chevre/checkOffersAppliesToMovieTicket.ts +0 -56
  94. package/example/src/chevre/createSeats.ts +0 -59
  95. package/example/src/chevre/manageOwnedByOfOwnershipInfo.ts +0 -35
  96. package/example/src/chevre/migrateEventOffersItemOfferedName.ts +0 -82
  97. package/example/src/chevre/migrateMovieTicketChargePriceSpecs.ts +0 -92
  98. package/example/src/chevre/migrateSellerMakesOffers.ts +0 -84
  99. package/example/src/chevre/migrateTTTSOldEventId.ts +0 -68
  100. package/example/src/chevre/publishConfirmationNumber.ts +0 -30
  101. package/example/src/chevre/publishServiceOutputIdentifier.ts +0 -28
  102. package/example/src/chevre/publishTransactionNumber.ts +0 -28
  103. package/example/src/chevre/renameTransaction.ts +0 -22
  104. package/lib/chevre/service/task/accountMoneyTransfer.d.ts +0 -3
  105. package/lib/chevre/service/task/accountMoneyTransfer.js +0 -31
  106. package/lib/chevre/service/task/cancelAccountMoneyTransfer.d.ts +0 -3
  107. package/lib/chevre/service/task/cancelAccountMoneyTransfer.js +0 -33
@@ -0,0 +1,81 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.schema = exports.modelName = void 0;
4
+ const mongoose = require("mongoose");
5
+ const modelName = 'AdditionalProperty';
6
+ exports.modelName = modelName;
7
+ const writeConcern = { j: true, w: 'majority', wtimeout: 10000 };
8
+ /**
9
+ * 追加特性スキーマ
10
+ */
11
+ const schema = new mongoose.Schema({
12
+ project: mongoose.SchemaTypes.Mixed,
13
+ typeOf: {
14
+ type: String,
15
+ required: true
16
+ },
17
+ codeValue: {
18
+ type: String,
19
+ required: true
20
+ },
21
+ inCodeSet: mongoose.SchemaTypes.Mixed,
22
+ name: mongoose.SchemaTypes.Mixed
23
+ }, {
24
+ collection: 'additionalProperties',
25
+ id: true,
26
+ read: 'primaryPreferred',
27
+ writeConcern: writeConcern,
28
+ strict: true,
29
+ useNestedStrict: true,
30
+ timestamps: {
31
+ createdAt: 'createdAt',
32
+ updatedAt: 'updatedAt'
33
+ },
34
+ toJSON: {
35
+ getters: false,
36
+ virtuals: false,
37
+ minimize: false,
38
+ versionKey: false
39
+ },
40
+ toObject: {
41
+ getters: false,
42
+ virtuals: true,
43
+ minimize: false,
44
+ versionKey: false
45
+ }
46
+ });
47
+ exports.schema = schema;
48
+ schema.index({ createdAt: 1 }, { name: 'searchByCreatedAt' });
49
+ schema.index({ updatedAt: 1 }, { name: 'searchByUpdatedAt' });
50
+ schema.index({ codeValue: 1 }, { name: 'searchByCodeValue' });
51
+ schema.index({ 'project.id': 1, codeValue: 1 }, {
52
+ name: 'searchByProjectId'
53
+ });
54
+ schema.index({ 'inCodeSet.identifier': 1, codeValue: 1 }, {
55
+ name: 'searchByInCodeSetIdentifier',
56
+ partialFilterExpression: {
57
+ 'inCodeSet.identifier': { $exists: true }
58
+ }
59
+ });
60
+ schema.index({ 'name.ja': 1, codeValue: 1 }, {
61
+ name: 'searchByNameJa',
62
+ partialFilterExpression: {
63
+ 'name.ja': { $exists: true }
64
+ }
65
+ });
66
+ schema.index({ 'name.en': 1, codeValue: 1 }, {
67
+ name: 'searchByNameEn',
68
+ partialFilterExpression: {
69
+ 'name.en': { $exists: true }
70
+ }
71
+ });
72
+ mongoose.model(modelName, schema)
73
+ .on('index',
74
+ // tslint:disable-next-line:no-single-line-block-comment
75
+ /* istanbul ignore next */
76
+ (error) => {
77
+ if (error !== undefined) {
78
+ // tslint:disable-next-line:no-console
79
+ console.error(error);
80
+ }
81
+ });
@@ -13,13 +13,23 @@ const schema = new mongoose.Schema({
13
13
  typeOf: {
14
14
  type: String,
15
15
  required: true
16
- }
16
+ },
17
+ additionalProperty: [mongoose.SchemaTypes.Mixed],
18
+ color: String,
19
+ image: String,
20
+ codeValue: {
21
+ type: String,
22
+ required: true
23
+ },
24
+ inCodeSet: mongoose.SchemaTypes.Mixed,
25
+ name: mongoose.SchemaTypes.Mixed,
26
+ paymentMethod: mongoose.SchemaTypes.Mixed
17
27
  }, {
18
28
  collection: 'categoryCodes',
19
29
  id: true,
20
30
  read: 'primaryPreferred',
21
31
  writeConcern: writeConcern,
22
- strict: false,
32
+ strict: true,
23
33
  useNestedStrict: true,
24
34
  timestamps: {
25
35
  createdAt: 'createdAt',
@@ -71,6 +81,12 @@ schema.index({ 'paymentMethod.typeOf': 1, codeValue: 1 }, {
71
81
  schema.index({ 'project.id': 1, codeValue: 1 }, {
72
82
  name: 'searchByProjectId-v20220721'
73
83
  });
84
+ schema.index({ additionalProperty: 1, codeValue: 1 }, {
85
+ name: 'searchByAdditionalProperty',
86
+ partialFilterExpression: {
87
+ additionalProperty: { $exists: true }
88
+ }
89
+ });
74
90
  mongoose.model(modelName, schema)
75
91
  .on('index',
76
92
  // tslint:disable-next-line:no-single-line-block-comment
@@ -111,6 +111,12 @@ schema.index({ 'distributor.codeValue': 1, identifier: 1 }, {
111
111
  'distributor.codeValue': { $exists: true }
112
112
  }
113
113
  });
114
+ schema.index({ additionalProperty: 1, identifier: 1 }, {
115
+ name: 'searchByAdditionalProperty',
116
+ partialFilterExpression: {
117
+ additionalProperty: { $exists: true }
118
+ }
119
+ });
114
120
  mongoose.model(modelName, schema)
115
121
  .on('index',
116
122
  // tslint:disable-next-line:no-single-line-block-comment
@@ -185,6 +185,59 @@ schema.index({
185
185
  },
186
186
  name: 'searchByOffersItemOfferedId'
187
187
  });
188
+ // tslint:disable-next-line:no-suspicious-comment
189
+ // TODO add index
190
+ schema.index({ 'offers.seller.makesOffer': 1, startDate: 1 }, {
191
+ name: 'searchBySellerMakesOffer',
192
+ partialFilterExpression: {
193
+ 'offers.seller.makesOffer': { $exists: true }
194
+ }
195
+ });
196
+ // schema.index(
197
+ // { 'offers.seller.makesOffer.availableAtOrFrom.id': 1, startDate: 1 },
198
+ // {
199
+ // name: 'searchBySellerMakesOfferAvailableAtOrFromId',
200
+ // partialFilterExpression: {
201
+ // 'offers.seller.makesOffer.availableAtOrFrom.id': { $exists: true }
202
+ // }
203
+ // }
204
+ // );
205
+ // schema.index(
206
+ // { 'offers.seller.makesOffer.availabilityEnds': 1, startDate: 1 },
207
+ // {
208
+ // name: 'searchBySellerMakesOfferAvailabilityEnds',
209
+ // partialFilterExpression: {
210
+ // 'offers.seller.makesOffer.availabilityEnds': { $exists: true }
211
+ // }
212
+ // }
213
+ // );
214
+ // schema.index(
215
+ // { 'offers.seller.makesOffer.availabilityStarts': 1, startDate: 1 },
216
+ // {
217
+ // name: 'searchBySellerMakesOfferAvailabilityStarts',
218
+ // partialFilterExpression: {
219
+ // 'offers.seller.makesOffer.availabilityStarts': { $exists: true }
220
+ // }
221
+ // }
222
+ // );
223
+ // schema.index(
224
+ // { 'offers.seller.makesOffer.validThrough': 1, startDate: 1 },
225
+ // {
226
+ // name: 'searchBySellerMakesOfferValidThrough',
227
+ // partialFilterExpression: {
228
+ // 'offers.seller.makesOffer.validThrough': { $exists: true }
229
+ // }
230
+ // }
231
+ // );
232
+ // schema.index(
233
+ // { 'offers.seller.makesOffer.validFrom': 1, startDate: 1 },
234
+ // {
235
+ // name: 'searchBySellerMakesOfferValidFrom',
236
+ // partialFilterExpression: {
237
+ // 'offers.seller.makesOffer.validFrom': { $exists: true }
238
+ // }
239
+ // }
240
+ // );
188
241
  schema.index({ 'videoFormat.typeOf': 1, startDate: 1 }, {
189
242
  name: 'searchByVideoFormatTypeOf',
190
243
  partialFilterExpression: {
@@ -19,7 +19,7 @@ const schema = new mongoose.Schema({
19
19
  description: mongoose.SchemaTypes.Mixed,
20
20
  category: mongoose.SchemaTypes.Mixed,
21
21
  color: mongoose.SchemaTypes.Mixed,
22
- additionalProperty: mongoose.SchemaTypes.Mixed,
22
+ additionalProperty: [mongoose.SchemaTypes.Mixed],
23
23
  alternateName: mongoose.SchemaTypes.Mixed,
24
24
  acceptedPaymentMethod: mongoose.SchemaTypes.Mixed,
25
25
  addOn: mongoose.SchemaTypes.Mixed,
@@ -189,6 +189,12 @@ schema.index({ 'hasMerchantReturnPolicy.id': 1, 'priceSpecification.price': 1 },
189
189
  'hasMerchantReturnPolicy.id': { $exists: true }
190
190
  }
191
191
  });
192
+ schema.index({ additionalProperty: 1, 'priceSpecification.price': 1 }, {
193
+ name: 'searchByAdditionalProperty',
194
+ partialFilterExpression: {
195
+ additionalProperty: { $exists: true }
196
+ }
197
+ });
192
198
  mongoose.model(modelName, schema)
193
199
  .on('index',
194
200
  // tslint:disable-next-line:no-single-line-block-comment
@@ -11,13 +11,26 @@ const writeConcern = { j: true, w: 'majority', wtimeout: 10000 };
11
11
  const schema = new mongoose.Schema({
12
12
  project: mongoose.SchemaTypes.Mixed,
13
13
  _id: String,
14
- identifier: mongoose.SchemaTypes.Mixed
14
+ identifier: {
15
+ type: String,
16
+ required: true
17
+ },
18
+ name: mongoose.SchemaTypes.Mixed,
19
+ description: mongoose.SchemaTypes.Mixed,
20
+ alternateName: mongoose.SchemaTypes.Mixed,
21
+ typeOf: {
22
+ type: String,
23
+ required: true
24
+ },
25
+ itemListElement: [mongoose.SchemaTypes.Mixed],
26
+ itemOffered: mongoose.SchemaTypes.Mixed,
27
+ additionalProperty: [mongoose.SchemaTypes.Mixed]
15
28
  }, {
16
29
  collection: 'offerCatalogs',
17
30
  id: true,
18
31
  read: 'primaryPreferred',
19
32
  writeConcern: writeConcern,
20
- strict: false,
33
+ strict: true,
21
34
  timestamps: {
22
35
  createdAt: 'createdAt',
23
36
  updatedAt: 'updatedAt'
@@ -62,6 +75,12 @@ schema.index({ 'itemOffered.serviceType.codeValue': 1, identifier: 1 }, {
62
75
  'itemOffered.serviceType.codeValue': { $exists: true }
63
76
  }
64
77
  });
78
+ schema.index({ additionalProperty: 1, identifier: 1 }, {
79
+ name: 'searchByAdditionalProperty',
80
+ partialFilterExpression: {
81
+ additionalProperty: { $exists: true }
82
+ }
83
+ });
65
84
  mongoose.model(modelName, schema)
66
85
  .on('index',
67
86
  // tslint:disable-next-line:no-single-line-block-comment
@@ -5,18 +5,6 @@ const mongoose = require("mongoose");
5
5
  const modelName = 'OwnershipInfo';
6
6
  exports.modelName = modelName;
7
7
  const writeConcern = { j: true, w: 'majority', wtimeout: 10000 };
8
- // Arrayにも対応するためにMixedに変更(2022-07-26~)
9
- const ownedBySchema = mongoose.SchemaTypes.Mixed;
10
- const acquiredFromSchema = new mongoose.Schema({}, {
11
- id: false,
12
- _id: false,
13
- strict: false
14
- });
15
- const typeOfGoodSchema = new mongoose.Schema({}, {
16
- id: false,
17
- _id: false,
18
- strict: false
19
- });
20
8
  /**
21
9
  * 所有権スキーマ
22
10
  */
@@ -28,11 +16,11 @@ const schema = new mongoose.Schema({
28
16
  required: true
29
17
  },
30
18
  identifier: mongoose.SchemaTypes.Mixed,
31
- ownedBy: ownedBySchema,
32
- acquiredFrom: acquiredFromSchema,
19
+ ownedBy: mongoose.SchemaTypes.Mixed,
20
+ acquiredFrom: mongoose.SchemaTypes.Mixed,
33
21
  ownedFrom: Date,
34
22
  ownedThrough: Date,
35
- typeOfGood: typeOfGoodSchema
23
+ typeOfGood: mongoose.SchemaTypes.Mixed
36
24
  }, {
37
25
  collection: 'ownershipInfos',
38
26
  id: true,
@@ -89,6 +89,48 @@ 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
+ });
110
+ schema.index({ additionalProperty: 1, branchCode: 1 }, {
111
+ name: 'searchByAdditionalProperty',
112
+ partialFilterExpression: {
113
+ additionalProperty: { $exists: true }
114
+ }
115
+ });
116
+ schema.index({ 'containsPlace.additionalProperty': 1, branchCode: 1 }, {
117
+ name: 'searchByContainsPlaceAdditionalProperty',
118
+ partialFilterExpression: {
119
+ 'containsPlace.additionalProperty': { $exists: true }
120
+ }
121
+ });
122
+ schema.index({ 'containsPlace.containsPlace.additionalProperty': 1, branchCode: 1 }, {
123
+ name: 'searchByContainsPlaceContainsPlaceAdditionalProperty',
124
+ partialFilterExpression: {
125
+ 'containsPlace.containsPlace.additionalProperty': { $exists: true }
126
+ }
127
+ });
128
+ schema.index({ 'containsPlace.containsPlace.containsPlace.additionalProperty': 1, branchCode: 1 }, {
129
+ name: 'searchByContainsPlaceContainsPlaceContainsPlaceAdditionalProperty',
130
+ partialFilterExpression: {
131
+ 'containsPlace.containsPlace.containsPlace.additionalProperty': { $exists: true }
132
+ }
133
+ });
92
134
  mongoose.model(modelName, schema)
93
135
  .on('index',
94
136
  // tslint:disable-next-line:no-single-line-block-comment
@@ -35,7 +35,7 @@ class MongoRepository {
35
35
  }
36
36
  // tslint:disable-next-line:cyclomatic-complexity max-func-body-length
37
37
  static CREATE_OFFER_MONGO_CONDITIONS(params) {
38
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, _20, _21, _22, _23;
38
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, _20, _21, _22, _23, _24;
39
39
  // MongoDB検索条件
40
40
  const andConditions = [];
41
41
  const projectIdEq = (_b = (_a = params.project) === null || _a === void 0 ? void 0 : _a.id) === null || _b === void 0 ? void 0 : _b.$eq;
@@ -285,6 +285,15 @@ class MongoRepository {
285
285
  }
286
286
  });
287
287
  }
288
+ const additionalPropertyElemMatch = (_24 = params.additionalProperty) === null || _24 === void 0 ? void 0 : _24.$elemMatch;
289
+ if (additionalPropertyElemMatch !== undefined && additionalPropertyElemMatch !== null) {
290
+ andConditions.push({
291
+ additionalProperty: {
292
+ $exists: true,
293
+ $elemMatch: additionalPropertyElemMatch
294
+ }
295
+ });
296
+ }
288
297
  return andConditions;
289
298
  }
290
299
  /**
@@ -32,7 +32,7 @@ class MongoRepository {
32
32
  this.offerCatalogModel = connection.model(offerCatalog_1.modelName);
33
33
  }
34
34
  static CREATE_MONGO_CONDITIONS(params) {
35
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
35
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
36
36
  // MongoDB検索条件
37
37
  const andConditions = [];
38
38
  const projectIdEq = (_b = (_a = params.project) === null || _a === void 0 ? void 0 : _a.id) === null || _b === void 0 ? void 0 : _b.$eq;
@@ -107,15 +107,15 @@ class MongoRepository {
107
107
  }
108
108
  });
109
109
  }
110
- // 互換性対応
111
- // const ticketTypes = params.ticketTypes;
112
- // if (Array.isArray(ticketTypes)) {
113
- // andConditions.push({
114
- // ticketTypes: {
115
- // $in: ticketTypes
116
- // }
117
- // });
118
- // }
110
+ const additionalPropertyElemMatch = (_l = params.additionalProperty) === null || _l === void 0 ? void 0 : _l.$elemMatch;
111
+ if (additionalPropertyElemMatch !== undefined && additionalPropertyElemMatch !== null) {
112
+ andConditions.push({
113
+ additionalProperty: {
114
+ $exists: true,
115
+ $elemMatch: additionalPropertyElemMatch
116
+ }
117
+ });
118
+ }
119
119
  return andConditions;
120
120
  }
121
121
  save(params) {
@@ -114,5 +114,6 @@ export declare class MongoRepository {
114
114
  id: string;
115
115
  };
116
116
  }): Promise<void>;
117
+ getCursor(conditions: any, projection: any): import("mongoose").QueryCursor<any>;
117
118
  }
118
119
  export {};
@@ -33,7 +33,7 @@ class MongoRepository {
33
33
  }
34
34
  // tslint:disable-next-line:max-func-body-length
35
35
  static CREATE_MOVIE_THEATER_MONGO_CONDITIONS(params) {
36
- var _a, _b, _c, _d, _e, _f, _g, _h;
36
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
37
37
  // MongoDB検索条件
38
38
  const andConditions = [];
39
39
  const projectIdEq = (_b = (_a = params.project) === null || _a === void 0 ? void 0 : _a.id) === null || _b === void 0 ? void 0 : _b.$eq;
@@ -123,6 +123,15 @@ class MongoRepository {
123
123
  }
124
124
  });
125
125
  }
126
+ const additionalPropertyElemMatch = (_j = params.additionalProperty) === null || _j === void 0 ? void 0 : _j.$elemMatch;
127
+ if (additionalPropertyElemMatch !== undefined && additionalPropertyElemMatch !== null) {
128
+ andConditions.push({
129
+ additionalProperty: {
130
+ $exists: true,
131
+ $elemMatch: additionalPropertyElemMatch
132
+ }
133
+ });
134
+ }
126
135
  return andConditions;
127
136
  }
128
137
  /**
@@ -426,7 +435,7 @@ class MongoRepository {
426
435
  }
427
436
  // tslint:disable-next-line:max-func-body-length
428
437
  searchScreeningRoomSections(searchConditions) {
429
- var _a, _b, _c, _d, _e, _f, _g, _h, _j;
438
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
430
439
  return __awaiter(this, void 0, void 0, function* () {
431
440
  const matchStages = [];
432
441
  if (searchConditions.project !== undefined) {
@@ -508,6 +517,17 @@ class MongoRepository {
508
517
  }
509
518
  });
510
519
  }
520
+ const additionalPropertyElemMatch = (_j = searchConditions.additionalProperty) === null || _j === void 0 ? void 0 : _j.$elemMatch;
521
+ if (additionalPropertyElemMatch !== undefined && additionalPropertyElemMatch !== null) {
522
+ matchStages.push({
523
+ $match: {
524
+ 'containsPlace.containsPlace.additionalProperty': {
525
+ $exists: true,
526
+ $elemMatch: additionalPropertyElemMatch
527
+ }
528
+ }
529
+ });
530
+ }
511
531
  const aggregate = this.placeModel.aggregate([
512
532
  { $unwind: '$containsPlace' },
513
533
  { $unwind: '$containsPlace.containsPlace' },
@@ -523,7 +543,7 @@ class MongoRepository {
523
543
  branchCode: '$branchCode',
524
544
  name: '$name'
525
545
  }
526
- }, additionalProperty: '$containsPlace.containsPlace.additionalProperty' }, (((_j = searchConditions.$projection) === null || _j === void 0 ? void 0 : _j.seatCount) === 1)
546
+ }, additionalProperty: '$containsPlace.containsPlace.additionalProperty' }, (((_k = searchConditions.$projection) === null || _k === void 0 ? void 0 : _k.seatCount) === 1)
527
547
  ? {
528
548
  seatCount: {
529
549
  $cond: {
@@ -573,7 +593,7 @@ class MongoRepository {
573
593
  }
574
594
  // tslint:disable-next-line:max-func-body-length
575
595
  searchScreeningRooms(searchConditions) {
576
- var _a, _b, _c, _d, _e, _f, _g, _h;
596
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
577
597
  return __awaiter(this, void 0, void 0, function* () {
578
598
  const matchStages = [];
579
599
  const projectIdEq = (_b = (_a = searchConditions.project) === null || _a === void 0 ? void 0 : _a.id) === null || _b === void 0 ? void 0 : _b.$eq;
@@ -662,6 +682,17 @@ class MongoRepository {
662
682
  }
663
683
  });
664
684
  }
685
+ const additionalPropertyElemMatch = (_g = searchConditions.additionalProperty) === null || _g === void 0 ? void 0 : _g.$elemMatch;
686
+ if (additionalPropertyElemMatch !== undefined && additionalPropertyElemMatch !== null) {
687
+ matchStages.push({
688
+ $match: {
689
+ 'containsPlace.additionalProperty': {
690
+ $exists: true,
691
+ $elemMatch: additionalPropertyElemMatch
692
+ }
693
+ }
694
+ });
695
+ }
665
696
  const aggregate = this.placeModel.aggregate([
666
697
  { $unwind: '$containsPlace' },
667
698
  ...matchStages,
@@ -671,7 +702,7 @@ class MongoRepository {
671
702
  typeOf: '$typeOf',
672
703
  branchCode: '$branchCode',
673
704
  name: '$name'
674
- }, openSeatingAllowed: '$containsPlace.openSeatingAllowed', additionalProperty: '$containsPlace.additionalProperty' }, (((_g = searchConditions.$projection) === null || _g === void 0 ? void 0 : _g.sectionCount) === 1)
705
+ }, openSeatingAllowed: '$containsPlace.openSeatingAllowed', additionalProperty: '$containsPlace.additionalProperty' }, (((_h = searchConditions.$projection) === null || _h === void 0 ? void 0 : _h.sectionCount) === 1)
675
706
  ? {
676
707
  sectionCount: {
677
708
  $cond: {
@@ -681,7 +712,7 @@ class MongoRepository {
681
712
  }
682
713
  }
683
714
  }
684
- : undefined), (((_h = searchConditions.$projection) === null || _h === void 0 ? void 0 : _h.seatCount) === 1)
715
+ : undefined), (((_j = searchConditions.$projection) === null || _j === void 0 ? void 0 : _j.seatCount) === 1)
685
716
  ? {
686
717
  seatCount: {
687
718
  $sum: {
@@ -824,7 +855,7 @@ class MongoRepository {
824
855
  }
825
856
  // tslint:disable-next-line:cyclomatic-complexity max-func-body-length
826
857
  searchSeats(params) {
827
- var _a, _b, _c, _d, _e, _f, _g, _h;
858
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
828
859
  return __awaiter(this, void 0, void 0, function* () {
829
860
  const matchStages = [];
830
861
  if (params.project !== undefined) {
@@ -962,6 +993,17 @@ class MongoRepository {
962
993
  && params.$projection['containedInPlace.containedInPlace'] === 0) {
963
994
  includeScreeningRooms = false;
964
995
  }
996
+ const additionalPropertyElemMatch = (_j = params.additionalProperty) === null || _j === void 0 ? void 0 : _j.$elemMatch;
997
+ if (additionalPropertyElemMatch !== undefined && additionalPropertyElemMatch !== null) {
998
+ matchStages.push({
999
+ $match: {
1000
+ 'containsPlace.containsPlace.containsPlace.additionalProperty': {
1001
+ $exists: true,
1002
+ $elemMatch: additionalPropertyElemMatch
1003
+ }
1004
+ }
1005
+ });
1006
+ }
965
1007
  const aggregate = this.placeModel.aggregate([
966
1008
  { $unwind: '$containsPlace' },
967
1009
  { $unwind: '$containsPlace.containsPlace' },
@@ -1036,5 +1078,10 @@ class MongoRepository {
1036
1078
  .exec();
1037
1079
  });
1038
1080
  }
1081
+ getCursor(conditions, projection) {
1082
+ return this.placeModel.find(conditions, projection)
1083
+ .sort({ branchCode: factory.sortType.Ascending })
1084
+ .cursor();
1085
+ }
1039
1086
  }
1040
1087
  exports.MongoRepository = MongoRepository;
@@ -35,6 +35,11 @@ export declare class MongoRepository {
35
35
  underName?: factory.reservation.IUnderName<T>;
36
36
  reservedTicket?: factory.reservation.ITicket;
37
37
  }): Promise<factory.reservation.IReservation<T>>;
38
+ confirmByReservationNumber(params: {
39
+ reservationNumber: string;
40
+ previousReservationStatus: factory.reservationStatusType;
41
+ underName?: factory.reservation.IUnderName<factory.reservationType.EventReservation>;
42
+ }): Promise<void>;
38
43
  /**
39
44
  * 予約取消
40
45
  */
@@ -43,6 +48,14 @@ export declare class MongoRepository {
43
48
  previousReservationStatus?: factory.reservationStatusType;
44
49
  now: Date;
45
50
  }): Promise<factory.reservation.IReservation<T>>;
51
+ /**
52
+ * 予約取消
53
+ */
54
+ cancelByReservationNumber(params: {
55
+ reservationNumber: string;
56
+ previousReservationStatus?: factory.reservationStatusType;
57
+ now: Date;
58
+ }): Promise<void>;
46
59
  /**
47
60
  * 発券する
48
61
  */
@@ -911,6 +911,19 @@ class MongoRepository {
911
911
  return doc.toObject();
912
912
  });
913
913
  }
914
+ confirmByReservationNumber(params) {
915
+ return __awaiter(this, void 0, void 0, function* () {
916
+ const conditions = {
917
+ reservationNumber: { $eq: String(params.reservationNumber) },
918
+ reservationStatus: { $eq: params.previousReservationStatus }
919
+ };
920
+ const update = Object.assign({ reservationStatus: factory.reservationStatusType.ReservationConfirmed, modifiedTime: new Date() }, (params.underName !== undefined) ? { underName: params.underName } : undefined
921
+ // ...(params.reservedTicket !== undefined) ? { reservedTicket: params.reservedTicket } : undefined
922
+ );
923
+ yield this.reservationModel.updateMany(conditions, update)
924
+ .exec();
925
+ });
926
+ }
914
927
  /**
915
928
  * 予約取消
916
929
  */
@@ -939,6 +952,21 @@ class MongoRepository {
939
952
  return doc.toObject();
940
953
  });
941
954
  }
955
+ /**
956
+ * 予約取消
957
+ */
958
+ cancelByReservationNumber(params) {
959
+ return __awaiter(this, void 0, void 0, function* () {
960
+ const conditions = Object.assign({ reservationNumber: { $eq: String(params.reservationNumber) } }, (typeof params.previousReservationStatus === 'string')
961
+ ? { reservationStatus: params.previousReservationStatus }
962
+ : undefined);
963
+ const update = Object.assign(Object.assign({}, (typeof params.previousReservationStatus === 'string')
964
+ ? { previousReservationStatus: params.previousReservationStatus }
965
+ : undefined), { reservationStatus: factory.reservationStatusType.ReservationCancelled, modifiedTime: params.now });
966
+ yield this.reservationModel.updateMany(conditions, update)
967
+ .exec();
968
+ });
969
+ }
942
970
  /**
943
971
  * 発券する
944
972
  */
@@ -247,7 +247,24 @@ class MongoRepository {
247
247
  */
248
248
  start(params) {
249
249
  return __awaiter(this, void 0, void 0, function* () {
250
- return this.transactionModel.create(Object.assign(Object.assign({ typeOf: params.typeOf }, params), { status: factory.transactionStatusType.InProgress, startDate: new Date(), endDate: undefined, tasksExportationStatus: factory.transactionTasksExportationStatus.Unexported }))
250
+ const startDate = new Date();
251
+ let expires;
252
+ if (params.typeOf === factory.transactionType.PlaceOrder
253
+ || params.typeOf === factory.transactionType.ReturnOrder) {
254
+ // expiresInSecondsの指定があれば優先して適用する(2022-11-25~)
255
+ if (typeof params.expiresInSeconds === 'number' && params.expiresInSeconds > 0) {
256
+ expires = moment(startDate)
257
+ .add(params.expiresInSeconds, 'seconds')
258
+ .toDate();
259
+ }
260
+ else {
261
+ throw new factory.errors.ArgumentNull('expiresInSeconds');
262
+ }
263
+ }
264
+ else {
265
+ expires = params.expires;
266
+ }
267
+ return this.transactionModel.create(Object.assign(Object.assign({}, params), { typeOf: params.typeOf, status: factory.transactionStatusType.InProgress, startDate, endDate: undefined, expires, tasksExportationStatus: factory.transactionTasksExportationStatus.Unexported }))
251
268
  .then((doc) => doc.toObject());
252
269
  });
253
270
  }
@@ -433,8 +450,7 @@ class MongoRepository {
433
450
  return __awaiter(this, void 0, void 0, function* () {
434
451
  yield this.transactionModel.findByIdAndUpdate(params.id, {
435
452
  tasksExportationStatus: factory.transactionTasksExportationStatus.Exported,
436
- tasksExportedAt: moment()
437
- .toDate()
453
+ tasksExportedAt: new Date()
438
454
  })
439
455
  .exec();
440
456
  });
@@ -460,8 +476,7 @@ class MongoRepository {
460
476
  */
461
477
  cancel(params) {
462
478
  return __awaiter(this, void 0, void 0, function* () {
463
- const endDate = moment()
464
- .toDate();
479
+ const endDate = new Date();
465
480
  // 進行中ステータスの取引を中止する
466
481
  const doc = yield this.transactionModel.findOneAndUpdate({
467
482
  typeOf: params.typeOf,