@chevre/domain 21.2.0-alpha.12 → 21.2.0-alpha.120

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 (293) 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 +2 -1
  8. package/example/src/chevre/migrateOrderAdditionalProperties.ts +85 -0
  9. package/example/src/chevre/migrateScreeningEventSeriesVersion.ts +79 -0
  10. package/example/src/chevre/migrateStockHolderKeys.ts +1 -1
  11. package/example/src/chevre/processPay.ts +5 -1
  12. package/example/src/chevre/processRegisterMembership.ts +8 -4
  13. package/example/src/chevre/processRegisterPaymentCard.ts +8 -4
  14. package/example/src/chevre/processReserve.ts +5 -2
  15. package/example/src/chevre/saveTasks.ts +13 -10
  16. package/example/src/chevre/searchAbortedTasks.ts +36 -0
  17. package/example/src/chevre/searchActions.ts +33 -0
  18. package/example/src/chevre/searchEventSeats.ts +2 -1
  19. package/example/src/chevre/searchReservationNumbersByOrderNumbers.ts +37 -1
  20. package/example/src/chevre/searchSendEmailActions.ts +44 -0
  21. package/example/src/chevre/task/executeTasks.ts +26 -0
  22. package/example/src/chevre/transaction/findCreditCard.ts +1 -1
  23. package/example/src/chevre/transaction/orderMembershipService.ts +1 -1
  24. package/example/src/chevre/transaction/processReturnOrder.ts +40 -0
  25. package/example/src/chevre/transaction/startExportTasks.ts +20 -0
  26. package/example/src/chevre/updateScreeningRoom.ts +41 -0
  27. package/example/src/chevre/updateTransaction.ts +1 -1
  28. package/example/src/playOnMoment.ts +24 -0
  29. package/lib/chevre/credentials.d.ts +1 -0
  30. package/lib/chevre/credentials.js +2 -1
  31. package/lib/chevre/eventEmitter/assetTransaction.d.ts +21 -0
  32. package/lib/chevre/eventEmitter/assetTransaction.js +25 -0
  33. package/lib/chevre/eventEmitter/task.d.ts +18 -0
  34. package/lib/chevre/eventEmitter/task.js +25 -0
  35. package/lib/chevre/eventEmitter/transaction.d.ts +21 -0
  36. package/lib/chevre/eventEmitter/transaction.js +25 -0
  37. package/lib/chevre/eventEmitter.d.ts +4 -0
  38. package/lib/chevre/eventEmitter.js +9 -0
  39. package/lib/chevre/index.d.ts +3 -2
  40. package/lib/chevre/index.js +5 -3
  41. package/lib/chevre/repo/account.js +3 -2
  42. package/lib/chevre/repo/accountTransaction.d.ts +3 -11
  43. package/lib/chevre/repo/accountTransaction.js +3 -55
  44. package/lib/chevre/repo/action.d.ts +42 -2
  45. package/lib/chevre/repo/action.js +130 -57
  46. package/lib/chevre/repo/additionalProperty.js +2 -1
  47. package/lib/chevre/repo/aggregation.d.ts +3 -0
  48. package/lib/chevre/repo/aggregation.js +3 -0
  49. package/lib/chevre/repo/assetTransaction.d.ts +25 -9
  50. package/lib/chevre/repo/assetTransaction.js +259 -87
  51. package/lib/chevre/repo/categoryCode.d.ts +1 -1
  52. package/lib/chevre/repo/categoryCode.js +37 -25
  53. package/lib/chevre/repo/code.js +3 -2
  54. package/lib/chevre/repo/comment.d.ts +4 -1
  55. package/lib/chevre/repo/comment.js +22 -6
  56. package/lib/chevre/repo/confirmationNumber.d.ts +0 -1
  57. package/lib/chevre/repo/confirmationNumber.js +3 -15
  58. package/lib/chevre/repo/creativeWork.d.ts +2 -4
  59. package/lib/chevre/repo/creativeWork.js +35 -12
  60. package/lib/chevre/repo/customer.js +2 -1
  61. package/lib/chevre/repo/emailMessage.d.ts +1 -27
  62. package/lib/chevre/repo/emailMessage.js +2 -1
  63. package/lib/chevre/repo/event.d.ts +27 -1
  64. package/lib/chevre/repo/event.js +67 -33
  65. package/lib/chevre/repo/member.js +4 -3
  66. package/lib/chevre/repo/merchantReturnPolicy.d.ts +1 -3
  67. package/lib/chevre/repo/merchantReturnPolicy.js +2 -1
  68. package/lib/chevre/repo/mongoose/schemas/account.d.ts +4 -2
  69. package/lib/chevre/repo/mongoose/schemas/accountTitle.d.ts +29 -3
  70. package/lib/chevre/repo/mongoose/schemas/accountTransaction.d.ts +31 -3
  71. package/lib/chevre/repo/mongoose/schemas/accountTransaction.js +1 -1
  72. package/lib/chevre/repo/mongoose/schemas/accountingReport.d.ts +13 -3
  73. package/lib/chevre/repo/mongoose/schemas/action.d.ts +43 -3
  74. package/lib/chevre/repo/mongoose/schemas/action.js +19 -1
  75. package/lib/chevre/repo/mongoose/schemas/additionalProperty.d.ts +17 -3
  76. package/lib/chevre/repo/mongoose/schemas/aggregation.d.ts +4 -2
  77. package/lib/chevre/repo/mongoose/schemas/assetTransaction.d.ts +44 -3
  78. package/lib/chevre/repo/mongoose/schemas/assetTransaction.js +32 -19
  79. package/lib/chevre/repo/mongoose/schemas/authorization.d.ts +19 -3
  80. package/lib/chevre/repo/mongoose/schemas/authorization.js +1 -1
  81. package/lib/chevre/repo/mongoose/schemas/categoryCode.d.ts +25 -3
  82. package/lib/chevre/repo/mongoose/schemas/comments.d.ts +27 -3
  83. package/lib/chevre/repo/mongoose/schemas/comments.js +1 -1
  84. package/lib/chevre/repo/mongoose/schemas/creativeWork.d.ts +43 -3
  85. package/lib/chevre/repo/mongoose/schemas/customer.d.ts +25 -3
  86. package/lib/chevre/repo/mongoose/schemas/emailMessages.d.ts +21 -3
  87. package/lib/chevre/repo/mongoose/schemas/event.d.ts +71 -3
  88. package/lib/chevre/repo/mongoose/schemas/holdReservation.d.ts +75 -0
  89. package/lib/chevre/repo/mongoose/schemas/holdReservation.js +56 -0
  90. package/lib/chevre/repo/mongoose/schemas/member.d.ts +13 -3
  91. package/lib/chevre/repo/mongoose/schemas/merchantReturnPolicy.d.ts +21 -3
  92. package/lib/chevre/repo/mongoose/schemas/offer.d.ts +65 -3
  93. package/lib/chevre/repo/mongoose/schemas/offerCatalog.d.ts +27 -3
  94. package/lib/chevre/repo/mongoose/schemas/offerItemCondition.d.ts +74 -0
  95. package/lib/chevre/repo/mongoose/schemas/offerItemCondition.js +45 -0
  96. package/lib/chevre/repo/mongoose/schemas/order.d.ts +51 -3
  97. package/lib/chevre/repo/mongoose/schemas/order.js +1 -1
  98. package/lib/chevre/repo/mongoose/schemas/ownershipInfo.d.ts +25 -3
  99. package/lib/chevre/repo/mongoose/schemas/ownershipInfo.js +1 -1
  100. package/lib/chevre/repo/mongoose/schemas/place.d.ts +49 -3
  101. package/lib/chevre/repo/mongoose/schemas/priceSpecification.d.ts +29 -3
  102. package/lib/chevre/repo/mongoose/schemas/product.d.ts +31 -3
  103. package/lib/chevre/repo/mongoose/schemas/project.d.ts +23 -3
  104. package/lib/chevre/repo/mongoose/schemas/reservation.d.ts +63 -5
  105. package/lib/chevre/repo/mongoose/schemas/reservation.js +1 -1
  106. package/lib/chevre/repo/mongoose/schemas/role.d.ts +11 -3
  107. package/lib/chevre/repo/mongoose/schemas/seller.d.ts +31 -3
  108. package/lib/chevre/repo/mongoose/schemas/seller.js +6 -0
  109. package/lib/chevre/repo/mongoose/schemas/serviceOutput.d.ts +11 -3
  110. package/lib/chevre/repo/mongoose/schemas/serviceOutput.js +1 -1
  111. package/lib/chevre/repo/mongoose/schemas/task.d.ts +30 -3
  112. package/lib/chevre/repo/mongoose/schemas/task.js +2 -1
  113. package/lib/chevre/repo/mongoose/schemas/telemetry.d.ts +21 -3
  114. package/lib/chevre/repo/mongoose/schemas/transaction.d.ts +40 -3
  115. package/lib/chevre/repo/mongoose/schemas/transaction.js +2 -1
  116. package/lib/chevre/repo/mongoose/schemas/trip.d.ts +11 -3
  117. package/lib/chevre/repo/offer.js +3 -2
  118. package/lib/chevre/repo/offerCatalog.js +0 -27
  119. package/lib/chevre/repo/offerItemCondition.d.ts +22 -0
  120. package/lib/chevre/repo/offerItemCondition.js +121 -0
  121. package/lib/chevre/repo/order.d.ts +55 -3
  122. package/lib/chevre/repo/order.js +62 -10
  123. package/lib/chevre/repo/ownershipInfo.js +2 -7
  124. package/lib/chevre/repo/place.d.ts +20 -5
  125. package/lib/chevre/repo/place.js +63 -23
  126. package/lib/chevre/repo/priceSpecification.js +3 -2
  127. package/lib/chevre/repo/product.d.ts +1 -3
  128. package/lib/chevre/repo/product.js +25 -4
  129. package/lib/chevre/repo/project.js +2 -1
  130. package/lib/chevre/repo/reservation.d.ts +20 -4
  131. package/lib/chevre/repo/reservation.js +40 -59
  132. package/lib/chevre/repo/role.js +3 -2
  133. package/lib/chevre/repo/seller.d.ts +1 -1
  134. package/lib/chevre/repo/seller.js +44 -23
  135. package/lib/chevre/repo/serviceOutput.js +2 -1
  136. package/lib/chevre/repo/stockHolder.d.ts +35 -5
  137. package/lib/chevre/repo/stockHolder.js +306 -87
  138. package/lib/chevre/repo/task.d.ts +45 -2
  139. package/lib/chevre/repo/task.js +94 -15
  140. package/lib/chevre/repo/transaction.d.ts +23 -3
  141. package/lib/chevre/repo/transaction.js +177 -56
  142. package/lib/chevre/repo/trip.js +2 -1
  143. package/lib/chevre/repository.d.ts +5 -2
  144. package/lib/chevre/repository.js +8 -4
  145. package/lib/chevre/service/aggregation/event/aggregateUseActionsOnEvent.js +8 -6
  146. package/lib/chevre/service/aggregation/system.d.ts +110 -23
  147. package/lib/chevre/service/aggregation/system.js +213 -91
  148. package/lib/chevre/service/assetTransaction/cancelReservation.js +1 -28
  149. package/lib/chevre/service/assetTransaction/moneyTransfer.js +2 -24
  150. package/lib/chevre/service/assetTransaction/pay/account/validation.js +1 -1
  151. package/lib/chevre/service/assetTransaction/pay/potentialActions.js +17 -1
  152. package/lib/chevre/service/assetTransaction/pay.d.ts +5 -1
  153. package/lib/chevre/service/assetTransaction/pay.js +20 -34
  154. package/lib/chevre/service/assetTransaction/refund.js +2 -24
  155. package/lib/chevre/service/assetTransaction/registerService.js +1 -25
  156. package/lib/chevre/service/assetTransaction/reserve/factory.d.ts +15 -5
  157. package/lib/chevre/service/assetTransaction/reserve/factory.js +122 -58
  158. package/lib/chevre/service/assetTransaction/reserve.d.ts +10 -1
  159. package/lib/chevre/service/assetTransaction/reserve.js +85 -69
  160. package/lib/chevre/service/assetTransaction.d.ts +6 -0
  161. package/lib/chevre/service/assetTransaction.js +9 -4
  162. package/lib/chevre/service/event.js +16 -5
  163. package/lib/chevre/service/notification/factory.js +2 -2
  164. package/lib/chevre/service/notification.d.ts +3 -1
  165. package/lib/chevre/service/notification.js +41 -7
  166. package/lib/chevre/service/offer/event/authorize.d.ts +3 -0
  167. package/lib/chevre/service/offer/event/authorize.js +8 -2
  168. package/lib/chevre/service/offer/event/factory.d.ts +3 -0
  169. package/lib/chevre/service/offer/event/factory.js +16 -5
  170. package/lib/chevre/service/offer/event/importFromCOA.js +2 -2
  171. package/lib/chevre/service/offer/event/voidTransaction.d.ts +2 -0
  172. package/lib/chevre/service/offer/event/voidTransaction.js +17 -1
  173. package/lib/chevre/service/offer/eventServiceByCOA.js +7 -9
  174. package/lib/chevre/service/offer/product.js +2 -2
  175. package/lib/chevre/service/offer.d.ts +16 -8
  176. package/lib/chevre/service/offer.js +69 -8
  177. package/lib/chevre/service/order/deleteOrder.d.ts +3 -1
  178. package/lib/chevre/service/order/deleteOrder.js +8 -8
  179. package/lib/chevre/service/order/onOrderStatusChanged/factory.d.ts +5 -2
  180. package/lib/chevre/service/order/onOrderStatusChanged/factory.js +41 -81
  181. package/lib/chevre/service/order/onOrderStatusChanged.js +1 -3
  182. package/lib/chevre/service/order/onOrderUpdated.d.ts +16 -0
  183. package/lib/chevre/service/order/onOrderUpdated.js +22 -0
  184. package/lib/chevre/service/order/placeOrder.d.ts +1 -0
  185. package/lib/chevre/service/order/placeOrder.js +41 -24
  186. package/lib/chevre/service/order/returnOrder.d.ts +1 -0
  187. package/lib/chevre/service/order/returnOrder.js +7 -12
  188. package/lib/chevre/service/order/sendOrder.d.ts +1 -0
  189. package/lib/chevre/service/order/sendOrder.js +7 -10
  190. package/lib/chevre/service/order.d.ts +2 -1
  191. package/lib/chevre/service/order.js +3 -1
  192. package/lib/chevre/service/payment/any/onPaid.js +1 -1
  193. package/lib/chevre/service/payment/any/onRefund.js +1 -1
  194. package/lib/chevre/service/payment/any.d.ts +9 -5
  195. package/lib/chevre/service/payment/any.js +80 -18
  196. package/lib/chevre/service/payment/creditCard.d.ts +1 -1
  197. package/lib/chevre/service/payment/creditCard.js +23 -17
  198. package/lib/chevre/service/payment/movieTicket/checkByIdentifier.d.ts +8 -7
  199. package/lib/chevre/service/payment/movieTicket/factory.d.ts +1 -1
  200. package/lib/chevre/service/payment/movieTicket/getCredentials.d.ts +1 -1
  201. package/lib/chevre/service/payment/movieTicket/getCredentials.js +1 -1
  202. package/lib/chevre/service/payment/movieTicket/validation.d.ts +6 -6
  203. package/lib/chevre/service/payment/movieTicket/validation.js +55 -32
  204. package/lib/chevre/service/payment/movieTicket.d.ts +2 -2
  205. package/lib/chevre/service/payment/movieTicket.js +7 -6
  206. package/lib/chevre/service/product.js +1 -5
  207. package/lib/chevre/service/report/telemetry.d.ts +0 -11
  208. package/lib/chevre/service/report/telemetry.js +21 -24
  209. package/lib/chevre/service/reserve/cancelReservation.d.ts +5 -3
  210. package/lib/chevre/service/reserve/cancelReservation.js +147 -139
  211. package/lib/chevre/service/reserve/checkInReservation.d.ts +9 -4
  212. package/lib/chevre/service/reserve/checkInReservation.js +77 -3
  213. package/lib/chevre/service/reserve/confirmReservation.d.ts +7 -4
  214. package/lib/chevre/service/reserve/confirmReservation.js +133 -58
  215. package/lib/chevre/service/reserve/factory.d.ts +1 -1
  216. package/lib/chevre/service/reserve/potentialActions/onReservationCanceled.d.ts +17 -5
  217. package/lib/chevre/service/reserve/potentialActions/onReservationCanceled.js +26 -24
  218. package/lib/chevre/service/reserve/potentialActions/onReservationCheckedIn.js +2 -3
  219. package/lib/chevre/service/reserve/potentialActions/onReservationConfirmed.js +2 -31
  220. package/lib/chevre/service/reserve/potentialActions/onReservationUsed.js +2 -3
  221. package/lib/chevre/service/reserve/useReservation.d.ts +7 -3
  222. package/lib/chevre/service/reserve/useReservation.js +61 -71
  223. package/lib/chevre/service/reserve/verifyToken4reservation.d.ts +15 -0
  224. package/lib/chevre/service/reserve/verifyToken4reservation.js +56 -0
  225. package/lib/chevre/service/reserve.d.ts +3 -2
  226. package/lib/chevre/service/reserve.js +4 -2
  227. package/lib/chevre/service/task/aggregateScreeningEvent.js +1 -1
  228. package/lib/chevre/service/task/cancelPendingReservation.js +6 -2
  229. package/lib/chevre/service/task/cancelReservation.js +1 -1
  230. package/lib/chevre/service/task/confirmRegisterServiceTransaction.js +1 -1
  231. package/lib/chevre/service/task/deleteTransaction.js +10 -8
  232. package/lib/chevre/service/task/importOffersFromCOA.js +4 -0
  233. package/lib/chevre/service/task/onAuthorizationCreated.d.ts +7 -0
  234. package/lib/chevre/service/task/onAuthorizationCreated.js +108 -0
  235. package/lib/chevre/service/task/onEventChanged.d.ts +7 -0
  236. package/lib/chevre/service/task/{deleteOrder.js → onEventChanged.js} +8 -14
  237. package/lib/chevre/service/task/onResourceUpdated.d.ts +7 -0
  238. package/lib/chevre/service/task/onResourceUpdated.js +352 -0
  239. package/lib/chevre/service/task/placeOrder.js +1 -1
  240. package/lib/chevre/service/task/reserve.js +10 -7
  241. package/lib/chevre/service/task/returnOrder.js +1 -1
  242. package/lib/chevre/service/task/returnPayTransaction.js +2 -12
  243. package/lib/chevre/service/task/sendOrder.js +1 -1
  244. package/lib/chevre/service/task/useReservation.d.ts +7 -0
  245. package/lib/chevre/service/task/useReservation.js +36 -0
  246. package/lib/chevre/service/task/voidReserveTransaction.js +4 -2
  247. package/lib/chevre/service/task.d.ts +9 -0
  248. package/lib/chevre/service/task.js +43 -4
  249. package/lib/chevre/service/transaction/deleteTransaction.d.ts +21 -0
  250. package/lib/chevre/service/transaction/deleteTransaction.js +232 -0
  251. package/lib/chevre/service/transaction/moneyTransfer/exportTasks/factory.js +11 -1
  252. package/lib/chevre/service/transaction/moneyTransfer/factory.d.ts +1 -1
  253. package/lib/chevre/service/transaction/moneyTransfer/factory.js +3 -1
  254. package/lib/chevre/service/transaction/moneyTransfer/potentialActions.d.ts +1 -0
  255. package/lib/chevre/service/transaction/moneyTransfer/potentialActions.js +1 -1
  256. package/lib/chevre/service/transaction/moneyTransfer.js +10 -13
  257. package/lib/chevre/service/transaction/orderProgramMembership/findCreditCard.js +1 -1
  258. package/lib/chevre/service/transaction/orderProgramMembership/findPaymentCardPermit.js +1 -1
  259. package/lib/chevre/service/transaction/orderProgramMembership.js +7 -3
  260. package/lib/chevre/service/transaction/placeOrder/exportTasks/factory.js +42 -30
  261. package/lib/chevre/service/transaction/placeOrder.js +1 -5
  262. package/lib/chevre/service/transaction/placeOrderInProgress/factory.js +1 -1
  263. package/lib/chevre/service/transaction/placeOrderInProgress/potentialActions/moneyTransfer.d.ts +1 -0
  264. package/lib/chevre/service/transaction/placeOrderInProgress/potentialActions/moneyTransfer.js +1 -1
  265. package/lib/chevre/service/transaction/placeOrderInProgress/potentialActions/registerService.d.ts +1 -0
  266. package/lib/chevre/service/transaction/placeOrderInProgress/potentialActions/registerService.js +1 -1
  267. package/lib/chevre/service/transaction/placeOrderInProgress/potentialActions.d.ts +1 -0
  268. package/lib/chevre/service/transaction/placeOrderInProgress/result/acceptedOffers.d.ts +3 -0
  269. package/lib/chevre/service/transaction/placeOrderInProgress/result/acceptedOffers.js +7 -3
  270. package/lib/chevre/service/transaction/placeOrderInProgress/result.d.ts +1 -0
  271. package/lib/chevre/service/transaction/placeOrderInProgress/result.js +2 -2
  272. package/lib/chevre/service/transaction/placeOrderInProgress/validation/validateMovieTicket.d.ts +1 -1
  273. package/lib/chevre/service/transaction/placeOrderInProgress/validation/validateMovieTicket.js +2 -2
  274. package/lib/chevre/service/transaction/placeOrderInProgress/validation.d.ts +2 -1
  275. package/lib/chevre/service/transaction/placeOrderInProgress/validation.js +23 -17
  276. package/lib/chevre/service/transaction/placeOrderInProgress.d.ts +0 -3
  277. package/lib/chevre/service/transaction/placeOrderInProgress.js +28 -15
  278. package/lib/chevre/service/transaction/returnOrder/exportTasks/factory.js +10 -1
  279. package/lib/chevre/service/transaction/returnOrder/potentialActions/returnPaymentMethod.js +25 -17
  280. package/lib/chevre/service/transaction/returnOrder.d.ts +4 -0
  281. package/lib/chevre/service/transaction/returnOrder.js +228 -36
  282. package/lib/chevre/service/transaction.d.ts +8 -13
  283. package/lib/chevre/service/transaction.js +12 -145
  284. package/lib/chevre/settings.d.ts +12 -1
  285. package/lib/chevre/settings.js +53 -6
  286. package/package.json +5 -5
  287. package/example/src/chevre/createManyEventsIfNotExist.ts +0 -205
  288. package/example/src/chevre/eventCatalog2eventService.ts +0 -123
  289. package/example/src/chevre/migrateMoneyTransferPendingTransactionIdentifier.ts +0 -96
  290. package/example/src/chevre/migrateMovieAdditionalProperties.ts +0 -98
  291. package/lib/chevre/service/task/deleteAssetTransaction.d.ts +0 -12
  292. package/lib/chevre/service/task/deleteAssetTransaction.js +0 -65
  293. package/lib/chevre/service/task/deleteOrder.d.ts +0 -6
