@chevre/domain 21.2.0-alpha.13 → 21.2.0-alpha.131

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 (296) hide show
  1. package/example/src/chevre/aggregateEventReservation.ts +1 -1
  2. package/example/src/chevre/aggregation/aggregateSystem.ts +85 -27
  3. package/example/src/chevre/countDelayedTasks.ts +7 -2
  4. package/example/src/chevre/deleteTasksByName.ts +10 -2
  5. package/example/src/chevre/findMovieTheaterById.ts +40 -0
  6. package/example/src/chevre/importEventsFromCOA.ts +3 -4
  7. package/example/src/chevre/lockStockHolder.ts +5 -2
  8. package/example/src/chevre/migrateOrderAdditionalProperties.ts +85 -0
  9. package/example/src/chevre/migrateScreeningEventSeriesVersion.ts +79 -0
  10. package/example/src/chevre/processPay.ts +5 -1
  11. package/example/src/chevre/processRegisterMembership.ts +8 -4
  12. package/example/src/chevre/processRegisterPaymentCard.ts +8 -4
  13. package/example/src/chevre/processReserve.ts +5 -2
  14. package/example/src/chevre/saveTasks.ts +13 -10
  15. package/example/src/chevre/searchAbortedTasks.ts +34 -0
  16. package/example/src/chevre/searchActions.ts +33 -0
  17. package/example/src/chevre/searchEventSeats.ts +5 -2
  18. package/example/src/chevre/searchHoldReservations.ts +38 -0
  19. package/example/src/chevre/searchReservationNumbersByOrderNumbers.ts +37 -1
  20. package/example/src/chevre/searchScreeningRooms.ts +23 -0
  21. package/example/src/chevre/searchSendEmailActions.ts +44 -0
  22. package/example/src/chevre/task/executeTasks.ts +26 -0
  23. package/example/src/chevre/transaction/findCreditCard.ts +1 -1
  24. package/example/src/chevre/transaction/orderMembershipService.ts +1 -1
  25. package/example/src/chevre/transaction/processReturnOrder.ts +40 -0
  26. package/example/src/chevre/transaction/startExportTasks.ts +2 -1
  27. package/example/src/chevre/updateScreeningRoom.ts +41 -0
  28. package/example/src/chevre/updateTransaction.ts +1 -1
  29. package/example/src/playOnMoment.ts +24 -0
  30. package/lib/chevre/credentials.d.ts +1 -0
  31. package/lib/chevre/credentials.js +2 -1
  32. package/lib/chevre/eventEmitter/assetTransaction.d.ts +21 -0
  33. package/lib/chevre/eventEmitter/assetTransaction.js +25 -0
  34. package/lib/chevre/eventEmitter/task.d.ts +18 -0
  35. package/lib/chevre/eventEmitter/task.js +25 -0
  36. package/lib/chevre/eventEmitter/transaction.d.ts +21 -0
  37. package/lib/chevre/eventEmitter/transaction.js +25 -0
  38. package/lib/chevre/eventEmitter.d.ts +4 -0
  39. package/lib/chevre/eventEmitter.js +9 -0
  40. package/lib/chevre/index.d.ts +3 -2
  41. package/lib/chevre/index.js +5 -3
  42. package/lib/chevre/repo/account.js +3 -2
  43. package/lib/chevre/repo/accountTransaction.d.ts +3 -1
  44. package/lib/chevre/repo/accountTransaction.js +3 -2
  45. package/lib/chevre/repo/action.d.ts +42 -2
  46. package/lib/chevre/repo/action.js +130 -57
  47. package/lib/chevre/repo/additionalProperty.js +2 -1
  48. package/lib/chevre/repo/aggregation.d.ts +3 -0
  49. package/lib/chevre/repo/aggregation.js +3 -0
  50. package/lib/chevre/repo/assetTransaction.d.ts +23 -8
  51. package/lib/chevre/repo/assetTransaction.js +253 -80
  52. package/lib/chevre/repo/categoryCode.d.ts +1 -1
  53. package/lib/chevre/repo/categoryCode.js +37 -25
  54. package/lib/chevre/repo/code.js +3 -2
  55. package/lib/chevre/repo/comment.d.ts +4 -1
  56. package/lib/chevre/repo/comment.js +22 -6
  57. package/lib/chevre/repo/confirmationNumber.d.ts +0 -1
  58. package/lib/chevre/repo/confirmationNumber.js +3 -15
  59. package/lib/chevre/repo/creativeWork.d.ts +2 -4
  60. package/lib/chevre/repo/creativeWork.js +35 -12
  61. package/lib/chevre/repo/customer.js +2 -1
  62. package/lib/chevre/repo/emailMessage.d.ts +1 -27
  63. package/lib/chevre/repo/emailMessage.js +2 -1
  64. package/lib/chevre/repo/event.d.ts +27 -1
  65. package/lib/chevre/repo/event.js +67 -33
  66. package/lib/chevre/repo/member.js +4 -3
  67. package/lib/chevre/repo/merchantReturnPolicy.d.ts +1 -3
  68. package/lib/chevre/repo/merchantReturnPolicy.js +2 -1
  69. package/lib/chevre/repo/mongoose/schemas/account.d.ts +4 -2
  70. package/lib/chevre/repo/mongoose/schemas/accountTitle.d.ts +29 -3
  71. package/lib/chevre/repo/mongoose/schemas/accountTransaction.d.ts +31 -3
  72. package/lib/chevre/repo/mongoose/schemas/accountTransaction.js +1 -1
  73. package/lib/chevre/repo/mongoose/schemas/accountingReport.d.ts +13 -3
  74. package/lib/chevre/repo/mongoose/schemas/action.d.ts +43 -3
  75. package/lib/chevre/repo/mongoose/schemas/action.js +19 -1
  76. package/lib/chevre/repo/mongoose/schemas/additionalProperty.d.ts +17 -3
  77. package/lib/chevre/repo/mongoose/schemas/aggregation.d.ts +4 -2
  78. package/lib/chevre/repo/mongoose/schemas/assetTransaction.d.ts +44 -3
  79. package/lib/chevre/repo/mongoose/schemas/assetTransaction.js +32 -19
  80. package/lib/chevre/repo/mongoose/schemas/authorization.d.ts +19 -3
  81. package/lib/chevre/repo/mongoose/schemas/authorization.js +1 -1
  82. package/lib/chevre/repo/mongoose/schemas/categoryCode.d.ts +25 -3
  83. package/lib/chevre/repo/mongoose/schemas/comments.d.ts +27 -3
  84. package/lib/chevre/repo/mongoose/schemas/comments.js +1 -1
  85. package/lib/chevre/repo/mongoose/schemas/creativeWork.d.ts +43 -3
  86. package/lib/chevre/repo/mongoose/schemas/customer.d.ts +25 -3
  87. package/lib/chevre/repo/mongoose/schemas/emailMessages.d.ts +21 -3
  88. package/lib/chevre/repo/mongoose/schemas/event.d.ts +71 -3
  89. package/lib/chevre/repo/mongoose/schemas/holdReservation.d.ts +75 -0
  90. package/lib/chevre/repo/mongoose/schemas/holdReservation.js +92 -0
  91. package/lib/chevre/repo/mongoose/schemas/member.d.ts +13 -3
  92. package/lib/chevre/repo/mongoose/schemas/merchantReturnPolicy.d.ts +21 -3
  93. package/lib/chevre/repo/mongoose/schemas/offer.d.ts +65 -3
  94. package/lib/chevre/repo/mongoose/schemas/offerCatalog.d.ts +27 -3
  95. package/lib/chevre/repo/mongoose/schemas/offerItemCondition.d.ts +74 -0
  96. package/lib/chevre/repo/mongoose/schemas/offerItemCondition.js +45 -0
  97. package/lib/chevre/repo/mongoose/schemas/order.d.ts +51 -3
  98. package/lib/chevre/repo/mongoose/schemas/order.js +1 -1
  99. package/lib/chevre/repo/mongoose/schemas/ownershipInfo.d.ts +25 -3
  100. package/lib/chevre/repo/mongoose/schemas/ownershipInfo.js +1 -1
  101. package/lib/chevre/repo/mongoose/schemas/place.d.ts +49 -3
  102. package/lib/chevre/repo/mongoose/schemas/priceSpecification.d.ts +29 -3
  103. package/lib/chevre/repo/mongoose/schemas/product.d.ts +31 -3
  104. package/lib/chevre/repo/mongoose/schemas/project.d.ts +23 -3
  105. package/lib/chevre/repo/mongoose/schemas/reservation.d.ts +63 -5
  106. package/lib/chevre/repo/mongoose/schemas/reservation.js +1 -1
  107. package/lib/chevre/repo/mongoose/schemas/role.d.ts +11 -3
  108. package/lib/chevre/repo/mongoose/schemas/seller.d.ts +31 -3
  109. package/lib/chevre/repo/mongoose/schemas/seller.js +6 -0
  110. package/lib/chevre/repo/mongoose/schemas/serviceOutput.d.ts +11 -3
  111. package/lib/chevre/repo/mongoose/schemas/serviceOutput.js +1 -1
  112. package/lib/chevre/repo/mongoose/schemas/task.d.ts +30 -3
  113. package/lib/chevre/repo/mongoose/schemas/task.js +2 -1
  114. package/lib/chevre/repo/mongoose/schemas/telemetry.d.ts +21 -3
  115. package/lib/chevre/repo/mongoose/schemas/transaction.d.ts +40 -3
  116. package/lib/chevre/repo/mongoose/schemas/transaction.js +2 -1
  117. package/lib/chevre/repo/mongoose/schemas/trip.d.ts +11 -3
  118. package/lib/chevre/repo/offer.js +3 -2
  119. package/lib/chevre/repo/offerCatalog.js +0 -27
  120. package/lib/chevre/repo/offerItemCondition.d.ts +22 -0
  121. package/lib/chevre/repo/offerItemCondition.js +121 -0
  122. package/lib/chevre/repo/order.d.ts +55 -3
  123. package/lib/chevre/repo/order.js +62 -10
  124. package/lib/chevre/repo/ownershipInfo.js +2 -7
  125. package/lib/chevre/repo/place.d.ts +20 -5
  126. package/lib/chevre/repo/place.js +63 -23
  127. package/lib/chevre/repo/priceSpecification.js +3 -2
  128. package/lib/chevre/repo/product.d.ts +1 -3
  129. package/lib/chevre/repo/product.js +25 -4
  130. package/lib/chevre/repo/project.js +2 -1
  131. package/lib/chevre/repo/reservation.d.ts +20 -4
  132. package/lib/chevre/repo/reservation.js +40 -59
  133. package/lib/chevre/repo/role.js +3 -2
  134. package/lib/chevre/repo/seller.d.ts +1 -1
  135. package/lib/chevre/repo/seller.js +44 -23
  136. package/lib/chevre/repo/serviceOutput.js +2 -1
  137. package/lib/chevre/repo/stockHolder.d.ts +139 -7
  138. package/lib/chevre/repo/stockHolder.js +569 -102
  139. package/lib/chevre/repo/task.d.ts +45 -2
  140. package/lib/chevre/repo/task.js +94 -15
  141. package/lib/chevre/repo/transaction.d.ts +21 -2
  142. package/lib/chevre/repo/transaction.js +171 -50
  143. package/lib/chevre/repo/trip.js +2 -1
  144. package/lib/chevre/repository.d.ts +5 -2
  145. package/lib/chevre/repository.js +8 -4
  146. package/lib/chevre/service/aggregation/event/aggregateScreeningEvent.js +6 -2
  147. package/lib/chevre/service/aggregation/event/aggregateUseActionsOnEvent.js +8 -6
  148. package/lib/chevre/service/aggregation/system.d.ts +110 -23
  149. package/lib/chevre/service/aggregation/system.js +213 -91
  150. package/lib/chevre/service/assetTransaction/cancelReservation.js +1 -28
  151. package/lib/chevre/service/assetTransaction/moneyTransfer.js +2 -24
  152. package/lib/chevre/service/assetTransaction/pay/account/validation.js +1 -1
  153. package/lib/chevre/service/assetTransaction/pay/potentialActions.js +17 -1
  154. package/lib/chevre/service/assetTransaction/pay.d.ts +5 -1
  155. package/lib/chevre/service/assetTransaction/pay.js +20 -34
  156. package/lib/chevre/service/assetTransaction/refund.js +2 -24
  157. package/lib/chevre/service/assetTransaction/registerService.js +1 -25
  158. package/lib/chevre/service/assetTransaction/reserve/factory.d.ts +15 -5
  159. package/lib/chevre/service/assetTransaction/reserve/factory.js +122 -58
  160. package/lib/chevre/service/assetTransaction/reserve.d.ts +10 -1
  161. package/lib/chevre/service/assetTransaction/reserve.js +92 -69
  162. package/lib/chevre/service/assetTransaction.d.ts +6 -0
  163. package/lib/chevre/service/assetTransaction.js +9 -4
  164. package/lib/chevre/service/event.js +25 -6
  165. package/lib/chevre/service/notification/factory.js +2 -2
  166. package/lib/chevre/service/notification.d.ts +3 -1
  167. package/lib/chevre/service/notification.js +41 -7
  168. package/lib/chevre/service/offer/event/authorize.d.ts +3 -0
  169. package/lib/chevre/service/offer/event/authorize.js +8 -2
  170. package/lib/chevre/service/offer/event/factory.d.ts +3 -0
  171. package/lib/chevre/service/offer/event/factory.js +16 -5
  172. package/lib/chevre/service/offer/event/importFromCOA.js +2 -2
  173. package/lib/chevre/service/offer/event/voidTransaction.d.ts +2 -0
  174. package/lib/chevre/service/offer/event/voidTransaction.js +17 -1
  175. package/lib/chevre/service/offer/eventServiceByCOA.js +7 -9
  176. package/lib/chevre/service/offer/product.js +2 -2
  177. package/lib/chevre/service/offer.d.ts +16 -8
  178. package/lib/chevre/service/offer.js +71 -8
  179. package/lib/chevre/service/order/deleteOrder.d.ts +3 -1
  180. package/lib/chevre/service/order/deleteOrder.js +8 -8
  181. package/lib/chevre/service/order/onOrderStatusChanged/factory.d.ts +5 -2
  182. package/lib/chevre/service/order/onOrderStatusChanged/factory.js +41 -81
  183. package/lib/chevre/service/order/onOrderStatusChanged.js +1 -3
  184. package/lib/chevre/service/order/onOrderUpdated.d.ts +16 -0
  185. package/lib/chevre/service/order/onOrderUpdated.js +22 -0
  186. package/lib/chevre/service/order/placeOrder.d.ts +1 -0
  187. package/lib/chevre/service/order/placeOrder.js +41 -24
  188. package/lib/chevre/service/order/returnOrder.d.ts +1 -0
  189. package/lib/chevre/service/order/returnOrder.js +7 -12
  190. package/lib/chevre/service/order/sendOrder.d.ts +1 -0
  191. package/lib/chevre/service/order/sendOrder.js +7 -10
  192. package/lib/chevre/service/order.d.ts +2 -1
  193. package/lib/chevre/service/order.js +3 -1
  194. package/lib/chevre/service/payment/any/onPaid.js +1 -1
  195. package/lib/chevre/service/payment/any/onRefund.js +1 -1
  196. package/lib/chevre/service/payment/any.d.ts +9 -5
  197. package/lib/chevre/service/payment/any.js +80 -18
  198. package/lib/chevre/service/payment/creditCard.d.ts +1 -1
  199. package/lib/chevre/service/payment/creditCard.js +23 -17
  200. package/lib/chevre/service/payment/movieTicket/checkByIdentifier.d.ts +8 -7
  201. package/lib/chevre/service/payment/movieTicket/factory.d.ts +1 -1
  202. package/lib/chevre/service/payment/movieTicket/getCredentials.d.ts +1 -1
  203. package/lib/chevre/service/payment/movieTicket/getCredentials.js +1 -1
  204. package/lib/chevre/service/payment/movieTicket/validation.d.ts +6 -6
  205. package/lib/chevre/service/payment/movieTicket/validation.js +55 -32
  206. package/lib/chevre/service/payment/movieTicket.d.ts +2 -2
  207. package/lib/chevre/service/payment/movieTicket.js +7 -6
  208. package/lib/chevre/service/product.js +1 -5
  209. package/lib/chevre/service/report/telemetry.d.ts +0 -11
  210. package/lib/chevre/service/report/telemetry.js +21 -24
  211. package/lib/chevre/service/reserve/cancelReservation.d.ts +5 -3
  212. package/lib/chevre/service/reserve/cancelReservation.js +162 -142
  213. package/lib/chevre/service/reserve/checkInReservation.d.ts +9 -4
  214. package/lib/chevre/service/reserve/checkInReservation.js +77 -3
  215. package/lib/chevre/service/reserve/confirmReservation.d.ts +7 -4
  216. package/lib/chevre/service/reserve/confirmReservation.js +133 -58
  217. package/lib/chevre/service/reserve/factory.d.ts +1 -1
  218. package/lib/chevre/service/reserve/potentialActions/onReservationCanceled.d.ts +17 -5
  219. package/lib/chevre/service/reserve/potentialActions/onReservationCanceled.js +26 -24
  220. package/lib/chevre/service/reserve/potentialActions/onReservationCheckedIn.js +2 -3
  221. package/lib/chevre/service/reserve/potentialActions/onReservationConfirmed.js +2 -31
  222. package/lib/chevre/service/reserve/potentialActions/onReservationUsed.js +2 -3
  223. package/lib/chevre/service/reserve/useReservation.d.ts +7 -3
  224. package/lib/chevre/service/reserve/useReservation.js +61 -71
  225. package/lib/chevre/service/reserve/verifyToken4reservation.d.ts +15 -0
  226. package/lib/chevre/service/reserve/verifyToken4reservation.js +56 -0
  227. package/lib/chevre/service/reserve.d.ts +3 -2
  228. package/lib/chevre/service/reserve.js +4 -2
  229. package/lib/chevre/service/task/aggregateScreeningEvent.js +1 -1
  230. package/lib/chevre/service/task/cancelPendingReservation.js +6 -2
  231. package/lib/chevre/service/task/cancelReservation.js +1 -1
  232. package/lib/chevre/service/task/confirmRegisterServiceTransaction.js +1 -1
  233. package/lib/chevre/service/task/deleteTransaction.js +10 -8
  234. package/lib/chevre/service/task/importOffersFromCOA.js +4 -0
  235. package/lib/chevre/service/task/onAuthorizationCreated.d.ts +7 -0
  236. package/lib/chevre/service/task/onAuthorizationCreated.js +108 -0
  237. package/lib/chevre/service/task/onEventChanged.d.ts +7 -0
  238. package/lib/chevre/service/task/{deleteOrder.js → onEventChanged.js} +8 -14
  239. package/lib/chevre/service/task/onResourceUpdated.d.ts +7 -0
  240. package/lib/chevre/service/task/onResourceUpdated.js +352 -0
  241. package/lib/chevre/service/task/placeOrder.js +1 -1
  242. package/lib/chevre/service/task/reserve.js +10 -7
  243. package/lib/chevre/service/task/returnOrder.js +1 -1
  244. package/lib/chevre/service/task/returnPayTransaction.js +2 -12
  245. package/lib/chevre/service/task/sendOrder.js +1 -1
  246. package/lib/chevre/service/task/useReservation.d.ts +7 -0
  247. package/lib/chevre/service/task/useReservation.js +36 -0
  248. package/lib/chevre/service/task/voidReserveTransaction.js +4 -2
  249. package/lib/chevre/service/task.d.ts +9 -0
  250. package/lib/chevre/service/task.js +43 -4
  251. package/lib/chevre/service/transaction/deleteTransaction.d.ts +21 -0
  252. package/lib/chevre/service/transaction/deleteTransaction.js +232 -0
  253. package/lib/chevre/service/transaction/moneyTransfer/exportTasks/factory.js +11 -1
  254. package/lib/chevre/service/transaction/moneyTransfer/factory.d.ts +1 -1
  255. package/lib/chevre/service/transaction/moneyTransfer/factory.js +3 -1
  256. package/lib/chevre/service/transaction/moneyTransfer/potentialActions.d.ts +1 -0
  257. package/lib/chevre/service/transaction/moneyTransfer/potentialActions.js +1 -1
  258. package/lib/chevre/service/transaction/moneyTransfer.js +10 -13
  259. package/lib/chevre/service/transaction/orderProgramMembership/findCreditCard.js +1 -1
  260. package/lib/chevre/service/transaction/orderProgramMembership/findPaymentCardPermit.js +1 -1
  261. package/lib/chevre/service/transaction/orderProgramMembership.js +7 -3
  262. package/lib/chevre/service/transaction/placeOrder/exportTasks/factory.js +42 -30
  263. package/lib/chevre/service/transaction/placeOrder.js +1 -5
  264. package/lib/chevre/service/transaction/placeOrderInProgress/factory.js +1 -1
  265. package/lib/chevre/service/transaction/placeOrderInProgress/potentialActions/moneyTransfer.d.ts +1 -0
  266. package/lib/chevre/service/transaction/placeOrderInProgress/potentialActions/moneyTransfer.js +1 -1
  267. package/lib/chevre/service/transaction/placeOrderInProgress/potentialActions/registerService.d.ts +1 -0
  268. package/lib/chevre/service/transaction/placeOrderInProgress/potentialActions/registerService.js +1 -1
  269. package/lib/chevre/service/transaction/placeOrderInProgress/potentialActions.d.ts +1 -0
  270. package/lib/chevre/service/transaction/placeOrderInProgress/result/acceptedOffers.d.ts +3 -0
  271. package/lib/chevre/service/transaction/placeOrderInProgress/result/acceptedOffers.js +7 -3
  272. package/lib/chevre/service/transaction/placeOrderInProgress/result.d.ts +1 -0
  273. package/lib/chevre/service/transaction/placeOrderInProgress/result.js +2 -2
  274. package/lib/chevre/service/transaction/placeOrderInProgress/validation/validateMovieTicket.d.ts +1 -1
  275. package/lib/chevre/service/transaction/placeOrderInProgress/validation/validateMovieTicket.js +2 -2
  276. package/lib/chevre/service/transaction/placeOrderInProgress/validation.d.ts +2 -1
  277. package/lib/chevre/service/transaction/placeOrderInProgress/validation.js +23 -17
  278. package/lib/chevre/service/transaction/placeOrderInProgress.d.ts +0 -3
  279. package/lib/chevre/service/transaction/placeOrderInProgress.js +28 -15
  280. package/lib/chevre/service/transaction/returnOrder/exportTasks/factory.js +10 -1
  281. package/lib/chevre/service/transaction/returnOrder/potentialActions/returnPaymentMethod.js +25 -17
  282. package/lib/chevre/service/transaction/returnOrder.d.ts +4 -0
  283. package/lib/chevre/service/transaction/returnOrder.js +228 -36
  284. package/lib/chevre/service/transaction.d.ts +7 -13
  285. package/lib/chevre/service/transaction.js +12 -139
  286. package/lib/chevre/settings.d.ts +13 -1
  287. package/lib/chevre/settings.js +56 -6
  288. package/package.json +5 -5
  289. package/example/src/chevre/createManyEventsIfNotExist.ts +0 -205
  290. package/example/src/chevre/eventCatalog2eventService.ts +0 -123
  291. package/example/src/chevre/migrateMoneyTransferPendingTransactionIdentifier.ts +0 -96
  292. package/example/src/chevre/migrateMovieAdditionalProperties.ts +0 -98
  293. package/example/src/chevre/migrateStockHolderKeys.ts +0 -89
  294. package/lib/chevre/service/task/deleteAssetTransaction.d.ts +0 -12
  295. package/lib/chevre/service/task/deleteAssetTransaction.js +0 -65
  296. package/lib/chevre/service/task/deleteOrder.d.ts +0 -6
