@chevre/domain 21.2.0-alpha.10 → 21.2.0-alpha.101

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 (257) hide show
  1. package/example/src/chevre/aggregation/aggregateSystem.ts +58 -31
  2. package/example/src/chevre/createManyEventsIfNotExist.ts +4 -1
  3. package/example/src/chevre/deleteTasksByName.ts +10 -2
  4. package/example/src/chevre/importEventsFromCOA.ts +3 -4
  5. package/example/src/chevre/migrateOrderAdditionalProperties.ts +85 -0
  6. package/example/src/chevre/processPay.ts +5 -1
  7. package/example/src/chevre/processReserve.ts +4 -1
  8. package/example/src/chevre/saveTasks.ts +13 -10
  9. package/example/src/chevre/searchAbortedTasks.ts +36 -0
  10. package/example/src/chevre/searchActions.ts +33 -0
  11. package/example/src/chevre/searchReservationNumbersByOrderNumbers.ts +37 -1
  12. package/example/src/chevre/searchSendEmailActions.ts +44 -0
  13. package/example/src/chevre/task/executeTasks.ts +26 -0
  14. package/example/src/chevre/transaction/findCreditCard.ts +1 -1
  15. package/example/src/chevre/transaction/orderMembershipService.ts +1 -1
  16. package/example/src/chevre/transaction/processReturnOrder.ts +40 -0
  17. package/example/src/chevre/transaction/startExportTasks.ts +20 -0
  18. package/example/src/chevre/updateTransaction.ts +1 -1
  19. package/example/src/playOnMoment.ts +24 -0
  20. package/lib/chevre/credentials.d.ts +1 -0
  21. package/lib/chevre/credentials.js +2 -1
  22. package/lib/chevre/eventEmitter/assetTransaction.d.ts +21 -0
  23. package/lib/chevre/eventEmitter/assetTransaction.js +25 -0
  24. package/lib/chevre/eventEmitter/task.d.ts +18 -0
  25. package/lib/chevre/eventEmitter/task.js +25 -0
  26. package/lib/chevre/eventEmitter/transaction.d.ts +21 -0
  27. package/lib/chevre/eventEmitter/transaction.js +25 -0
  28. package/lib/chevre/eventEmitter.d.ts +4 -0
  29. package/lib/chevre/eventEmitter.js +9 -0
  30. package/lib/chevre/index.d.ts +3 -2
  31. package/lib/chevre/index.js +5 -3
  32. package/lib/chevre/repo/account.js +3 -2
  33. package/lib/chevre/repo/accountTransaction.d.ts +3 -11
  34. package/lib/chevre/repo/accountTransaction.js +3 -55
  35. package/lib/chevre/repo/action.d.ts +29 -1
  36. package/lib/chevre/repo/action.js +100 -56
  37. package/lib/chevre/repo/additionalProperty.js +2 -1
  38. package/lib/chevre/repo/assetTransaction.d.ts +25 -9
  39. package/lib/chevre/repo/assetTransaction.js +259 -87
  40. package/lib/chevre/repo/categoryCode.js +3 -2
  41. package/lib/chevre/repo/code.js +3 -2
  42. package/lib/chevre/repo/comment.d.ts +4 -1
  43. package/lib/chevre/repo/comment.js +22 -6
  44. package/lib/chevre/repo/confirmationNumber.d.ts +0 -1
  45. package/lib/chevre/repo/confirmationNumber.js +3 -15
  46. package/lib/chevre/repo/creativeWork.d.ts +1 -3
  47. package/lib/chevre/repo/creativeWork.js +3 -2
  48. package/lib/chevre/repo/customer.js +2 -1
  49. package/lib/chevre/repo/emailMessage.d.ts +1 -27
  50. package/lib/chevre/repo/emailMessage.js +2 -1
  51. package/lib/chevre/repo/event.d.ts +5 -1
  52. package/lib/chevre/repo/event.js +4 -3
  53. package/lib/chevre/repo/member.js +4 -3
  54. package/lib/chevre/repo/merchantReturnPolicy.d.ts +1 -3
  55. package/lib/chevre/repo/merchantReturnPolicy.js +2 -1
  56. package/lib/chevre/repo/mongoose/schemas/account.d.ts +4 -2
  57. package/lib/chevre/repo/mongoose/schemas/accountTitle.d.ts +29 -3
  58. package/lib/chevre/repo/mongoose/schemas/accountTransaction.d.ts +31 -3
  59. package/lib/chevre/repo/mongoose/schemas/accountTransaction.js +1 -1
  60. package/lib/chevre/repo/mongoose/schemas/accountingReport.d.ts +13 -3
  61. package/lib/chevre/repo/mongoose/schemas/action.d.ts +43 -3
  62. package/lib/chevre/repo/mongoose/schemas/action.js +19 -1
  63. package/lib/chevre/repo/mongoose/schemas/additionalProperty.d.ts +17 -3
  64. package/lib/chevre/repo/mongoose/schemas/aggregation.d.ts +4 -2
  65. package/lib/chevre/repo/mongoose/schemas/assetTransaction.d.ts +44 -3
  66. package/lib/chevre/repo/mongoose/schemas/assetTransaction.js +32 -19
  67. package/lib/chevre/repo/mongoose/schemas/authorization.d.ts +19 -3
  68. package/lib/chevre/repo/mongoose/schemas/authorization.js +1 -1
  69. package/lib/chevre/repo/mongoose/schemas/categoryCode.d.ts +25 -3
  70. package/lib/chevre/repo/mongoose/schemas/comments.d.ts +27 -3
  71. package/lib/chevre/repo/mongoose/schemas/comments.js +1 -1
  72. package/lib/chevre/repo/mongoose/schemas/creativeWork.d.ts +43 -3
  73. package/lib/chevre/repo/mongoose/schemas/customer.d.ts +25 -3
  74. package/lib/chevre/repo/mongoose/schemas/emailMessages.d.ts +21 -3
  75. package/lib/chevre/repo/mongoose/schemas/event.d.ts +71 -3
  76. package/lib/chevre/repo/mongoose/schemas/member.d.ts +13 -3
  77. package/lib/chevre/repo/mongoose/schemas/merchantReturnPolicy.d.ts +21 -3
  78. package/lib/chevre/repo/mongoose/schemas/offer.d.ts +65 -3
  79. package/lib/chevre/repo/mongoose/schemas/offerCatalog.d.ts +27 -3
  80. package/lib/chevre/repo/mongoose/schemas/offerItemCondition.d.ts +74 -0
  81. package/lib/chevre/repo/mongoose/schemas/offerItemCondition.js +45 -0
  82. package/lib/chevre/repo/mongoose/schemas/order.d.ts +51 -3
  83. package/lib/chevre/repo/mongoose/schemas/order.js +1 -1
  84. package/lib/chevre/repo/mongoose/schemas/ownershipInfo.d.ts +25 -3
  85. package/lib/chevre/repo/mongoose/schemas/ownershipInfo.js +1 -1
  86. package/lib/chevre/repo/mongoose/schemas/place.d.ts +49 -3
  87. package/lib/chevre/repo/mongoose/schemas/priceSpecification.d.ts +29 -3
  88. package/lib/chevre/repo/mongoose/schemas/product.d.ts +31 -3
  89. package/lib/chevre/repo/mongoose/schemas/project.d.ts +23 -3
  90. package/lib/chevre/repo/mongoose/schemas/reservation.d.ts +63 -5
  91. package/lib/chevre/repo/mongoose/schemas/reservation.js +1 -1
  92. package/lib/chevre/repo/mongoose/schemas/role.d.ts +11 -3
  93. package/lib/chevre/repo/mongoose/schemas/seller.d.ts +31 -3
  94. package/lib/chevre/repo/mongoose/schemas/seller.js +6 -0
  95. package/lib/chevre/repo/mongoose/schemas/serviceOutput.d.ts +11 -3
  96. package/lib/chevre/repo/mongoose/schemas/serviceOutput.js +1 -1
  97. package/lib/chevre/repo/mongoose/schemas/task.d.ts +30 -3
  98. package/lib/chevre/repo/mongoose/schemas/task.js +2 -1
  99. package/lib/chevre/repo/mongoose/schemas/telemetry.d.ts +21 -3
  100. package/lib/chevre/repo/mongoose/schemas/transaction.d.ts +40 -3
  101. package/lib/chevre/repo/mongoose/schemas/transaction.js +2 -1
  102. package/lib/chevre/repo/mongoose/schemas/trip.d.ts +11 -3
  103. package/lib/chevre/repo/offer.js +3 -2
  104. package/lib/chevre/repo/offerCatalog.js +0 -27
  105. package/lib/chevre/repo/offerItemCondition.d.ts +22 -0
  106. package/lib/chevre/repo/offerItemCondition.js +121 -0
  107. package/lib/chevre/repo/order.d.ts +55 -3
  108. package/lib/chevre/repo/order.js +62 -10
  109. package/lib/chevre/repo/ownershipInfo.js +2 -7
  110. package/lib/chevre/repo/place.js +3 -2
  111. package/lib/chevre/repo/priceSpecification.js +3 -2
  112. package/lib/chevre/repo/product.js +2 -1
  113. package/lib/chevre/repo/project.js +2 -1
  114. package/lib/chevre/repo/reservation.d.ts +12 -4
  115. package/lib/chevre/repo/reservation.js +20 -59
  116. package/lib/chevre/repo/role.js +3 -2
  117. package/lib/chevre/repo/seller.js +22 -21
  118. package/lib/chevre/repo/serviceOutput.js +2 -1
  119. package/lib/chevre/repo/task.d.ts +42 -2
  120. package/lib/chevre/repo/task.js +93 -11
  121. package/lib/chevre/repo/transaction.d.ts +23 -3
  122. package/lib/chevre/repo/transaction.js +177 -56
  123. package/lib/chevre/repo/trip.js +2 -1
  124. package/lib/chevre/repository.d.ts +5 -2
  125. package/lib/chevre/repository.js +8 -4
  126. package/lib/chevre/service/aggregation/system.d.ts +67 -22
  127. package/lib/chevre/service/aggregation/system.js +101 -89
  128. package/lib/chevre/service/assetTransaction/cancelReservation.js +1 -28
  129. package/lib/chevre/service/assetTransaction/moneyTransfer.js +1 -23
  130. package/lib/chevre/service/assetTransaction/pay/potentialActions.js +17 -1
  131. package/lib/chevre/service/assetTransaction/pay.d.ts +5 -1
  132. package/lib/chevre/service/assetTransaction/pay.js +18 -32
  133. package/lib/chevre/service/assetTransaction/refund.js +1 -23
  134. package/lib/chevre/service/assetTransaction/registerService.js +1 -25
  135. package/lib/chevre/service/assetTransaction/reserve/factory.d.ts +15 -5
  136. package/lib/chevre/service/assetTransaction/reserve/factory.js +122 -58
  137. package/lib/chevre/service/assetTransaction/reserve.d.ts +10 -1
  138. package/lib/chevre/service/assetTransaction/reserve.js +85 -69
  139. package/lib/chevre/service/assetTransaction.d.ts +6 -2
  140. package/lib/chevre/service/assetTransaction.js +9 -5
  141. package/lib/chevre/service/event.js +3 -1
  142. package/lib/chevre/service/notification/factory.js +2 -2
  143. package/lib/chevre/service/notification.d.ts +3 -1
  144. package/lib/chevre/service/notification.js +41 -7
  145. package/lib/chevre/service/offer/event/authorize.d.ts +3 -0
  146. package/lib/chevre/service/offer/event/authorize.js +8 -2
  147. package/lib/chevre/service/offer/event/factory.d.ts +3 -0
  148. package/lib/chevre/service/offer/event/factory.js +16 -5
  149. package/lib/chevre/service/offer/event/voidTransaction.d.ts +2 -0
  150. package/lib/chevre/service/offer/event/voidTransaction.js +17 -1
  151. package/lib/chevre/service/offer.d.ts +12 -7
  152. package/lib/chevre/service/offer.js +57 -2
  153. package/lib/chevre/service/order/deleteOrder.d.ts +3 -1
  154. package/lib/chevre/service/order/deleteOrder.js +8 -8
  155. package/lib/chevre/service/order/onOrderStatusChanged/factory.d.ts +5 -2
  156. package/lib/chevre/service/order/onOrderStatusChanged/factory.js +41 -81
  157. package/lib/chevre/service/order/onOrderStatusChanged.js +1 -3
  158. package/lib/chevre/service/order/onOrderUpdated.d.ts +16 -0
  159. package/lib/chevre/service/order/onOrderUpdated.js +22 -0
  160. package/lib/chevre/service/order/placeOrder.d.ts +1 -0
  161. package/lib/chevre/service/order/placeOrder.js +41 -24
  162. package/lib/chevre/service/order/returnOrder.d.ts +1 -0
  163. package/lib/chevre/service/order/returnOrder.js +7 -12
  164. package/lib/chevre/service/order/sendOrder.d.ts +1 -0
  165. package/lib/chevre/service/order/sendOrder.js +7 -10
  166. package/lib/chevre/service/order.d.ts +2 -1
  167. package/lib/chevre/service/order.js +3 -1
  168. package/lib/chevre/service/payment/any/onPaid.js +1 -1
  169. package/lib/chevre/service/payment/any/onRefund.js +1 -1
  170. package/lib/chevre/service/payment/any.d.ts +9 -5
  171. package/lib/chevre/service/payment/any.js +80 -18
  172. package/lib/chevre/service/payment/creditCard.d.ts +1 -1
  173. package/lib/chevre/service/payment/creditCard.js +21 -15
  174. package/lib/chevre/service/payment/movieTicket/checkByIdentifier.d.ts +7 -6
  175. package/lib/chevre/service/payment/movieTicket/validation.d.ts +6 -6
  176. package/lib/chevre/service/payment/movieTicket/validation.js +54 -31
  177. package/lib/chevre/service/payment/movieTicket.d.ts +2 -2
  178. package/lib/chevre/service/payment/movieTicket.js +5 -4
  179. package/lib/chevre/service/product.js +1 -5
  180. package/lib/chevre/service/report/telemetry.d.ts +0 -11
  181. package/lib/chevre/service/report/telemetry.js +21 -24
  182. package/lib/chevre/service/reserve/cancelReservation.d.ts +5 -3
  183. package/lib/chevre/service/reserve/cancelReservation.js +147 -139
  184. package/lib/chevre/service/reserve/checkInReservation.d.ts +9 -4
  185. package/lib/chevre/service/reserve/checkInReservation.js +77 -3
  186. package/lib/chevre/service/reserve/confirmReservation.d.ts +7 -4
  187. package/lib/chevre/service/reserve/confirmReservation.js +125 -58
  188. package/lib/chevre/service/reserve/factory.d.ts +1 -1
  189. package/lib/chevre/service/reserve/potentialActions/onReservationCanceled.d.ts +17 -5
  190. package/lib/chevre/service/reserve/potentialActions/onReservationCanceled.js +26 -24
  191. package/lib/chevre/service/reserve/potentialActions/onReservationCheckedIn.js +2 -3
  192. package/lib/chevre/service/reserve/potentialActions/onReservationConfirmed.js +2 -31
  193. package/lib/chevre/service/reserve/potentialActions/onReservationUsed.js +2 -3
  194. package/lib/chevre/service/reserve/useReservation.d.ts +7 -3
  195. package/lib/chevre/service/reserve/useReservation.js +61 -71
  196. package/lib/chevre/service/reserve/verifyToken4reservation.d.ts +15 -0
  197. package/lib/chevre/service/reserve/verifyToken4reservation.js +56 -0
  198. package/lib/chevre/service/reserve.d.ts +3 -2
  199. package/lib/chevre/service/reserve.js +4 -2
  200. package/lib/chevre/service/task/cancelPendingReservation.js +5 -1
  201. package/lib/chevre/service/task/confirmRegisterServiceTransaction.js +1 -1
  202. package/lib/chevre/service/task/deleteTransaction.js +10 -8
  203. package/lib/chevre/service/task/importOffersFromCOA.js +4 -0
  204. package/lib/chevre/service/task/onAuthorizationCreated.d.ts +7 -0
  205. package/lib/chevre/service/task/onAuthorizationCreated.js +108 -0
  206. package/lib/chevre/service/task/onEventChanged.d.ts +7 -0
  207. package/lib/chevre/service/task/{deleteOrder.js → onEventChanged.js} +8 -14
  208. package/lib/chevre/service/task/placeOrder.js +1 -1
  209. package/lib/chevre/service/task/reserve.js +10 -7
  210. package/lib/chevre/service/task/returnOrder.js +1 -1
  211. package/lib/chevre/service/task/returnPayTransaction.js +2 -12
  212. package/lib/chevre/service/task/sendOrder.js +1 -1
  213. package/lib/chevre/service/task/useReservation.d.ts +7 -0
  214. package/lib/chevre/service/task/useReservation.js +36 -0
  215. package/lib/chevre/service/task/voidReserveTransaction.js +3 -1
  216. package/lib/chevre/service/task.d.ts +9 -0
  217. package/lib/chevre/service/task.js +43 -4
  218. package/lib/chevre/service/transaction/deleteTransaction.d.ts +21 -0
  219. package/lib/chevre/service/transaction/deleteTransaction.js +232 -0
  220. package/lib/chevre/service/transaction/moneyTransfer/exportTasks/factory.js +11 -1
  221. package/lib/chevre/service/transaction/moneyTransfer/factory.js +3 -1
  222. package/lib/chevre/service/transaction/moneyTransfer/potentialActions.d.ts +1 -0
  223. package/lib/chevre/service/transaction/moneyTransfer/potentialActions.js +1 -1
  224. package/lib/chevre/service/transaction/moneyTransfer.js +9 -12
  225. package/lib/chevre/service/transaction/orderProgramMembership.js +6 -2
  226. package/lib/chevre/service/transaction/placeOrder/exportTasks/factory.js +42 -30
  227. package/lib/chevre/service/transaction/placeOrder.js +1 -5
  228. package/lib/chevre/service/transaction/placeOrderInProgress/factory.js +1 -1
  229. package/lib/chevre/service/transaction/placeOrderInProgress/potentialActions/moneyTransfer.d.ts +1 -0
  230. package/lib/chevre/service/transaction/placeOrderInProgress/potentialActions/moneyTransfer.js +1 -1
  231. package/lib/chevre/service/transaction/placeOrderInProgress/potentialActions/registerService.d.ts +1 -0
  232. package/lib/chevre/service/transaction/placeOrderInProgress/potentialActions/registerService.js +1 -1
  233. package/lib/chevre/service/transaction/placeOrderInProgress/potentialActions.d.ts +1 -0
  234. package/lib/chevre/service/transaction/placeOrderInProgress/result/acceptedOffers.d.ts +3 -0
  235. package/lib/chevre/service/transaction/placeOrderInProgress/result/acceptedOffers.js +7 -3
  236. package/lib/chevre/service/transaction/placeOrderInProgress/result.d.ts +1 -0
  237. package/lib/chevre/service/transaction/placeOrderInProgress/result.js +2 -2
  238. package/lib/chevre/service/transaction/placeOrderInProgress/validation/validateMovieTicket.d.ts +1 -1
  239. package/lib/chevre/service/transaction/placeOrderInProgress/validation/validateMovieTicket.js +2 -2
  240. package/lib/chevre/service/transaction/placeOrderInProgress/validation.d.ts +2 -1
  241. package/lib/chevre/service/transaction/placeOrderInProgress/validation.js +23 -17
  242. package/lib/chevre/service/transaction/placeOrderInProgress.d.ts +0 -3
  243. package/lib/chevre/service/transaction/placeOrderInProgress.js +22 -11
  244. package/lib/chevre/service/transaction/returnOrder/exportTasks/factory.js +10 -1
  245. package/lib/chevre/service/transaction/returnOrder/potentialActions/returnPaymentMethod.js +25 -17
  246. package/lib/chevre/service/transaction/returnOrder.d.ts +4 -0
  247. package/lib/chevre/service/transaction/returnOrder.js +225 -35
  248. package/lib/chevre/service/transaction.d.ts +8 -13
  249. package/lib/chevre/service/transaction.js +12 -145
  250. package/lib/chevre/settings.d.ts +8 -1
  251. package/lib/chevre/settings.js +35 -6
  252. package/package.json +5 -5
  253. package/example/src/chevre/migrateMoneyTransferPendingTransactionIdentifier.ts +0 -96
  254. package/example/src/chevre/migrateMovieAdditionalProperties.ts +0 -98
  255. package/lib/chevre/service/task/deleteAssetTransaction.d.ts +0 -12
  256. package/lib/chevre/service/task/deleteAssetTransaction.js +0 -65
  257. package/lib/chevre/service/task/deleteOrder.d.ts +0 -6