@@ -0,0 +1,22 @@
1
+ import { Connection } from 'mongoose';
2
+ import * as factory from '../factory';
3
+ interface IProjection {
4
+ [key: string]: 0 | 1;
5
+ }
6
+ /**
7
+ * アイテムコンディションリポジトリ
8
+ */
9
+ export declare class MongoRepository {
10
+ private readonly offerItemConditionModel;
11
+ constructor(connection: Connection);
12
+ static CREATE_MONGO_CONDITIONS(params: factory.offerItemCondition.ISearchConditions): any[];
13
+ findById(params: {
14
+ id: string;
15
+ }): Promise<factory.offerItemCondition.IOfferItemCondition>;
16
+ search(params: factory.offerItemCondition.ISearchConditions, projection?: IProjection): Promise<factory.offerItemCondition.IOfferItemCondition[]>;
17
+ save(params: factory.offerItemCondition.IOfferItemCondition): Promise<factory.offerItemCondition.IOfferItemCondition>;
18
+ deleteById(params: {
19
+ id: string;
20
+ }): Promise<void>;
21
+ }
22
+ export {};
@@ -0,0 +1,121 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ var __rest = (this && this.__rest) || function (s, e) {
12
+ var t = {};
13
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
14
+ t[p] = s[p];
15
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
16
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
17
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
18
+ t[p[i]] = s[p[i]];
19
+ }
20
+ return t;
21
+ };
22
+ Object.defineProperty(exports, "__esModule", { value: true });
23
+ exports.MongoRepository = void 0;
24
+ const factory = require("../factory");
25
+ const offerItemCondition_1 = require("./mongoose/schemas/offerItemCondition");
26
+ const settings_1 = require("../settings");
27
+ /**
28
+ * アイテムコンディションリポジトリ
29
+ */
30
+ class MongoRepository {
31
+ constructor(connection) {
32
+ this.offerItemConditionModel = connection.model(offerItemCondition_1.modelName, offerItemCondition_1.schema);
33
+ }
34
+ static CREATE_MONGO_CONDITIONS(params) {
35
+ var _a, _b, _c, _d, _e, _f;
36
+ const andConditions = [];
37
+ const projectIdEq = (_b = (_a = params.project) === null || _a === void 0 ? void 0 : _a.id) === null || _b === void 0 ? void 0 : _b.$eq;
38
+ if (typeof projectIdEq === 'string') {
39
+ andConditions.push({ 'project.id': { $eq: projectIdEq } });
40
+ }
41
+ const idEq = (_c = params.id) === null || _c === void 0 ? void 0 : _c.$eq;
42
+ if (typeof idEq === 'string') {
43
+ andConditions.push({ _id: { $eq: idEq } });
44
+ }
45
+ const idIn = (_d = params.id) === null || _d === void 0 ? void 0 : _d.$in;
46
+ if (Array.isArray(idIn)) {
47
+ andConditions.push({ _id: { $in: idIn } });
48
+ }
49
+ const identifierEq = (_e = params.identifier) === null || _e === void 0 ? void 0 : _e.$eq;
50
+ if (typeof identifierEq === 'string') {
51
+ andConditions.push({ identifier: { $eq: identifierEq } });
52
+ }
53
+ const identifierIn = (_f = params.identifier) === null || _f === void 0 ? void 0 : _f.$in;
54
+ if (Array.isArray(identifierIn)) {
55
+ andConditions.push({ identifier: { $in: identifierIn } });
56
+ }
57
+ return andConditions;
58
+ }
59
+ findById(params) {
60
+ return __awaiter(this, void 0, void 0, function* () {
61
+ const doc = yield this.offerItemConditionModel.findOne({ _id: params.id }, {
62
+ __v: 0,
63
+ createdAt: 0,
64
+ updatedAt: 0
65
+ })
66
+ .exec();
67
+ if (doc === null) {
68
+ throw new factory.errors.NotFound(this.offerItemConditionModel.modelName);
69
+ }
70
+ return doc.toObject();
71
+ });
72
+ }
73
+ search(params, projection) {
74
+ var _a;
75
+ return __awaiter(this, void 0, void 0, function* () {
76
+ const conditions = MongoRepository.CREATE_MONGO_CONDITIONS(params);
77
+ const positiveProjectionExists = (projection !== undefined && projection !== null)
78
+ ? Object.values(projection)
79
+ .some((value) => value !== 0)
80
+ : false;
81
+ const query = this.offerItemConditionModel.find((conditions.length > 0) ? { $and: conditions } : {}, (positiveProjectionExists)
82
+ ? projection
83
+ : Object.assign(Object.assign({}, projection), { __v: 0, createdAt: 0, updatedAt: 0 }));
84
+ if (typeof params.limit === 'number' && params.limit > 0) {
85
+ const page = (typeof params.page === 'number' && params.page > 0) ? params.page : 1;
86
+ query.limit(params.limit)
87
+ .skip(params.limit * (page - 1));
88
+ }
89
+ if (((_a = params.sort) === null || _a === void 0 ? void 0 : _a.identifier) !== undefined) {
90
+ query.sort({ identifier: params.sort.identifier });
91
+ }
92
+ return query.setOptions({ maxTimeMS: settings_1.MONGO_MAX_TIME_MS })
93
+ .exec()
94
+ .then((docs) => docs.map((doc) => doc.toObject()));
95
+ });
96
+ }
97
+ save(params) {
98
+ return __awaiter(this, void 0, void 0, function* () {
99
+ let doc;
100
+ if (params.id === '') {
101
+ doc = yield this.offerItemConditionModel.create(params);
102
+ }
103
+ else {
104
+ const { id, identifier, project, typeOf } = params, updateFields = __rest(params, ["id", "identifier", "project", "typeOf"]);
105
+ doc = yield this.offerItemConditionModel.findOneAndUpdate({ _id: params.id }, updateFields, { upsert: false, new: true })
106
+ .exec();
107
+ }
108
+ if (doc === null) {
109
+ throw new factory.errors.NotFound(this.offerItemConditionModel.modelName);
110
+ }
111
+ return doc.toObject();
112
+ });
113
+ }
114
+ deleteById(params) {
115
+ return __awaiter(this, void 0, void 0, function* () {
116
+ yield this.offerItemConditionModel.findOneAndRemove({ _id: params.id })
117
+ .exec();
118
+ });
119
+ }
120
+ }
121
+ exports.MongoRepository = MongoRepository;
@@ -1,3 +1,27 @@
1
+ /// <reference types="mongoose/types/aggregate" />
2
+ /// <reference types="mongoose/types/callback" />
3
+ /// <reference types="mongoose/types/collection" />
4
+ /// <reference types="mongoose/types/connection" />
5
+ /// <reference types="mongoose/types/cursor" />
6
+ /// <reference types="mongoose/types/document" />
7
+ /// <reference types="mongoose/types/error" />
8
+ /// <reference types="mongoose/types/expressions" />
9
+ /// <reference types="mongoose/types/helpers" />
10
+ /// <reference types="mongoose/types/middlewares" />
11
+ /// <reference types="mongoose/types/indexes" />
12
+ /// <reference types="mongoose/types/models" />
13
+ /// <reference types="mongoose/types/mongooseoptions" />
14
+ /// <reference types="mongoose/types/pipelinestage" />
15
+ /// <reference types="mongoose/types/populate" />
16
+ /// <reference types="mongoose/types/query" />
17
+ /// <reference types="mongoose/types/schemaoptions" />
18
+ /// <reference types="mongoose/types/schematypes" />
19
+ /// <reference types="mongoose/types/session" />
20
+ /// <reference types="mongoose/types/types" />
21
+ /// <reference types="mongoose/types/utility" />
22
+ /// <reference types="mongoose/types/validation" />
23
+ /// <reference types="mongoose/types/virtuals" />
24
+ /// <reference types="mongoose/types/inferschematype" />
1
25
  import { Connection } from 'mongoose';