@@ -13,6 +13,7 @@ exports.MongoRepository = void 0;
13
13
  const moment = require("moment");
14
14
  const accountTransaction_1 = require("./mongoose/schemas/accountTransaction");
15
15
  const factory = require("../factory");
16
+ const settings_1 = require("../settings");
16
17
  /**
17
18
  * 口座取引リポジトリ
18
19
  */
@@ -229,7 +230,7 @@ class MongoRepository {
229
230
  // ステータスと期限を見て更新
230
231
  yield this.transactionModel.updateMany({
231
232
  status: factory.transactionStatusType.InProgress,
232
- expires: { $lt: params.expires }
233
+ expires: { $lt: params.expires.$lt }
233
234
  }, {
234
235
  status: factory.transactionStatusType.Expired,
235
236
  endDate: new Date()
@@ -260,7 +261,7 @@ class MongoRepository {
260
261
  if (((_a = params.sort) === null || _a === void 0 ? void 0 : _a.startDate) !== undefined) {
261
262
  query.sort({ startDate: params.sort.startDate });
262
263
  }
263
- return query.setOptions({ maxTimeMS: 10000 })
264
+ return query.setOptions({ maxTimeMS: settings_1.MONGO_MAX_TIME_MS })
264
265
  .exec()
265
266
  .then((docs) => docs.map((doc) => doc.toObject()));
266
267
  });
@@ -82,7 +82,18 @@ export declare class MongoRepository {
82
82
  typeOf?: T;
83
83
  purpose: {
84
84
  typeOf: factory.transactionType;
85
- id?: string;
85
+ id: string;
86
+ };
87
+ object?: {
88
+ typeOf?: {
89
+ $eq?: factory.action.authorize.offer.seatReservation.ObjectType.SeatReservation | factory.action.authorize.paymentMethod.any.ResultType.Payment;
90
+ };
91
+ paymentMethodId?: {
92
+ $eq?: string;
93
+ };
94
+ };
95
+ actionStatus?: {
96
+ $eq?: factory.actionStatusType;
86
97
  };
87
98
  sort?: factory.action.ISortOrder;
88
99
  }): Promise<IAction<T>[]>;
@@ -122,6 +133,23 @@ export declare class MongoRepository {
122
133
  deleteEndDatePassedCertainPeriod(params: {
123
134
  $lt: Date;
124
135
  }): Promise<void>;
136
+ /**
137
+ * 取引からアクションを削除する
138
+ */
139
+ deleteByPurpose(params: {
140
+ project: {
141
+ id: string;
142
+ };
143
+ purpose: {
144
+ typeOf: factory.transactionType;
145
+ id: string;
146
+ };
147
+ typeOf: {
148
+ $in: factory.actionType[];
149
+ };
150
+ }): Promise<{
151
+ deletedCount?: number;
152
+ } | null>;
125
153
  aggregateAuthorizeEventServiceOfferAction(params: {
126
154
  project?: {
127
155
  id?: {
@@ -152,7 +180,19 @@ export declare class MongoRepository {
152
180
  startThrough: Date;
153
181
  typeOf: factory.actionType;
154
182
  }): Promise<IAggregateAction>;
155
- aggregateUseAction(params: {
183
+ aggregateCancelReservationAction(params: {
184
+ project?: {
185
+ id?: {
186
+ $ne?: string;
187
+ };
188
+ };
189
+ startFrom: Date;
190
+ startThrough: Date;
191
+ }): Promise<IAggregateAction>;
192
+ /**
193
+ * アクションタイプによる汎用的な集計
194
+ */
195
+ aggregateByTypeOf(params: {
156
196
  project?: {
157
197
  id?: {
158
198
  $ne?: string;
@@ -12,6 +12,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
12
12
  exports.MongoRepository = void 0;
13
13
  const factory = require("../factory");
14
14
  const action_1 = require("./mongoose/schemas/action");
15
+ const settings_1 = require("../settings");
15
16
  /**
16
17
  * アクションリポジトリ
17
18
  */
@@ -21,7 +22,7 @@ class MongoRepository {
21
22
  }
22
23
  // tslint:disable-next-line:cyclomatic-complexity max-func-body-length
23
24
  static CREATE_MONGO_CONDITIONS(params) {
24
- 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, _25, _26, _27, _28, _29, _30, _31, _32, _33, _34, _35, _36, _37, _38, _39, _40, _41, _42, _43, _44, _45, _46, _47, _48, _49, _50, _51, _52, _53;
25
+ 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, _25, _26, _27, _28, _29, _30, _31, _32, _33, _34, _35, _36, _37, _38, _39, _40, _41, _42, _43, _44, _45, _46, _47, _48, _49, _50, _51, _52, _53, _54, _55, _56, _57, _58, _59, _60, _61, _62, _63, _64, _65;
25
26
  const andConditions = [];
26
27
  const projectIdEq = (_b = (_a = params.project) === null || _a === void 0 ? void 0 : _a.id) === null || _b === void 0 ? void 0 : _b.$eq;
27
28
  // tslint:disable-next-line:no-single-line-block-comment
@@ -75,9 +76,27 @@ class MongoRepository {
75
76
  }
76
77
  });
77
78
  }
79
+ const objectMovieTicketsIdentifierEq = (_o = (_m = (_l = params.object) === null || _l === void 0 ? void 0 : _l.movieTickets) === null || _m === void 0 ? void 0 : _m.identifier) === null || _o === void 0 ? void 0 : _o.$eq;
80
+ if (typeof objectMovieTicketsIdentifierEq === 'string') {
81
+ andConditions.push({
82
+ 'object.movieTickets.identifier': {
83
+ $exists: true,
84
+ $eq: objectMovieTicketsIdentifierEq
85
+ }
86
+ });
87
+ }
88
+ const objectMovieTicketsServiceOutputReservationForIdEq = (_t = (_s = (_r = (_q = (_p = params.object) === null || _p === void 0 ? void 0 : _p.movieTickets) === null || _q === void 0 ? void 0 : _q.serviceOutput) === null || _r === void 0 ? void 0 : _r.reservationFor) === null || _s === void 0 ? void 0 : _s.id) === null || _t === void 0 ? void 0 : _t.$eq;
89
+ if (typeof objectMovieTicketsServiceOutputReservationForIdEq === 'string') {
90
+ andConditions.push({
91
+ 'object.movieTickets.serviceOutput.reservationFor.id': {
92
+ $exists: true,
93
+ $eq: objectMovieTicketsServiceOutputReservationForIdEq
94
+ }
95
+ });
96
+ }
78
97
  // tslint:disable-next-line:no-single-line-block-comment
79
98
  /* istanbul ignore else */
80
- const objectPaymentMethodIdEq = (_m = (_l = params.object) === null || _l === void 0 ? void 0 : _l.paymentMethodId) === null || _m === void 0 ? void 0 : _m.$eq;
99
+ const objectPaymentMethodIdEq = (_v = (_u = params.object) === null || _u === void 0 ? void 0 : _u.paymentMethodId) === null || _v === void 0 ? void 0 : _v.$eq;
81
100
  if (typeof objectPaymentMethodIdEq === 'string') {
82
101
  andConditions.push({
83
102
  'object.paymentMethodId': {
@@ -86,7 +105,7 @@ class MongoRepository {
86
105
  }
87
106
  });
88
107
  }
89
- const objectObjectPaymentMethodIdEq = (_q = (_p = (_o = params.object) === null || _o === void 0 ? void 0 : _o.object) === null || _p === void 0 ? void 0 : _p.paymentMethodId) === null || _q === void 0 ? void 0 : _q.$eq;
108
+ const objectObjectPaymentMethodIdEq = (_y = (_x = (_w = params.object) === null || _w === void 0 ? void 0 : _w.object) === null || _x === void 0 ? void 0 : _x.paymentMethodId) === null || _y === void 0 ? void 0 : _y.$eq;
90
109
  if (typeof objectObjectPaymentMethodIdEq === 'string') {
91
110
  andConditions.push({
92
111
  'object.object.paymentMethodId': {
@@ -95,7 +114,7 @@ class MongoRepository {
95
114
  }
96
115
  });
97
116
  }
98
- const objectReservationForIdEq = (_t = (_s = (_r = params.object) === null || _r === void 0 ? void 0 : _r.reservationFor) === null || _s === void 0 ? void 0 : _s.id) === null || _t === void 0 ? void 0 : _t.$eq;
117
+ const objectReservationForIdEq = (_1 = (_0 = (_z = params.object) === null || _z === void 0 ? void 0 : _z.reservationFor) === null || _0 === void 0 ? void 0 : _0.id) === null || _1 === void 0 ? void 0 : _1.$eq;
99
118
  // tslint:disable-next-line:no-single-line-block-comment
100
119
  /* istanbul ignore else */
101
120
  if (typeof objectReservationForIdEq === 'string') {
@@ -106,7 +125,25 @@ class MongoRepository {
106
125
  }
107
126
  });
108
127
  }
109
- const objectPaymentMethodAccountIdEq = (_w = (_v = (_u = params.object) === null || _u === void 0 ? void 0 : _u.paymentMethod) === null || _v === void 0 ? void 0 : _v.accountId) === null || _w === void 0 ? void 0 : _w.$eq;
128
+ const objectReservationNumberEq = (_3 = (_2 = params.object) === null || _2 === void 0 ? void 0 : _2.reservationNumber) === null || _3 === void 0 ? void 0 : _3.$eq;
129
+ if (typeof objectReservationNumberEq === 'string') {
130
+ andConditions.push({
131
+ 'object.reservationNumber': {
132
+ $exists: true,
133
+ $eq: objectReservationNumberEq
134
+ }
135
+ });
136
+ }
137
+ const objectReservationNumberIn = (_5 = (_4 = params.object) === null || _4 === void 0 ? void 0 : _4.reservationNumber) === null || _5 === void 0 ? void 0 : _5.$in;
138
+ if (Array.isArray(objectReservationNumberIn)) {
139
+ andConditions.push({
140
+ 'object.reservationNumber': {
141
+ $exists: true,
142
+ $in: objectReservationNumberIn
143
+ }
144
+ });
145
+ }
146
+ const objectPaymentMethodAccountIdEq = (_8 = (_7 = (_6 = params.object) === null || _6 === void 0 ? void 0 : _6.paymentMethod) === null || _7 === void 0 ? void 0 : _7.accountId) === null || _8 === void 0 ? void 0 : _8.$eq;
110
147
  // tslint:disable-next-line:no-single-line-block-comment
111
148
  /* istanbul ignore else */
112
149
  if (typeof objectPaymentMethodAccountIdEq === 'string') {
@@ -117,7 +154,7 @@ class MongoRepository {
117
154
  }
118
155
  });
119
156
  }
120
- const objectPaymentMethodPaymentMethodIdEq = (_z = (_y = (_x = params.object) === null || _x === void 0 ? void 0 : _x.paymentMethod) === null || _y === void 0 ? void 0 : _y.paymentMethodId) === null || _z === void 0 ? void 0 : _z.$eq;
157
+ const objectPaymentMethodPaymentMethodIdEq = (_11 = (_10 = (_9 = params.object) === null || _9 === void 0 ? void 0 : _9.paymentMethod) === null || _10 === void 0 ? void 0 : _10.paymentMethodId) === null || _11 === void 0 ? void 0 : _11.$eq;
121
158
  // tslint:disable-next-line:no-single-line-block-comment
122
159
  /* istanbul ignore else */
123
160
  if (typeof objectPaymentMethodPaymentMethodIdEq === 'string') {
@@ -128,7 +165,7 @@ class MongoRepository {
128
165
  }
129
166
  });
130
167
  }
131
- const objectPaymentMethodPaymentMethodIdIn = (_2 = (_1 = (_0 = params.object) === null || _0 === void 0 ? void 0 : _0.paymentMethod) === null || _1 === void 0 ? void 0 : _1.paymentMethodId) === null || _2 === void 0 ? void 0 : _2.$in;
168
+ const objectPaymentMethodPaymentMethodIdIn = (_14 = (_13 = (_12 = params.object) === null || _12 === void 0 ? void 0 : _12.paymentMethod) === null || _13 === void 0 ? void 0 : _13.paymentMethodId) === null || _14 === void 0 ? void 0 : _14.$in;
132
169
  if (Array.isArray(objectPaymentMethodPaymentMethodIdIn)) {
133
170
  andConditions.push({
134
171
  'object.paymentMethod.paymentMethodId': {
@@ -137,7 +174,7 @@ class MongoRepository {
137
174
  }
138
175
  });
139
176
  }
140
- const objectPaymentMethodTypeOfEq = (_5 = (_4 = (_3 = params.object) === null || _3 === void 0 ? void 0 : _3.paymentMethod) === null || _4 === void 0 ? void 0 : _4.typeOf) === null || _5 === void 0 ? void 0 : _5.$eq;
177
+ const objectPaymentMethodTypeOfEq = (_17 = (_16 = (_15 = params.object) === null || _15 === void 0 ? void 0 : _15.paymentMethod) === null || _16 === void 0 ? void 0 : _16.typeOf) === null || _17 === void 0 ? void 0 : _17.$eq;
141
178
  // tslint:disable-next-line:no-single-line-block-comment
142
179
  /* istanbul ignore else */
143
180
  if (typeof objectPaymentMethodTypeOfEq === 'string') {
@@ -148,7 +185,7 @@ class MongoRepository {
148
185
  }
149
186
  });
150
187
  }
151
- const objectTypeOfEq = (_7 = (_6 = params.object) === null || _6 === void 0 ? void 0 : _6.typeOf) === null || _7 === void 0 ? void 0 : _7.$eq;
188
+ const objectTypeOfEq = (_19 = (_18 = params.object) === null || _18 === void 0 ? void 0 : _18.typeOf) === null || _19 === void 0 ? void 0 : _19.$eq;
152
189
  // tslint:disable-next-line:no-single-line-block-comment
153
190
  /* istanbul ignore else */
154
191
  if (typeof objectTypeOfEq === 'string') {
@@ -159,7 +196,7 @@ class MongoRepository {
159
196
  }
160
197
  });
161
198
  }
162
- const objectTypeOfIn = (_9 = (_8 = params.object) === null || _8 === void 0 ? void 0 : _8.typeOf) === null || _9 === void 0 ? void 0 : _9.$in;
199
+ const objectTypeOfIn = (_21 = (_20 = params.object) === null || _20 === void 0 ? void 0 : _20.typeOf) === null || _21 === void 0 ? void 0 : _21.$in;
163
200
  if (Array.isArray(objectTypeOfIn)) {
164
201
  andConditions.push({
165
202
  'object.typeOf': {
@@ -168,7 +205,7 @@ class MongoRepository {
168
205
  }
169
206
  });
170
207
  }
171
- const objectIdEq = (_11 = (_10 = params.object) === null || _10 === void 0 ? void 0 : _10.id) === null || _11 === void 0 ? void 0 : _11.$eq;
208
+ const objectIdEq = (_23 = (_22 = params.object) === null || _22 === void 0 ? void 0 : _22.id) === null || _23 === void 0 ? void 0 : _23.$eq;
172
209
  // tslint:disable-next-line:no-single-line-block-comment
173
210
  /* istanbul ignore else */
174
211
  if (typeof objectIdEq === 'string') {
@@ -179,7 +216,7 @@ class MongoRepository {
179
216
  }
180
217
  });
181
218
  }
182
- const objectIdIn = (_13 = (_12 = params.object) === null || _12 === void 0 ? void 0 : _12.id) === null || _13 === void 0 ? void 0 : _13.$in;
219
+ const objectIdIn = (_25 = (_24 = params.object) === null || _24 === void 0 ? void 0 : _24.id) === null || _25 === void 0 ? void 0 : _25.$in;
183
220
  if (Array.isArray(objectIdIn)) {
184
221
  andConditions.push({
185
222
  'object.id': {
@@ -188,7 +225,7 @@ class MongoRepository {
188
225
  }
189
226
  });
190
227
  }
191
- const objectOrderNumberIn = (_15 = (_14 = params.object) === null || _14 === void 0 ? void 0 : _14.orderNumber) === null || _15 === void 0 ? void 0 : _15.$in;
228
+ const objectOrderNumberIn = (_27 = (_26 = params.object) === null || _26 === void 0 ? void 0 : _26.orderNumber) === null || _27 === void 0 ? void 0 : _27.$in;
192
229
  if (Array.isArray(objectOrderNumberIn)) {
193
230
  andConditions.push({
194
231
  'object.orderNumber': {
@@ -197,7 +234,7 @@ class MongoRepository {
197
234
  }
198
235
  });
199
236
  }
200
- const objectEventIdIn = (_18 = (_17 = (_16 = params.object) === null || _16 === void 0 ? void 0 : _16.event) === null || _17 === void 0 ? void 0 : _17.id) === null || _18 === void 0 ? void 0 : _18.$in;
237
+ const objectEventIdIn = (_30 = (_29 = (_28 = params.object) === null || _28 === void 0 ? void 0 : _28.event) === null || _29 === void 0 ? void 0 : _29.id) === null || _30 === void 0 ? void 0 : _30.$in;
201
238
  if (Array.isArray(objectEventIdIn)) {
202
239
  andConditions.push({
203
240
  'object.event.id': {
@@ -206,7 +243,7 @@ class MongoRepository {
206
243
  }
207
244
  });
208
245
  }
209
- const objectAcceptedOfferSeatNumberIn = (_25 = (_24 = (_23 = (_22 = (_21 = (_20 = (_19 = params.object) === null || _19 === void 0 ? void 0 : _19.acceptedOffer) === null || _20 === void 0 ? void 0 : _20.itemOffered) === null || _21 === void 0 ? void 0 : _21.serviceOutput) === null || _22 === void 0 ? void 0 : _22.reservedTicket) === null || _23 === void 0 ? void 0 : _23.ticketedSeat) === null || _24 === void 0 ? void 0 : _24.seatNumber) === null || _25 === void 0 ? void 0 : _25.$in;
246
+ const objectAcceptedOfferSeatNumberIn = (_37 = (_36 = (_35 = (_34 = (_33 = (_32 = (_31 = params.object) === null || _31 === void 0 ? void 0 : _31.acceptedOffer) === null || _32 === void 0 ? void 0 : _32.itemOffered) === null || _33 === void 0 ? void 0 : _33.serviceOutput) === null || _34 === void 0 ? void 0 : _34.reservedTicket) === null || _35 === void 0 ? void 0 : _35.ticketedSeat) === null || _36 === void 0 ? void 0 : _36.seatNumber) === null || _37 === void 0 ? void 0 : _37.$in;
210
247
  if (Array.isArray(objectAcceptedOfferSeatNumberIn)) {
211
248
  andConditions.push({
212
249
  'object.acceptedOffer.itemOffered.serviceOutput.reservedTicket.ticketedSeat.seatNumber': {
@@ -223,7 +260,7 @@ class MongoRepository {
223
260
  });
224
261
  }
225
262
  else {
226
- const typeOfEq = (_26 = params.typeOf) === null || _26 === void 0 ? void 0 : _26.$eq;
263
+ const typeOfEq = (_38 = params.typeOf) === null || _38 === void 0 ? void 0 : _38.$eq;
227
264
  // tslint:disable-next-line:no-single-line-block-comment
228
265
  /* istanbul ignore else */
229
266
  if (typeof typeOfEq === 'string') {
@@ -232,7 +269,7 @@ class MongoRepository {
232
269
  });
233
270
  }
234
271
  }
235
- const actionStatusIn = (_27 = params.actionStatus) === null || _27 === void 0 ? void 0 : _27.$in;
272
+ const actionStatusIn = (_39 = params.actionStatus) === null || _39 === void 0 ? void 0 : _39.$in;
236
273
  // tslint:disable-next-line:no-single-line-block-comment
237
274
  /* istanbul ignore else */
238
275
  if (Array.isArray(actionStatusIn)) {
@@ -263,7 +300,7 @@ class MongoRepository {
263
300
  startDate: { $lte: startDateLte }
264
301
  });
265
302
  }
266
- const fromLocationTypeOfIn = (_29 = (_28 = params.fromLocation) === null || _28 === void 0 ? void 0 : _28.typeOf) === null || _29 === void 0 ? void 0 : _29.$in;
303
+ const fromLocationTypeOfIn = (_41 = (_40 = params.fromLocation) === null || _40 === void 0 ? void 0 : _40.typeOf) === null || _41 === void 0 ? void 0 : _41.$in;
267
304
  if (Array.isArray(fromLocationTypeOfIn)) {
268
305
  andConditions.push({
269
306
  'fromLocation.typeOf': {
@@ -272,7 +309,7 @@ class MongoRepository {
272
309
  }
273
310
  });
274
311
  }
275
- const fromLocationAccountNumberIn = (_31 = (_30 = params.fromLocation) === null || _30 === void 0 ? void 0 : _30.accountNumber) === null || _31 === void 0 ? void 0 : _31.$in;
312
+ const fromLocationAccountNumberIn = (_43 = (_42 = params.fromLocation) === null || _42 === void 0 ? void 0 : _42.accountNumber) === null || _43 === void 0 ? void 0 : _43.$in;
276
313
  if (Array.isArray(fromLocationAccountNumberIn)) {
277
314
  andConditions.push({
278
315
  'fromLocation.accountNumber': {
@@ -281,7 +318,7 @@ class MongoRepository {
281
318
  }
282
319
  });
283
320
  }
284
- const fromLocationAccountTypeIn = (_33 = (_32 = params.fromLocation) === null || _32 === void 0 ? void 0 : _32.accountType) === null || _33 === void 0 ? void 0 : _33.$in;
321
+ const fromLocationAccountTypeIn = (_45 = (_44 = params.fromLocation) === null || _44 === void 0 ? void 0 : _44.accountType) === null || _45 === void 0 ? void 0 : _45.$in;
285
322
  if (Array.isArray(fromLocationAccountTypeIn)) {
286
323
  andConditions.push({
287
324
  'fromLocation.accountType': {
@@ -290,7 +327,7 @@ class MongoRepository {
290
327
  }
291
328
  });
292
329
  }
293
- const toLocationTypeOfIn = (_35 = (_34 = params.toLocation) === null || _34 === void 0 ? void 0 : _34.typeOf) === null || _35 === void 0 ? void 0 : _35.$in;
330
+ const toLocationTypeOfIn = (_47 = (_46 = params.toLocation) === null || _46 === void 0 ? void 0 : _46.typeOf) === null || _47 === void 0 ? void 0 : _47.$in;
294
331
  if (Array.isArray(toLocationTypeOfIn)) {
295
332
  andConditions.push({
296
333
  'toLocation.typeOf': {
@@ -299,7 +336,7 @@ class MongoRepository {
299
336
  }
300
337
  });
301
338
  }
302
- const toLocationAccountNumberIn = (_37 = (_36 = params.toLocation) === null || _36 === void 0 ? void 0 : _36.accountNumber) === null || _37 === void 0 ? void 0 : _37.$in;
339
+ const toLocationAccountNumberIn = (_49 = (_48 = params.toLocation) === null || _48 === void 0 ? void 0 : _48.accountNumber) === null || _49 === void 0 ? void 0 : _49.$in;
303
340
  if (Array.isArray(toLocationAccountNumberIn)) {
304
341
  andConditions.push({
305
342
  'toLocation.accountNumber': {
@@ -308,7 +345,7 @@ class MongoRepository {
308
345
  }
309
346
  });
310
347
  }
311
- const toLocationAccountTypeIn = (_39 = (_38 = params.toLocation) === null || _38 === void 0 ? void 0 : _38.accountType) === null || _39 === void 0 ? void 0 : _39.$in;
348
+ const toLocationAccountTypeIn = (_51 = (_50 = params.toLocation) === null || _50 === void 0 ? void 0 : _50.accountType) === null || _51 === void 0 ? void 0 : _51.$in;
312
349
  if (Array.isArray(toLocationAccountTypeIn)) {
313
350
  andConditions.push({
314
351
  'toLocation.accountType': {
@@ -317,7 +354,7 @@ class MongoRepository {
317
354
  }
318
355
  });
319
356
  }
320
- const purposeTypeOfIn = (_41 = (_40 = params.purpose) === null || _40 === void 0 ? void 0 : _40.typeOf) === null || _41 === void 0 ? void 0 : _41.$in;
357
+ const purposeTypeOfIn = (_53 = (_52 = params.purpose) === null || _52 === void 0 ? void 0 : _52.typeOf) === null || _53 === void 0 ? void 0 : _53.$in;
321
358
  if (Array.isArray(purposeTypeOfIn)) {
322
359
  andConditions.push({
323
360
  'purpose.typeOf': {
@@ -326,7 +363,7 @@ class MongoRepository {
326
363
  }
327
364
  });
328
365
  }
329
- const purposeIdIn = (_43 = (_42 = params.purpose) === null || _42 === void 0 ? void 0 : _42.id) === null || _43 === void 0 ? void 0 : _43.$in;
366
+ const purposeIdIn = (_55 = (_54 = params.purpose) === null || _54 === void 0 ? void 0 : _54.id) === null || _55 === void 0 ? void 0 : _55.$in;
330
367
  if (Array.isArray(purposeIdIn)) {
331
368
  andConditions.push({
332
369
  'purpose.id': {
@@ -335,7 +372,7 @@ class MongoRepository {
335
372
  }
336
373
  });
337
374
  }
338
- const purposeOrderNumberIn = (_45 = (_44 = params.purpose) === null || _44 === void 0 ? void 0 : _44.orderNumber) === null || _45 === void 0 ? void 0 : _45.$in;
375
+ const purposeOrderNumberIn = (_57 = (_56 = params.purpose) === null || _56 === void 0 ? void 0 : _56.orderNumber) === null || _57 === void 0 ? void 0 : _57.$in;
339
376
  if (Array.isArray(purposeOrderNumberIn)) {
340
377
  andConditions.push({
341
378
  'purpose.orderNumber': {
@@ -344,7 +381,7 @@ class MongoRepository {
344
381
  }
345
382
  });
346
383
  }
347
- const resultTypeOfIn = (_47 = (_46 = params.result) === null || _46 === void 0 ? void 0 : _46.typeOf) === null || _47 === void 0 ? void 0 : _47.$in;
384
+ const resultTypeOfIn = (_59 = (_58 = params.result) === null || _58 === void 0 ? void 0 : _58.typeOf) === null || _59 === void 0 ? void 0 : _59.$in;
348
385
  if (Array.isArray(resultTypeOfIn)) {
349
386
  andConditions.push({
350
387
  'result.typeOf': {
@@ -353,7 +390,7 @@ class MongoRepository {
353
390
  }
354
391
  });
355
392
  }
356
- const resultIdIn = (_49 = (_48 = params.result) === null || _48 === void 0 ? void 0 : _48.id) === null || _49 === void 0 ? void 0 : _49.$in;
393
+ const resultIdIn = (_61 = (_60 = params.result) === null || _60 === void 0 ? void 0 : _60.id) === null || _61 === void 0 ? void 0 : _61.$in;
357
394
  if (Array.isArray(resultIdIn)) {
358
395
  andConditions.push({
359
396
  'result.id': {
@@ -362,7 +399,7 @@ class MongoRepository {
362
399
  }
363
400
  });
364
401
  }
365
- const resultOrderNumberIn = (_51 = (_50 = params.result) === null || _50 === void 0 ? void 0 : _50.orderNumber) === null || _51 === void 0 ? void 0 : _51.$in;
402
+ const resultOrderNumberIn = (_63 = (_62 = params.result) === null || _62 === void 0 ? void 0 : _62.orderNumber) === null || _63 === void 0 ? void 0 : _63.$in;
366
403
  if (Array.isArray(resultOrderNumberIn)) {
367
404
  andConditions.push({
368
405
  'result.orderNumber': {
@@ -371,7 +408,7 @@ class MongoRepository {
371
408
  }
372
409
  });
373
410
  }
374
- const resultCodeIn = (_53 = (_52 = params.result) === null || _52 === void 0 ? void 0 : _52.code) === null || _53 === void 0 ? void 0 : _53.$in;
411
+ const resultCodeIn = (_65 = (_64 = params.result) === null || _64 === void 0 ? void 0 : _64.code) === null || _65 === void 0 ? void 0 : _65.$in;
375
412
  if (Array.isArray(resultCodeIn)) {
376
413
  andConditions.push({
377
414
  'result.code': {
@@ -420,7 +457,7 @@ class MongoRepository {
420
457
  }
421
458
  // const explainResult = await (<any>query).explain();
422
459
  // console.log(explainResult[0].executionStats.allPlansExecution.map((e: any) => e.executionStages.inputStage));
423
- return query.setOptions({ maxTimeMS: 10000 })
460
+ return query.setOptions({ maxTimeMS: settings_1.MONGO_MAX_TIME_MS })
424
461
  .exec()
425
462
  .then((docs) => docs.map((doc) => doc.toObject()));
426
463
  });
@@ -528,32 +565,16 @@ class MongoRepository {
528
565
  * 取引に対するアクション検索時などに使用
529
566
  */
530
567
  searchByPurpose(params) {
531
- var _a;
568
+ var _a, _b, _c, _d, _e, _f;
532
569
  return __awaiter(this, void 0, void 0, function* () {
533
- const conditions = {
534
- 'purpose.typeOf': {
535
- $exists: true,
536
- $eq: params.purpose.typeOf
537
- }
538
- };
539
- if (params.typeOf !== undefined) {
540
- conditions.typeOf = params.typeOf;
541
- }
542
- if (params.purpose.id !== undefined) {
543
- conditions['purpose.id'] = {
544
- $exists: true,
545
- $eq: params.purpose.id
546
- };
547
- }
548
- const query = this.actionModel.find(conditions)
549
- .select({ __v: 0, createdAt: 0, updatedAt: 0 });
550
- // tslint:disable-next-line:no-single-line-block-comment
551
- /* istanbul ignore else */
552
- if (((_a = params.sort) === null || _a === void 0 ? void 0 : _a.startDate) !== undefined) {
553
- query.sort({ startDate: params.sort.startDate });
554
- }
555
- return query.exec()
556
- .then((docs) => docs.map((doc) => doc.toObject()));
570
+ return this.search(Object.assign(Object.assign(Object.assign({ purpose: {
571
+ id: { $in: [params.purpose.id] },
572
+ typeOf: { $in: [params.purpose.typeOf] }
573
+ }, object: Object.assign(Object.assign({}, (typeof ((_b = (_a = params.object) === null || _a === void 0 ? void 0 : _a.typeOf) === null || _b === void 0 ? void 0 : _b.$eq) === 'string')
574
+ ? { typeOf: { $eq: params.object.typeOf.$eq } }
575
+ : undefined), (typeof ((_d = (_c = params.object) === null || _c === void 0 ? void 0 : _c.paymentMethodId) === null || _d === void 0 ? void 0 : _d.$eq) === 'string')
576
+ ? { paymentMethodId: { $eq: params.object.paymentMethodId.$eq } }
577
+ : undefined) }, (typeof ((_e = params.actionStatus) === null || _e === void 0 ? void 0 : _e.$eq) === 'string') ? { actionStatus: { $in: [params.actionStatus.$eq] } } : undefined), (typeof params.typeOf === 'string') ? { typeOf: { $eq: params.typeOf } } : undefined), (typeof ((_f = params.sort) === null || _f === void 0 ? void 0 : _f.startDate) === 'number') ? { sort: params.sort } : undefined), [], []);
557
578
  });
558
579
  }
559
580
  /**
@@ -691,6 +712,29 @@ class MongoRepository {
691
712
  .exec();
692
713
  });
693
714
  }
715
+ /**
716
+ * 取引からアクションを削除する
717
+ */
718
+ deleteByPurpose(params) {
719
+ return __awaiter(this, void 0, void 0, function* () {
720
+ return this.actionModel.deleteMany({
721
+ 'project.id': { $eq: params.project.id },
722
+ typeOf: { $in: params.typeOf.$in },
723
+ 'purpose.id': { $exists: true, $eq: params.purpose.id },
724
+ 'purpose.typeOf': { $exists: true, $eq: params.purpose.typeOf }
725
+ })
726
+ .exec()
727
+ .then((result) => {
728
+ return {
729
+ // n: result?.n,
730
+ // opTime: result.opTime,
731
+ // ok: result?.ok,
732
+ // operationTime,
733
+ deletedCount: result === null || result === void 0 ? void 0 : result.deletedCount
734
+ };
735
+ });
736
+ });
737
+ }
694
738
  aggregateAuthorizeEventServiceOfferAction(params) {
695
739
  return __awaiter(this, void 0, void 0, function* () {
696
740
  const statuses = yield Promise.all([
@@ -757,7 +801,36 @@ class MongoRepository {
757
801
  return { statuses };
758
802
  });
759
803
  }
760
- aggregateUseAction(params) {
804
+ aggregateCancelReservationAction(params) {
805
+ return __awaiter(this, void 0, void 0, function* () {
806
+ const statuses = yield Promise.all([
807
+ factory.actionStatusType.CompletedActionStatus,
808
+ factory.actionStatusType.CanceledActionStatus,
809
+ factory.actionStatusType.FailedActionStatus
810
+ ].map((actionStatus) => __awaiter(this, void 0, void 0, function* () {
811
+ var _a, _b;
812
+ const matchConditions = Object.assign({ startDate: {
813
+ $gte: params.startFrom,
814
+ $lte: params.startThrough
815
+ }, typeOf: { $eq: factory.actionType.CancelAction }, actionStatus: { $eq: actionStatus }, 'object.typeOf': {
816
+ $exists: true,
817
+ $in: [
818
+ factory.reservationType.BusReservation,
819
+ factory.reservationType.EventReservation,
820
+ factory.reservationType.ReservationPackage
821
+ ]
822
+ } }, (typeof ((_b = (_a = params.project) === null || _a === void 0 ? void 0 : _a.id) === null || _b === void 0 ? void 0 : _b.$ne) === 'string')
823
+ ? { 'project.id': { $ne: params.project.id.$ne } }
824
+ : undefined);
825
+ return this.agggregateByStatus({ matchConditions, actionStatus });
826
+ })));
827
+ return { statuses };
828
+ });
829
+ }
830
+ /**
831
+ * アクションタイプによる汎用的な集計
832
+ */
833
+ aggregateByTypeOf(params) {
761
834
  return __awaiter(this, void 0, void 0, function* () {
762
835
  const statuses = yield Promise.all([
763
836
  factory.actionStatusType.CompletedActionStatus,
@@ -23,6 +23,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
23
23
  exports.MongoRepository = void 0;
24
24
  const additionalProperty_1 = require("./mongoose/schemas/additionalProperty");
25
25
  const factory = require("../factory");
26
+ const settings_1 = require("../settings");
26
27
  /**
27
28
  * 追加特性リポジトリ
28
29
  */
@@ -145,7 +146,7 @@ class MongoRepository {
145
146
  if (params.sort !== undefined) {
146
147
  query.sort(params.sort);
147
148
  }
148
- return query.setOptions({ maxTimeMS: 10000 })
149
+ return query.setOptions({ maxTimeMS: settings_1.MONGO_MAX_TIME_MS })
149
150
  .exec()
150
151
  .then((docs) => docs.map((doc) => doc.toObject()));
151
152
  });
@@ -4,12 +4,15 @@ export declare enum AggregationType {
4
4
  AggregateAuthorizeEventServiceOfferAction = "AggregateAuthorizeEventServiceOfferAction",
5
5
  AggregateAuthorizeOrderAction = "AggregateAuthorizeOrderAction",
6
6
  AggregateAuthorizePaymentAction = "AggregateAuthorizePaymentAction",
7
+ AggregateCancelReservationAction = "AggregateCancelReservationAction",
7
8
  AggregateCheckMovieTicketAction = "AggregateCheckMovieTicketAction",
8
9
  AggregateEvent = "AggregateEvent",
10
+ AggregateOrderAction = "AggregateOrderAction",
9
11
  AggregatePay = "AggregatePay",
10
12
  AggregatePayMovieTicketAction = "AggregatePayMovieTicketAction",
11
13
  AggregatePlaceOrder = "AggregatePlaceOrder",
12
14
  AggregateReserve = "AggregateReserve",
15
+ AggregateReserveAction = "AggregateReserveAction",
13
16
  AggregateTask = "AggregateTask",
14
17
  AggregateUseAction = "AggregateUseAction"
15
18
  }
@@ -27,12 +27,15 @@ var AggregationType;
27
27
  AggregationType["AggregateAuthorizeEventServiceOfferAction"] = "AggregateAuthorizeEventServiceOfferAction";
28
28
  AggregationType["AggregateAuthorizeOrderAction"] = "AggregateAuthorizeOrderAction";
29
29
  AggregationType["AggregateAuthorizePaymentAction"] = "AggregateAuthorizePaymentAction";
30
+ AggregationType["AggregateCancelReservationAction"] = "AggregateCancelReservationAction";
30
31
  AggregationType["AggregateCheckMovieTicketAction"] = "AggregateCheckMovieTicketAction";
31
32
  AggregationType["AggregateEvent"] = "AggregateEvent";
33
+ AggregationType["AggregateOrderAction"] = "AggregateOrderAction";
32
34
  AggregationType["AggregatePay"] = "AggregatePay";
33
35
  AggregationType["AggregatePayMovieTicketAction"] = "AggregatePayMovieTicketAction";
34
36
  AggregationType["AggregatePlaceOrder"] = "AggregatePlaceOrder";
35
37
  AggregationType["AggregateReserve"] = "AggregateReserve";
38
+ AggregationType["AggregateReserveAction"] = "AggregateReserveAction";
36
39
  AggregationType["AggregateTask"] = "AggregateTask";
37
40
  AggregationType["AggregateUseAction"] = "AggregateUseAction";
38
41
  })(AggregationType = exports.AggregationType || (exports.AggregationType = {}));