@@ -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
  });
@@ -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
  */
@@ -283,7 +284,7 @@ class MongoRepository {
283
284
  if (((_a = params.sort) === null || _a === void 0 ? void 0 : _a.branchCode) !== undefined) {
284
285
  query.sort({ branchCode: params.sort.branchCode });
285
286
  }
286
- return query.setOptions({ maxTimeMS: 10000 })
287
+ return query.setOptions({ maxTimeMS: settings_1.MONGO_MAX_TIME_MS })
287
288
  .exec()
288
289
  .then((docs) => docs.map((doc) => doc.toObject()));
289
290
  });
@@ -1235,7 +1236,7 @@ class MongoRepository {
1235
1236
  if (((_a = params.sort) === null || _a === void 0 ? void 0 : _a.branchCode) !== undefined) {
1236
1237
  query.sort({ branchCode: params.sort.branchCode });
1237
1238
  }
1238
- return query.setOptions({ maxTimeMS: 10000 })
1239
+ return query.setOptions({ maxTimeMS: settings_1.MONGO_MAX_TIME_MS })
1239
1240
  .exec()
1240
1241
  .then((docs) => docs.map((doc) => doc.toObject()));
1241
1242
  });
@@ -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
  });
@@ -23,6 +23,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
23
23
  exports.MongoRepository = void 0;