2
26
  import * as factory from '../factory';
3
27
  /**
@@ -34,7 +58,9 @@ export declare class MongoRepository {
34
58
  additionalProperty?: factory.propertyValue.IPropertyValue<string>[];
35
59
  name?: string;
36
60
  orderNumber: string;
37
- }): Promise<void>;
61
+ }): Promise<{
62
+ updatedAt: Date;
63
+ }>;
38
64
  findById(params: {
39
65
  id: string;
40
66
  inclusion: string[];
@@ -62,7 +88,9 @@ export declare class MongoRepository {
62
88
  /**
63
89
  * 注文を検索する
64
90
  */
65
- search(params: factory.order.ISearchConditions, projection?: any): Promise<factory.order.IOrder[]>;
91
+ search(params: factory.order.ISearchConditions, projection?: {
92
+ [key: string]: 0 | 1;
93
+ }): Promise<factory.order.IOrder[]>;
66
94
  /**
67
95
  * 注文の受入オファーIDリストを検索する
68
96
  */
@@ -70,7 +98,11 @@ export declare class MongoRepository {
70
98
  /**
71
99
  * オファー展開の注文検索
72
100
  */
73
- searchWithUnwoundAcceptedOffer(params: factory.order.ISearchConditions, projection?: any): Promise<factory.order.IOrder[]>;
101
+ searchWithUnwoundAcceptedOffer(params: factory.order.ISearchConditions, projection?: {
102
+ [key: string]: any;
103
+ }): Promise<Omit<factory.order.IOrder[], 'acceptedOffers'> & {
104
+ acceptedOffers?: factory.order.IAcceptedOffer<factory.order.IItemOffered> | factory.order.IAcceptedOffer<factory.order.IItemOffered>[];
105
+ }>;
74
106
  /**
75
107
  * 特典口座情報が未保管であれば保管する
76
108
  */
@@ -86,4 +118,24 @@ export declare class MongoRepository {
86
118
  $in: string[];
87
119
  };
88
120
  }): Promise<(string)[]>;
121
+ /**
122
+ * 注文に含まれるイベントIDを検索する
123
+ */
124
+ searchReservationForIdsByOrderNumbers(params: {
125
+ orderNumber: {
126
+ $in: string[];
127
+ };
128
+ }): Promise<string[]>;
129
+ /**
130
+ * 注文に含まれるacceptedOffersを検索する
131
+ */
132
+ searchAcceptedOffersByOrderNumbers(params: {
133
+ orderNumber: {
134
+ $in: string[];
135
+ };
136
+ }): Promise<{
137
+ id: string;
138
+ priceSpecification: factory.order.ITicketPriceSpecification;
139
+ }[]>;
140
+ getCursor(conditions: any, projection: any): import("mongoose").Cursor<any, import("mongoose").QueryOptions<any>>;
89
141
  }
@@ -14,6 +14,7 @@ const factory = require("../factory");
14
14
  const order_1 = require("./mongoose/schemas/order");
15
15
  const errorHandler_1 = require("../errorHandler");
16
16
  const order_2 = require("../factory/order");
17
+ const settings_1 = require("../settings");
17
18
  /**
18
19
  * 注文リポジトリ
19
20
  */
@@ -779,14 +780,17 @@ class MongoRepository {
779
780
  const doc = yield this.orderModel.findOneAndUpdate({ orderNumber: { $eq: params.orderNumber } }, {
780
781
  $set: Object.assign(Object.assign({}, (Array.isArray(params.additionalProperty)) ? { additionalProperty: params.additionalProperty } : undefined), (typeof params.name === 'string') ? { name: params.name } : undefined)
781
782
  }, {
783
+ new: true,
782
784
  projection: {
783
- _id: 1
785
+ _id: 1,
786
+ updatedAt: 1
784
787
  }
785
788
  })
786
789
  .exec();
787
790
  if (doc === null) {
788
791
  throw new factory.errors.NotFound(this.orderModel.modelName);
789
792
  }
793
+ return { updatedAt: doc.updatedAt };
790
794
  });