24
24
  const product_1 = require("./mongoose/schemas/product");
25
25
  const factory = require("../factory");
26
+ const settings_1 = require("../settings");
26
27
  /**
27
28
  * プロダクトリポジトリ
28
29
  */
@@ -170,7 +171,7 @@ class MongoRepository {
170
171
  if (((_a = conditions.sort) === null || _a === void 0 ? void 0 : _a.productID) !== undefined) {
171
172
  query.sort({ productID: conditions.sort.productID });
172
173
  }
173
- return query.setOptions({ maxTimeMS: 10000 })
174
+ return query.setOptions({ maxTimeMS: settings_1.MONGO_MAX_TIME_MS })
174
175
  .exec()
175
176
  .then((docs) => docs.map((doc) => doc.toObject()));
176
177
  });
@@ -12,6 +12,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
12
12
  exports.MongoRepository = void 0;
13
13
  const project_1 = require("./mongoose/schemas/project");
14
14
  const factory = require("../factory");
15
+ const settings_1 = require("../settings");
15
16
  /**
16
17
  * プロジェクトリポジトリ
17
18
  */
@@ -89,7 +90,7 @@ class MongoRepository {
89
90
  if (((_a = conditions.sort) === null || _a === void 0 ? void 0 : _a._id) !== undefined) {
90
91
  query.sort({ _id: conditions.sort._id });
91
92
  }
92
- return query.setOptions({ maxTimeMS: 10000 })
93
+ return query.setOptions({ maxTimeMS: settings_1.MONGO_MAX_TIME_MS })
93
94
  .exec()
94
95
  .then((docs) => docs.map((doc) => doc.toObject()));
95
96
  });