791
795
  }
792
796
  findById(params) {
@@ -885,7 +889,7 @@ class MongoRepository {
885
889
  return __awaiter(this, void 0, void 0, function* () {
886
890
  const conditions = MongoRepository.CREATE_MONGO_CONDITIONS(params);
887
891
  return this.orderModel.countDocuments((conditions.length > 0) ? { $and: conditions } : {})
888
- .setOptions({ maxTimeMS: 10000 })
892
+ .setOptions({ maxTimeMS: settings_1.MONGO_MAX_TIME_MS })
889
893
  .exec();
890
894
  });
891
895
  }
@@ -896,8 +900,15 @@ class MongoRepository {
896
900
  var _a;
897
901
  return __awaiter(this, void 0, void 0, function* () {
898
902
  const conditions = MongoRepository.CREATE_MONGO_CONDITIONS(params);
903
+ const projectionSpecified = projection !== undefined && projection !== null;
904
+ const positiveProjectionExists = (projectionSpecified)
905
+ ? Object.values(projection)
906
+ .some((value) => value !== 0)
907
+ : false;
899
908
  const query = this.orderModel.find((conditions.length > 0) ? { $and: conditions } : {})
900
- .select(Object.assign({ __v: 0, createdAt: 0, updatedAt: 0 }, projection));
909
+ .select((projectionSpecified && positiveProjectionExists)
910
+ ? projection
911
+ : Object.assign({ __v: 0, createdAt: 0, updatedAt: 0 }, projection));
901
912
  if (typeof params.limit === 'number' && params.limit > 0) {
902
913
  const page = (typeof params.page === 'number' && params.page > 0) ? params.page : 1;
903
914
  query.limit(params.limit)
@@ -910,7 +921,7 @@ class MongoRepository {
910
921
  }
911
922
  // const explainResult = await (<any>query).explain();
912
923
  // console.log(explainResult[0].executionStats.allPlansExecution.map((e: any) => e.executionStages.inputStage));
913
- return query.setOptions({ maxTimeMS: 10000 })
924
+ return query.setOptions({ maxTimeMS: settings_1.MONGO_MAX_TIME_MS })
914
925
  .exec()
915
926
  .then((docs) => docs.map((doc) => doc.toObject()));
916
927
  });
@@ -925,7 +936,7 @@ class MongoRepository {
925
936
  .select({
926
937
  'acceptedOffers.id': 1
927
938
  });
928
- const orders = yield query.setOptions({ maxTimeMS: 10000 })
939
+ const orders = yield query.setOptions({ maxTimeMS: settings_1.MONGO_MAX_TIME_MS })
929
940
  .exec()
930
941
  .then((docs) => docs.map((doc) => {
931
942
  return doc.toObject();
@@ -975,7 +986,7 @@ class MongoRepository {
975
986
  .skip(params.limit * (page - 1));
976
987
  }
977
988
  return aggregate.allowDiskUse(true)
978
- .option({ maxTimeMS: 10000 })
989
+ .option({ maxTimeMS: settings_1.MONGO_MAX_TIME_MS })
979
990
  .exec();
980
991
  });
981
992
  }
@@ -1002,13 +1013,54 @@ class MongoRepository {
1002
1013
  if (!Array.isArray(params.orderNumber.$in) || params.orderNumber.$in.length === 0) {
1003
1014
  return [];
1004
1015
  }
1005
- const reservationNumbers = yield this.orderModel.distinct('acceptedOffers.itemOffered.reservationNumber', {
1006
- orderNumber: params.orderNumber.$in
1016
+ return this.orderModel.distinct('acceptedOffers.itemOffered.reservationNumber', {
1017
+ 'acceptedOffers.itemOffered.reservationNumber': { $exists: true },
1018
+ orderNumber: { $in: params.orderNumber.$in }
1007
1019
  })
1008
- .setOptions({ maxTimeMS: 10000 })
1020
+ .setOptions({ maxTimeMS: settings_1.MONGO_MAX_TIME_MS })
1009
1021
  .exec();
1010
- return [...new Set(reservationNumbers)];
1011
1022
  });
1012
1023
  }
1024
+ /**
1025
+ * 注文に含まれるイベントIDを検索する
1026
+ */
1027
+ searchReservationForIdsByOrderNumbers(params) {
1028
+ return __awaiter(this, void 0, void 0, function* () {
1029
+ if (!Array.isArray(params.orderNumber.$in) || params.orderNumber.$in.length === 0) {
1030
+ return [];
1031
+ }
1032
+ return this.orderModel.distinct('acceptedOffers.itemOffered.reservationFor.id', {
1033
+ 'acceptedOffers.itemOffered.reservationFor.id': { $exists: true },
1034
+ orderNumber: { $in: params.orderNumber.$in }
1035
+ })
1036
+ .setOptions({ maxTimeMS: settings_1.MONGO_MAX_TIME_MS })
1037
+ .exec();
1038
+ });
1039
+ }
1040
+ /**
1041
+ * 注文に含まれるacceptedOffersを検索する
1042
+ */
1043
+ searchAcceptedOffersByOrderNumbers(params) {
1044
+ return __awaiter(this, void 0, void 0, function* () {
1045
+ if (!Array.isArray(params.orderNumber.$in) || params.orderNumber.$in.length === 0) {
1046
+ return [];
1047
+ }
1048
+ const aggregate = this.orderModel.aggregate();
1049
+ aggregate.unwind('$acceptedOffers');
1050
+ aggregate.match({ orderNumber: { $in: params.orderNumber.$in } });
1051
+ aggregate.project({
1052
+ _id: 0,
1053
+ id: '$acceptedOffers.id',
1054
+ priceSpecification: '$acceptedOffers.priceSpecification'
1055
+ });
1056
+ return aggregate.option({ maxTimeMS: settings_1.MONGO_MAX_TIME_MS })
1057
+ .exec();
1058
+ });
1059
+ }
1060
+ getCursor(conditions, projection) {
1061
+ return this.orderModel.find(conditions, projection)
1062
+ .sort({ orderDate: factory.sortType.Descending })
1063
+ .cursor();
1064
+ }
1013
1065
  }
1014
1066
  exports.MongoRepository = MongoRepository;
@@ -14,6 +14,7 @@ const uuid = require("uuid");
14
14
  const ownershipInfo_1 = require("./mongoose/schemas/ownershipInfo");
15
15
  const errorHandler_1 = require("../errorHandler");
16
16
  const factory = require("../factory");
17
+ const settings_1 = require("../settings");
17
18
  /**
18
19
  * 所有権リポジトリ
19
20
  */
@@ -276,12 +277,6 @@ class MongoRepository {
276
277
  return doc.toObject();
277
278
  });
278
279
  }
279
- // public async count(params: factory.ownershipInfo.ISearchConditions): Promise<number> {
280
- // const conditions = MongoRepository.CREATE_MONGO_CONDITIONS(params);
281
- // return this.ownershipInfoModel.countDocuments((conditions.length > 0) ? { $and: conditions } : {})
282
- // .setOptions({ maxTimeMS: 10000 })
283
- // .exec();
284
- // }
285
280
  /**
286
281
  * 所有権を検索する
287
282
  */
@@ -300,7 +295,7 @@ class MongoRepository {
300
295
  if (((_a = params.sort) === null || _a === void 0 ? void 0 : _a.ownedFrom) !== undefined) {
301
296
  query.sort({ ownedFrom: params.sort.ownedFrom });
302
297
  }
303
- return query.setOptions({ maxTimeMS: 10000 })
298
+ return query.setOptions({ maxTimeMS: settings_1.MONGO_MAX_TIME_MS })
304
299
  .exec()
305
300
  .then((docs) => docs.map((doc) => doc.toObject()));
306
301
  });