@@ -23,19 +23,27 @@ export declare class MongoRepository {
23
23
  /**
24
24
  * 予約検索
25
25
  */
26
- search<T extends factory.reservationType>(params: factory.reservation.ISearchConditions<T>, projection?: any): Promise<factory.reservation.IReservation<factory.reservationType.EventReservation>[]>;
26
+ search<T extends factory.reservationType>(params: factory.reservation.ISearchConditions<T>, projection?: {
27
+ [key: string]: 0 | 1;
28
+ }): Promise<factory.reservation.IReservation<factory.reservationType.EventReservation>[]>;
27
29
  findById<T extends factory.reservationType>(params: {
28
30
  id: string;
29
31
  inclusion?: string[];
30
32
  exclusion?: string[];
31
33
  }): Promise<factory.reservation.IReservation<T>>;
32
- /**
33
- * 予約確定
34
- */
35
34
  confirmByReservationNumber(params: {
36
35
  reservationNumber: string;
37
36
  previousReservationStatus: factory.reservationStatusType;
38
37
  underName?: factory.reservation.IUnderName<factory.reservationType.EventReservation>;
38
+ broker?: factory.reservation.IBroker<factory.reservationType>;
39
+ issuedThrough?: factory.assetTransaction.reserve.IIssuedThrough;
40
+ }): Promise<void>;
41
+ confirmByIdIfNotExist(params: {
42
+ reservation: factory.assetTransaction.reserve.IObjectSubReservation;
43
+ reservationFor: factory.assetTransaction.reserve.IReservationFor;
44
+ underName?: factory.reservation.IUnderName<factory.reservationType.EventReservation>;
45
+ broker?: factory.reservation.IBroker<factory.reservationType>;
46
+ issuedThrough?: factory.assetTransaction.reserve.IIssuedThrough;
39
47
  }): Promise<void>;
40
48
  /**
41
49
  * 予約取消
@@ -10,8 +10,11 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
10
10
  };
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
12
  exports.MongoRepository = void 0;
13
+ const createDebug = require("debug");
13
14
  const reservation_1 = require("./mongoose/schemas/reservation");
14
15
  const factory = require("../factory");
16
+ const settings_1 = require("../settings");
17
+ const debug = createDebug('chevre-domain:repo');
15
18
  /**
16
19
  * 予約リポジトリ
17
20
  */
@@ -811,18 +814,6 @@ class MongoRepository {
811
814
  }
812
815
  return andConditions;
813
816
  }
814
- // public async distinct<T extends factory.reservationType>(
815
- // field: string,
816
- // params: factory.reservation.ISearchConditions<T>
817
- // ): Promise<any[]> {
818
- // const conditions = MongoRepository.CREATE_MONGO_CONDITIONS(params);
819
- // return this.reservationModel.distinct(
820
- // field,
821
- // (conditions.length > 0) ? { $and: conditions } : {}
822
- // )
823
- // .setOptions({ maxTimeMS: 10000 })
824
- // .exec();
825
- // }
826
817
  createMany(params) {
827
818
  return __awaiter(this, void 0, void 0, function* () {
828
819
  if (params.reservations.length > 0) {
@@ -849,7 +840,7 @@ class MongoRepository {
849
840
  return __awaiter(this, void 0, void 0, function* () {
850
841
  const conditions = MongoRepository.CREATE_MONGO_CONDITIONS(params);
851
842
  return this.reservationModel.countDocuments((conditions.length > 0) ? { $and: conditions } : {})
852
- .setOptions({ maxTimeMS: 10000 })
843
+ .setOptions({ maxTimeMS: settings_1.MONGO_MAX_TIME_MS })
853
844
  .exec();
854
845
  });
855
846
  }
@@ -877,7 +868,7 @@ class MongoRepository {
877
868
  if (((_a = params.sort) === null || _a === void 0 ? void 0 : _a.modifiedTime) !== undefined) {
878
869
  query.sort({ modifiedTime: params.sort.modifiedTime });
879
870
  }
880
- return query.setOptions({ maxTimeMS: 10000 })
871
+ return query.setOptions({ maxTimeMS: settings_1.MONGO_MAX_TIME_MS })
881
872
  .exec()
882
873
  .then((docs) => docs.map((doc) => doc.toObject()));
883
874
  });
@@ -910,61 +901,31 @@ class MongoRepository {
910
901
  return doc.toObject();
911
902
  });
912
903
  }
913
- /**
914
- * 予約確定
915
- */
916
- // public async confirm<T extends factory.reservationType>(params: {
917
- // id: string;
918
- // previousReservationStatus: factory.reservationStatusType;
919
- // underName?: factory.reservation.IUnderName<T>;
920
- // }): Promise<factory.reservation.IReservation<T>> {
921
- // const conditions = {
922
- // _id: { $eq: String(params.id) },
923
- // reservationStatus: { $eq: params.previousReservationStatus }
924
- // };
925
- // // 更新属性をwhitelist化(2022-06-13~)
926
- // const update = {
927
- // // previousReservationStatusを保管(2023-01-19~)
928
- // previousReservationStatus: params.previousReservationStatus,
929
- // reservationStatus: factory.reservationStatusType.ReservationConfirmed,
930
- // modifiedTime: new Date(),
931
- // ...(params.underName !== undefined) ? { underName: params.underName } : undefined
932
- // };
933
- // const doc = await this.reservationModel.findOneAndUpdate(
934
- // conditions,
935
- // update,
936
- // { new: true }
937
- // )
938
- // .select({ __v: 0, createdAt: 0, updatedAt: 0 })
939
- // .exec();
940
- // // NotFoundであれば状態確認
941
- // if (doc === null) {
942
- // const reservation = await this.findById<T>({ id: String(params.id) });
943
- // if (reservation.reservationStatus === factory.reservationStatusType.ReservationConfirmed) {
944
- // // すでに確定済の場合
945
- // return reservation;
946
- // } else {
947
- // throw new factory.errors.Argument(
948
- // 'id',
949
- // `Reservation ${reservation.id} already changed -> ${reservation.reservationStatus}`
950
- // );
951
- // }
952
- // }
953
- // return doc.toObject();
954
- // }
955
904
  confirmByReservationNumber(params) {
905
+ var _a, _b;
956
906
  return __awaiter(this, void 0, void 0, function* () {
957
907
  const conditions = {
958
908
  reservationNumber: { $eq: String(params.reservationNumber) },
959
909
  reservationStatus: { $eq: params.previousReservationStatus }
960
910
  };
961
- const update = Object.assign({
911
+ const update = Object.assign(Object.assign(Object.assign({
962
912
  // previousReservationStatusを保管(2023-01-19~)
963
- previousReservationStatus: params.previousReservationStatus, reservationStatus: factory.reservationStatusType.ReservationConfirmed, modifiedTime: new Date() }, (params.underName !== undefined) ? { underName: params.underName } : undefined);
913
+ previousReservationStatus: params.previousReservationStatus, reservationStatus: factory.reservationStatusType.ReservationConfirmed, modifiedTime: new Date() }, (params.underName !== undefined) ? { underName: params.underName } : undefined), (typeof ((_a = params.broker) === null || _a === void 0 ? void 0 : _a.typeOf) === 'string') ? { broker: params.broker } : undefined), (typeof ((_b = params.issuedThrough) === null || _b === void 0 ? void 0 : _b.typeOf) === 'string') ? { issuedThrough: params.issuedThrough } : undefined);
964
914
  yield this.reservationModel.updateMany(conditions, update)
965
915
  .exec();
966
916
  });
967
917
  }
918
+ confirmByIdIfNotExist(params) {
919
+ var _a, _b;
920
+ return __awaiter(this, void 0, void 0, function* () {
921
+ const confirmedReservation = yield this.reservationModel.findOneAndUpdate({ _id: { $eq: params.reservation.id } }, {
922
+ $setOnInsert: Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, params.reservation), { _id: params.reservation.id, reservationFor: params.reservationFor, reservationStatus: factory.reservationStatusType.ReservationConfirmed, modifiedTime: new Date() }), (params.underName !== undefined) ? { underName: params.underName } : undefined), (typeof ((_a = params.broker) === null || _a === void 0 ? void 0 : _a.typeOf) === 'string') ? { broker: params.broker } : undefined), (typeof ((_b = params.issuedThrough) === null || _b === void 0 ? void 0 : _b.typeOf) === 'string') ? { issuedThrough: params.issuedThrough } : undefined)
923
+ }, { upsert: true, new: true })
924
+ .select({ _id: 1 })
925
+ .exec();
926
+ debug('confirmByIdIfNotExist processed.confirmedReservation:', confirmedReservation);
927
+ });
928
+ }
968
929
  /**
969
930
  * 予約取消
970
931
  */