@@ -37,7 +37,7 @@ export declare class MongoRepository {
37
37
  /**
38
38
  * 施設を保管する
39
39
  */
40
- saveMovieTheater(params: factory.place.movieTheater.IPlace): Promise<factory.place.movieTheater.IPlace>;
40
+ saveMovieTheater(params: factory.place.movieTheater.IPlaceWithoutScreeningRoom): Promise<factory.place.movieTheater.IPlaceWithoutScreeningRoom>;
41
41
  saveMovieTheaterByBranchCode4coa(params: factory.place.movieTheater.IPlace): Promise<factory.place.movieTheater.IPlace>;
42
42
  findMovieTheaterByBranchCode(params: {
43
43
  project: {
@@ -58,12 +58,22 @@ export declare class MongoRepository {
58
58
  */
59
59
  findById(params: {
60
60
  id: string;
61
- }, projection?: any): Promise<factory.place.movieTheater.IPlace>;
61
+ }, inclusion: string[], exclusion: string[]): Promise<factory.place.movieTheater.IPlace>;
62
62
  deleteMovieTheaterById(params: {
63
63
  id: string;
64
64
  }): Promise<void>;
65
- createScreeningRoom(screeningRoom: factory.place.screeningRoom.IPlace): Promise<void>;
66
- updateScreeningRoom(screeningRoom: factory.place.screeningRoom.IPlace, $unset: any): Promise<void>;
65
+ createScreeningRoom(screeningRoom: Omit<factory.place.screeningRoom.IPlace, 'containsPlace'>): Promise<{
66
+ /**
67
+ * 施設ID
68
+ */
69
+ id: string;
70
+ }>;
71
+ updateScreeningRoom(screeningRoom: Omit<factory.place.screeningRoom.IPlace, 'containsPlace'>, $unset: any): Promise<{
72
+ /**
73
+ * 施設ID
74
+ */
75
+ id: string;
76
+ }>;
67
77
  deleteScreeningRoom(screeningRoom: {
68
78
  project: {
69
79
  id: string;
@@ -78,7 +88,12 @@ export declare class MongoRepository {
78
88
  */
79
89
  branchCode: string;
80
90
  };
81
- }): Promise<void>;
91
+ }): Promise<{
92
+ /**
93
+ * 施設ID
94
+ */
95
+ id: string;
96
+ }>;
82
97
  createScreeningRoomSection(screeningRoomSection: IScreeningRoomSectionWithoutContainsPlace): Promise<void>;
83
98
  updateScreeningRoomSection(screeningRoomSection: factory.place.screeningRoomSection.IPlace, $unset: any): Promise<void>;
84
99
  searchScreeningRoomSections(searchConditions: factory.place.screeningRoomSection.ISearchConditions & {
@@ -24,6 +24,7 @@ exports.MongoRepository = void 0;
24
24
  const mongoose_1 = require("mongoose");
25
25
  const place_1 = require("./mongoose/schemas/place");
26
26
  const factory = require("../factory");
27
+ const settings_1 = require("../settings");
27
28
  /**
28
29
  * 施設リポジトリ
29
30
  */
@@ -220,7 +221,16 @@ class MongoRepository {
220
221
  else {
221
222
  // 上書き禁止属性を除外(2022-08-24~)
222
223
  const { id, branchCode, project, typeOf } = params, updateFields = __rest(params, ["id", "branchCode", "project", "typeOf"]);
223
- doc = yield this.placeModel.findOneAndUpdate({ _id: params.id }, updateFields, { upsert: false, new: true })
224
+ doc = yield this.placeModel.findOneAndUpdate({ _id: params.id }, updateFields, {
225
+ upsert: false,
226
+ new: true,
227
+ projection: {
228
+ __v: 0,
229
+ createdAt: 0,
230
+ updatedAt: 0,
231
+ containsPlace: 0
232
+ }
233
+ })
224
234
  .exec();
225
235
  }
226
236
  if (doc === null) {
@@ -283,7 +293,7 @@ class MongoRepository {
283
293
  if (((_a = params.sort) === null || _a === void 0 ? void 0 : _a.branchCode) !== undefined) {
284
294
  query.sort({ branchCode: params.sort.branchCode });
285
295
  }
286
- return query.setOptions({ maxTimeMS: 10000 })
296
+ return query.setOptions({ maxTimeMS: settings_1.MONGO_MAX_TIME_MS })
287
297
  .exec()
288
298
  .then((docs) => docs.map((doc) => doc.toObject()));
289
299
  });
@@ -291,12 +301,32 @@ class MongoRepository {
291
301
  /**
292
302
  * 施設取得
293
303
  */
294
- findById(params, projection) {
304
+ findById(params,
305
+ // projection?: any
306
+ inclusion, exclusion) {
295
307
  return __awaiter(this, void 0, void 0, function* () {
308
+ let projection = {};
309
+ if (Array.isArray(inclusion) && inclusion.length > 0) {
310
+ inclusion.forEach((field) => {
311
+ projection[field] = 1;
312
+ });
313
+ }
314
+ else {
315
+ projection = {
316
+ __v: 0,
317
+ createdAt: 0,
318
+ updatedAt: 0
319
+ };
320
+ if (Array.isArray(exclusion) && exclusion.length > 0) {
321
+ exclusion.forEach((field) => {
322
+ projection[field] = 0;
323
+ });
324
+ }
325
+ }
296
326
  const doc = yield this.placeModel.findOne({
297
327
  typeOf: { $eq: factory.placeType.MovieTheater },
298
328
  _id: { $eq: params.id }
299
- }, Object.assign({ __v: 0, createdAt: 0, updatedAt: 0 }, projection))
329
+ }, projection)
300
330
  .exec();
301
331
  if (doc === null) {
302
332
  throw new factory.errors.NotFound(this.placeModel.modelName);
@@ -359,6 +389,7 @@ class MongoRepository {
359
389
  if (doc === null) {
360
390
  throw new factory.errors.AlreadyInUse(factory.placeType.ScreeningRoom, ['branchCode']);
361
391
  }
392
+ return doc.toObject();
362
393
  });
363
394
  }
364
395
  updateScreeningRoom(screeningRoom, $unset) {
@@ -390,6 +421,7 @@ class MongoRepository {
390
421
  if (doc === null) {
391
422
  throw new factory.errors.NotFound(factory.placeType.ScreeningRoom);
392
423
  }
424
+ return doc.toObject();
393
425
  });
394
426
  }
395
427
  deleteScreeningRoom(screeningRoom) {
@@ -402,11 +434,16 @@ class MongoRepository {
402
434
  $pull: {
403
435
  containsPlace: { branchCode: screeningRoom.branchCode }
404
436
  }
437
+ }, {
438
+ projection: {
439
+ _id: 1
440
+ }
405
441
  })
406
442
  .exec();
407
443
  if (doc === null) {
408
444
  throw new factory.errors.NotFound(factory.placeType.ScreeningRoom);
409
445
  }
446
+ return doc.toObject();
410
447
  });
411
448
  }
412
449
  createScreeningRoomSection(screeningRoomSection) {
@@ -659,7 +696,7 @@ class MongoRepository {
659
696
  }
660
697
  // tslint:disable-next-line:max-func-body-length
661
698
  searchScreeningRooms(searchConditions) {
662
- var _a, _b, _c, _d, _e, _f, _g, _h, _j;
699
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
663
700
  return __awaiter(this, void 0, void 0, function* () {
664
701
  const matchStages = [{ $match: { typeOf: { $eq: factory.placeType.MovieTheater } } }];
665
702
  const projectIdEq = (_b = (_a = searchConditions.project) === null || _a === void 0 ? void 0 : _a.id) === null || _b === void 0 ? void 0 : _b.$eq;
@@ -692,20 +729,23 @@ class MongoRepository {
692
729
  }
693
730
  }
694
731
  }
695
- // ルームコード
696
- if (searchConditions.branchCode !== undefined) {
697
- if (typeof searchConditions.branchCode.$eq === 'string') {
698
- matchStages.push({
699
- $match: {
700
- 'containsPlace.branchCode': {
701
- $exists: true,
702
- $eq: searchConditions.branchCode.$eq
703
- }
704
- }
705
- });
706
- }
732
+ const branchCodeEq = (_e = searchConditions.branchCode) === null || _e === void 0 ? void 0 : _e.$eq;
733
+ if (typeof branchCodeEq === 'string') {
734
+ matchStages.push({
735
+ $match: {
736
+ 'containsPlace.branchCode': { $exists: true, $eq: branchCodeEq }
737
+ }
738
+ });
739
+ }
740
+ const branchCodeIn = (_f = searchConditions.branchCode) === null || _f === void 0 ? void 0 : _f.$in;
741
+ if (Array.isArray(branchCodeIn)) {
742
+ matchStages.push({
743
+ $match: {
744
+ 'containsPlace.branchCode': { $exists: true, $in: branchCodeIn }
745
+ }
746
+ });
707
747
  }
708
- const branchCodeRegex = (_e = searchConditions.branchCode) === null || _e === void 0 ? void 0 : _e.$regex;
748
+ const branchCodeRegex = (_g = searchConditions.branchCode) === null || _g === void 0 ? void 0 : _g.$regex;
709
749
  if (typeof branchCodeRegex === 'string') {
710
750
  matchStages.push({
711
751
  $match: {
@@ -716,7 +756,7 @@ class MongoRepository {
716
756
  }
717
757
  });
718
758
  }
719
- const nameCodeRegex = (_f = searchConditions.name) === null || _f === void 0 ? void 0 : _f.$regex;
759
+ const nameCodeRegex = (_h = searchConditions.name) === null || _h === void 0 ? void 0 : _h.$regex;
720
760
  if (typeof nameCodeRegex === 'string') {
721
761
  matchStages.push({
722
762
  $match: {
@@ -748,7 +788,7 @@ class MongoRepository {
748
788
  }
749
789
  });
750
790
  }
751
- const additionalPropertyElemMatch = (_g = searchConditions.additionalProperty) === null || _g === void 0 ? void 0 : _g.$elemMatch;
791
+ const additionalPropertyElemMatch = (_j = searchConditions.additionalProperty) === null || _j === void 0 ? void 0 : _j.$elemMatch;
752
792
  if (additionalPropertyElemMatch !== undefined && additionalPropertyElemMatch !== null) {
753
793
  matchStages.push({
754
794
  $match: {
@@ -768,7 +808,7 @@ class MongoRepository {
768
808
  typeOf: '$typeOf',
769
809
  branchCode: '$branchCode',
770
810
  name: '$name'
771
- }, openSeatingAllowed: '$containsPlace.openSeatingAllowed', additionalProperty: '$containsPlace.additionalProperty' }, (((_h = searchConditions.$projection) === null || _h === void 0 ? void 0 : _h.sectionCount) === 1)
811
+ }, openSeatingAllowed: '$containsPlace.openSeatingAllowed', additionalProperty: '$containsPlace.additionalProperty' }, (((_k = searchConditions.$projection) === null || _k === void 0 ? void 0 : _k.sectionCount) === 1)
772
812
  ? {
773
813
  sectionCount: {
774
814
  $cond: {
@@ -778,7 +818,7 @@ class MongoRepository {
778
818
  }
779
819
  }
780
820
  }
781
- : undefined), (((_j = searchConditions.$projection) === null || _j === void 0 ? void 0 : _j.seatCount) === 1)
821
+ : undefined), (((_l = searchConditions.$projection) === null || _l === void 0 ? void 0 : _l.seatCount) === 1)
782
822
  ? {
783
823
  seatCount: {
784
824
  $sum: {
@@ -1235,7 +1275,7 @@ class MongoRepository {
1235
1275
  if (((_a = params.sort) === null || _a === void 0 ? void 0 : _a.branchCode) !== undefined) {
1236
1276
  query.sort({ branchCode: params.sort.branchCode });
1237
1277
  }
1238
- return query.setOptions({ maxTimeMS: 10000 })
1278
+ return query.setOptions({ maxTimeMS: settings_1.MONGO_MAX_TIME_MS })
1239
1279
  .exec()
1240
1280
  .then((docs) => docs.map((doc) => doc.toObject()));
1241
1281
  });
@@ -23,6 +23,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
23
23
  exports.MongoRepository = void 0;
24
24
  const factory = require("../factory");
25
25
  const priceSpecification_1 = require("./mongoose/schemas/priceSpecification");
26
+ const settings_1 = require("../settings");
26
27
  /**
27
28
  * 価格仕様リポジトリ
28
29
  */
@@ -156,7 +157,7 @@ class MongoRepository {
156
157
  return __awaiter(this, void 0, void 0, function* () {
157
158
  const conditions = MongoRepository.CREATE_MONGO_CONDITIONS(params);
158
159
  return this.priceSpecificationModel.countDocuments((conditions.length > 0) ? { $and: conditions } : {})
159
- .setOptions({ maxTimeMS: 10000 })
160
+ .setOptions({ maxTimeMS: settings_1.MONGO_MAX_TIME_MS })
160
161
  .exec();
161
162
  });
162
163
  }
@@ -182,7 +183,7 @@ class MongoRepository {
182
183
  // const explainResult = await (<any>query).explain();
183
184
  // console.log(explainResult[0].executionStats.allPlansExecution.map((e: any) => e.executionStages.inputStage));
184
185
  // return;
185
- return query.setOptions({ maxTimeMS: 10000 })
186
+ return query.setOptions({ maxTimeMS: settings_1.MONGO_MAX_TIME_MS })
186
187
  .exec()
187
188
  .then((docs) => docs.map((doc) => doc.toObject()));
188
189
  });