@@ -1174,7 +1135,7 @@ class MongoRepository {
1174
1135
  }
1175
1136
  })
1176
1137
  .select({ _id: 1 })
1177
- .setOptions({ maxTimeMS: 10000 })
1138
+ .setOptions({ maxTimeMS: settings_1.MONGO_MAX_TIME_MS })
1178
1139
  .exec()
1179
1140
  .then((docs) => docs.map((doc) => doc._id.toString()));
1180
1141
  });
@@ -12,6 +12,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
12
12
  exports.MongoRepository = exports.RoleType = void 0;
13
13
  const factory = require("../factory");
14
14
  const role_1 = require("./mongoose/schemas/role");
15
+ const settings_1 = require("../settings");
15
16
  var RoleType;
16
17
  (function (RoleType) {
17
18
  RoleType["OrganizationRole"] = "OrganizationRole";
@@ -67,7 +68,7 @@ class MongoRepository {
67
68
  return __awaiter(this, void 0, void 0, function* () {
68
69
  const conditions = MongoRepository.CREATE_MONGO_CONDITIONS(params);
69
70
  return this.roleModel.countDocuments((conditions.length > 0) ? { $and: conditions } : {})
70
- .setOptions({ maxTimeMS: 10000 })
71
+ .setOptions({ maxTimeMS: settings_1.MONGO_MAX_TIME_MS })
71
72
  .exec();
72
73
  });
73
74
  }
@@ -91,7 +92,7 @@ class MongoRepository {
91
92
  }
92
93
  // const explainResult = await (<any>query).explain();
93
94
  // console.log(explainResult[0].executionStats.allPlansExecution.map((e: any) => e.executionStages.inputStage));
94
- return query.setOptions({ maxTimeMS: 10000 })
95
+ return query.setOptions({ maxTimeMS: settings_1.MONGO_MAX_TIME_MS })
95
96
  .exec()
96
97
  .then((docs) => docs.map((doc) => doc.toObject()));
97
98
  });
@@ -23,6 +23,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
23
23
  exports.MongoRepository = void 0;
24
24
  const seller_1 = require("./mongoose/schemas/seller");
25
25
  const factory = require("../factory");
26
+ const settings_1 = require("../settings");
26
27
  /**
27
28
  * 販売者リポジトリ
28
29
  */
@@ -32,21 +33,12 @@ class MongoRepository {
32
33
  }
33
34
  // tslint:disable-next-line:max-func-body-length
34
35
  static CREATE_MONGO_CONDITIONS(params) {
35
- var _a, _b, _c, _d, _e, _f;
36
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
36
37
  // MongoDB検索条件
37
38
  const andConditions = [];
38
- // tslint:disable-next-line:no-single-line-block-comment
39
- /* istanbul ignore else */
40
- if (params.project !== undefined) {
41
- if (params.project.id !== undefined && params.project.id !== null) {
42
- if (typeof params.project.id.$eq === 'string') {
43
- andConditions.push({
44
- 'project.id': {
45
- $eq: params.project.id.$eq
46
- }
47
- });
48
- }
49
- }
39
+ const projectIdEq = (_b = (_a = params.project) === null || _a === void 0 ? void 0 : _a.id) === null || _b === void 0 ? void 0 : _b.$eq;
40
+ if (typeof projectIdEq === 'string') {
41
+ andConditions.push({ 'project.id': { $eq: projectIdEq } });
50
42
  }
51
43
  const nameRegex = params.name;
52
44
  if (typeof nameRegex === 'string' && nameRegex.length > 0) {
@@ -67,7 +59,7 @@ class MongoRepository {
67
59
  ]
68
60
  });
69
61
  }
70
- const branchCodeEq = (_a = params.branchCode) === null || _a === void 0 ? void 0 : _a.$eq;
62
+ const branchCodeEq = (_c = params.branchCode) === null || _c === void 0 ? void 0 : _c.$eq;
71
63
  if (typeof branchCodeEq === 'string') {
72
64
  andConditions.push({
73
65
  branchCode: {
@@ -75,7 +67,7 @@ class MongoRepository {
75
67
  }
76
68
  });
77
69
  }
78
- const branchCodeRegex = (_b = params.branchCode) === null || _b === void 0 ? void 0 : _b.$regex;
70
+ const branchCodeRegex = (_d = params.branchCode) === null || _d === void 0 ? void 0 : _d.$regex;
79
71
  if (typeof branchCodeRegex === 'string' && branchCodeRegex.length > 0) {
80
72
  andConditions.push({
81
73
  branchCode: {
@@ -83,7 +75,7 @@ class MongoRepository {
83
75
  }
84
76
  });
85
77
  }
86
- const additionalPropertyAll = (_c = params.additionalProperty) === null || _c === void 0 ? void 0 : _c.$all;
78
+ const additionalPropertyAll = (_e = params.additionalProperty) === null || _e === void 0 ? void 0 : _e.$all;
87
79
  if (Array.isArray(additionalPropertyAll)) {
88
80
  andConditions.push({
89
81
  additionalProperty: {
@@ -92,7 +84,7 @@ class MongoRepository {
92
84
  }
93
85
  });
94
86
  }
95
- const additionalPropertyIn = (_d = params.additionalProperty) === null || _d === void 0 ? void 0 : _d.$in;
87
+ const additionalPropertyIn = (_f = params.additionalProperty) === null || _f === void 0 ? void 0 : _f.$in;
96
88
  if (Array.isArray(additionalPropertyIn)) {
97
89
  andConditions.push({
98
90
  additionalProperty: {
@@ -101,7 +93,7 @@ class MongoRepository {
101
93
  }
102
94
  });
103
95
  }
104
- const additionalPropertyNin = (_e = params.additionalProperty) === null || _e === void 0 ? void 0 : _e.$nin;
96
+ const additionalPropertyNin = (_g = params.additionalProperty) === null || _g === void 0 ? void 0 : _g.$nin;
105
97
  if (Array.isArray(additionalPropertyNin)) {
106
98
  andConditions.push({
107
99
  additionalProperty: {
@@ -109,7 +101,7 @@ class MongoRepository {
109
101
  }
110
102
  });
111
103
  }
112
- const additionalPropertyElemMatch = (_f = params.additionalProperty) === null || _f === void 0 ? void 0 : _f.$elemMatch;
104
+ const additionalPropertyElemMatch = (_h = params.additionalProperty) === null || _h === void 0 ? void 0 : _h.$elemMatch;
113
105
  if (additionalPropertyElemMatch !== undefined && additionalPropertyElemMatch !== null) {
114
106
  andConditions.push({
115
107
  additionalProperty: {
@@ -118,6 +110,15 @@ class MongoRepository {
118
110
  }
119
111
  });
120
112
  }
113
+ const hasMerchantReturnPolicyItemConditionIdEq = (_l = (_k = (_j = params.hasMerchantReturnPolicy) === null || _j === void 0 ? void 0 : _j.itemCondition) === null || _k === void 0 ? void 0 : _k.id) === null || _l === void 0 ? void 0 : _l.$eq;
114
+ if (typeof hasMerchantReturnPolicyItemConditionIdEq === 'string') {
115
+ andConditions.push({
116
+ 'hasMerchantReturnPolicy.itemCondition.id': {
117
+ $exists: true,
118
+ $eq: hasMerchantReturnPolicyItemConditionIdEq
119
+ }
120
+ });
121
+ }
121
122
  return andConditions;
122
123
  }
123
124
  /**
@@ -160,7 +161,7 @@ class MongoRepository {
160
161
  return __awaiter(this, void 0, void 0, function* () {
161
162
  const conditions = MongoRepository.CREATE_MONGO_CONDITIONS(params);
162
163
  return this.organizationModel.countDocuments((conditions.length > 0) ? { $and: conditions } : {})
163
- .setOptions({ maxTimeMS: 10000 })
164
+ .setOptions({ maxTimeMS: settings_1.MONGO_MAX_TIME_MS })
164
165
  .exec();
165
166
  });
166
167
  }
@@ -182,7 +183,7 @@ class MongoRepository {
182
183
  if (((_a = conditions.sort) === null || _a === void 0 ? void 0 : _a.branchCode) !== undefined) {
183
184
  query.sort({ branchCode: conditions.sort.branchCode });
184
185
  }
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
  });