@chevre/domain 21.0.0-alpha.1 → 21.0.0-alpha.11

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 (263) hide show
  1. package/lib/chevre/errorHandler.d.ts +1 -0
  2. package/lib/chevre/errorHandler.js +6 -2
  3. package/lib/chevre/factory/event.d.ts +1 -1
  4. package/lib/chevre/index.d.ts +1 -2
  5. package/lib/chevre/index.js +1 -3
  6. package/lib/chevre/repo/account.d.ts +0 -2
  7. package/lib/chevre/repo/account.js +10 -6
  8. package/lib/chevre/repo/accountTitle.js +6 -2
  9. package/lib/chevre/repo/accountTransaction.d.ts +0 -2
  10. package/lib/chevre/repo/accountTransaction.js +9 -6
  11. package/lib/chevre/repo/accountingReport.d.ts +1 -1
  12. package/lib/chevre/repo/accountingReport.js +7 -3
  13. package/lib/chevre/repo/action/registerServiceInProgress.js +1 -1
  14. package/lib/chevre/repo/action.d.ts +3 -4
  15. package/lib/chevre/repo/action.js +9 -6
  16. package/lib/chevre/repo/additionalProperty.js +8 -4
  17. package/lib/chevre/repo/aggregation.js +6 -2
  18. package/lib/chevre/repo/assetTransaction.d.ts +1 -2
  19. package/lib/chevre/repo/assetTransaction.js +9 -6
  20. package/lib/chevre/repo/categoryCode.js +8 -4
  21. package/lib/chevre/repo/code.d.ts +3 -3
  22. package/lib/chevre/repo/code.js +10 -5
  23. package/lib/chevre/repo/comment.js +8 -4
  24. package/lib/chevre/repo/confirmationNumber.js +1 -1
  25. package/lib/chevre/repo/creativeWork.d.ts +0 -2
  26. package/lib/chevre/repo/creativeWork.js +9 -6
  27. package/lib/chevre/repo/customer.js +8 -4
  28. package/lib/chevre/repo/emailMessage.d.ts +1 -1
  29. package/lib/chevre/repo/emailMessage.js +8 -4
  30. package/lib/chevre/repo/event.d.ts +1 -1
  31. package/lib/chevre/repo/event.js +8 -4
  32. package/lib/chevre/repo/itemAvailability/screeningEvent.js +1 -1
  33. package/lib/chevre/repo/member.js +16 -9
  34. package/lib/chevre/repo/merchantReturnPolicy.d.ts +0 -2
  35. package/lib/chevre/repo/merchantReturnPolicy.js +9 -6
  36. package/lib/chevre/repo/mongoose/onIndexCreated.d.ts +2 -0
  37. package/lib/chevre/repo/mongoose/onIndexCreated.js +11 -0
  38. package/lib/chevre/repo/mongoose/schemas/account.d.ts +54 -0
  39. package/lib/chevre/repo/mongoose/{model → schemas}/account.js +4 -14
  40. package/lib/chevre/repo/mongoose/schemas/accountTitle.d.ts +64 -0
  41. package/lib/chevre/repo/mongoose/{model → schemas}/accountTitle.js +10 -35
  42. package/lib/chevre/repo/mongoose/schemas/accountTransaction.d.ts +67 -0
  43. package/lib/chevre/repo/mongoose/{model → schemas}/accountTransaction.js +9 -19
  44. package/lib/chevre/repo/mongoose/schemas/accountingReport.d.ts +58 -0
  45. package/lib/chevre/repo/mongoose/{model → schemas}/accountingReport.js +7 -17
  46. package/lib/chevre/repo/mongoose/schemas/action.d.ts +73 -0
  47. package/lib/chevre/repo/mongoose/{model → schemas}/action.js +17 -27
  48. package/lib/chevre/repo/mongoose/schemas/additionalProperty.d.ts +60 -0
  49. package/lib/chevre/repo/mongoose/{model → schemas}/additionalProperty.js +7 -17
  50. package/lib/chevre/repo/mongoose/schemas/aggregation.d.ts +54 -0
  51. package/lib/chevre/repo/mongoose/{model → schemas}/aggregation.js +4 -14
  52. package/lib/chevre/repo/mongoose/schemas/assetTransaction.d.ts +72 -0
  53. package/lib/chevre/repo/mongoose/{model → schemas}/assetTransaction.js +13 -23
  54. package/lib/chevre/repo/mongoose/schemas/authorization.d.ts +61 -0
  55. package/lib/chevre/repo/mongoose/{model → schemas}/authorization.js +6 -16
  56. package/lib/chevre/repo/mongoose/schemas/categoryCode.d.ts +64 -0
  57. package/lib/chevre/repo/mongoose/{model → schemas}/categoryCode.js +9 -19
  58. package/lib/chevre/repo/mongoose/schemas/comments.d.ts +65 -0
  59. package/lib/chevre/repo/mongoose/{model → schemas}/comments.js +9 -19
  60. package/lib/chevre/repo/mongoose/schemas/creativeWork.d.ts +73 -0
  61. package/lib/chevre/repo/mongoose/{model → schemas}/creativeWork.js +10 -20
  62. package/lib/chevre/repo/mongoose/schemas/customer.d.ts +64 -0
  63. package/lib/chevre/repo/mongoose/{model → schemas}/customer.js +8 -18
  64. package/lib/chevre/repo/mongoose/schemas/emailMessages.d.ts +62 -0
  65. package/lib/chevre/repo/mongoose/{model → schemas}/emailMessages.js +8 -18
  66. package/lib/chevre/repo/mongoose/{model → schemas}/event.d.ts +26 -2
  67. package/lib/chevre/repo/mongoose/{model → schemas}/event.js +24 -34
  68. package/lib/chevre/repo/mongoose/schemas/member.d.ts +58 -0
  69. package/lib/chevre/repo/mongoose/{model → schemas}/member.js +6 -16
  70. package/lib/chevre/repo/mongoose/schemas/merchantReturnPolicy.d.ts +62 -0
  71. package/lib/chevre/repo/mongoose/{model → schemas}/merchantReturnPolicy.js +7 -17
  72. package/lib/chevre/repo/mongoose/schemas/offer.d.ts +83 -0
  73. package/lib/chevre/repo/mongoose/{model → schemas}/offer.js +28 -38
  74. package/lib/chevre/repo/mongoose/schemas/offerCatalog.d.ts +64 -0
  75. package/lib/chevre/repo/mongoose/{model → schemas}/offerCatalog.js +11 -21
  76. package/lib/chevre/repo/mongoose/schemas/order.d.ts +77 -0
  77. package/lib/chevre/repo/mongoose/{model → schemas}/order.js +15 -25
  78. package/lib/chevre/repo/mongoose/schemas/ownershipInfo.d.ts +64 -0
  79. package/lib/chevre/repo/mongoose/{model → schemas}/ownershipInfo.js +9 -19
  80. package/lib/chevre/repo/mongoose/schemas/place.d.ts +76 -0
  81. package/lib/chevre/repo/mongoose/{model → schemas}/place.js +17 -27
  82. package/lib/chevre/repo/mongoose/schemas/priceSpecification.d.ts +66 -0
  83. package/lib/chevre/repo/mongoose/{model → schemas}/priceSpecification.js +9 -19
  84. package/lib/chevre/repo/mongoose/schemas/product.d.ts +67 -0
  85. package/lib/chevre/repo/mongoose/{model → schemas}/product.js +14 -24
  86. package/lib/chevre/repo/mongoose/schemas/project.d.ts +63 -0
  87. package/lib/chevre/repo/mongoose/{model → schemas}/project.js +7 -17
  88. package/lib/chevre/repo/mongoose/{model → schemas}/reservation.d.ts +26 -2
  89. package/lib/chevre/repo/mongoose/{model → schemas}/reservation.js +15 -25
  90. package/lib/chevre/repo/mongoose/schemas/role.d.ts +57 -0
  91. package/lib/chevre/repo/mongoose/{model → schemas}/role.js +4 -14
  92. package/lib/chevre/repo/mongoose/schemas/seller.d.ts +67 -0
  93. package/lib/chevre/repo/mongoose/{model → schemas}/seller.js +12 -22
  94. package/lib/chevre/repo/mongoose/schemas/serviceOutput.d.ts +57 -0
  95. package/lib/chevre/repo/mongoose/{model → schemas}/serviceOutput.js +5 -15
  96. package/lib/chevre/repo/mongoose/schemas/task.d.ts +65 -0
  97. package/lib/chevre/repo/mongoose/{model → schemas}/task.js +7 -17
  98. package/lib/chevre/repo/mongoose/schemas/telemetry.d.ts +62 -0
  99. package/lib/chevre/repo/mongoose/{model → schemas}/telemetry.js +9 -19
  100. package/lib/chevre/repo/mongoose/schemas/transaction.d.ts +70 -0
  101. package/lib/chevre/repo/mongoose/{model → schemas}/transaction.js +12 -22
  102. package/lib/chevre/repo/mongoose/schemas/trip.d.ts +57 -0
  103. package/lib/chevre/repo/mongoose/{model → schemas}/trip.js +5 -15
  104. package/lib/chevre/repo/mongoose/writeConcern.d.ts +3 -0
  105. package/lib/chevre/repo/mongoose/writeConcern.js +5 -0
  106. package/lib/chevre/repo/offer.js +11 -6
  107. package/lib/chevre/repo/offerCatalog.js +8 -4
  108. package/lib/chevre/repo/order.d.ts +0 -2
  109. package/lib/chevre/repo/order.js +12 -9
  110. package/lib/chevre/repo/orderNumber.js +1 -1
  111. package/lib/chevre/repo/ownershipInfo.d.ts +1 -3
  112. package/lib/chevre/repo/ownershipInfo.js +10 -7
  113. package/lib/chevre/repo/paymentMethod/creditCard.d.ts +3 -3
  114. package/lib/chevre/repo/permit.js +6 -2
  115. package/lib/chevre/repo/person.d.ts +2 -2
  116. package/lib/chevre/repo/place.d.ts +2 -2
  117. package/lib/chevre/repo/place.js +16 -12
  118. package/lib/chevre/repo/priceSpecification.js +8 -4
  119. package/lib/chevre/repo/product.d.ts +1 -1
  120. package/lib/chevre/repo/product.js +8 -4
  121. package/lib/chevre/repo/project.js +7 -3
  122. package/lib/chevre/repo/rateLimit/offer.js +1 -1
  123. package/lib/chevre/repo/reservation.d.ts +1 -1
  124. package/lib/chevre/repo/reservation.js +8 -21
  125. package/lib/chevre/repo/role.js +8 -4
  126. package/lib/chevre/repo/seller.d.ts +1 -1
  127. package/lib/chevre/repo/seller.js +8 -4
  128. package/lib/chevre/repo/serviceOutput.js +8 -4
  129. package/lib/chevre/repo/serviceOutputIdentifier.js +1 -1
  130. package/lib/chevre/repo/task.js +8 -4
  131. package/lib/chevre/repo/telemetry.js +6 -2
  132. package/lib/chevre/repo/transaction.d.ts +1 -2
  133. package/lib/chevre/repo/transaction.js +9 -6
  134. package/lib/chevre/repo/transactionNumber.js +1 -1
  135. package/lib/chevre/repo/trip.d.ts +1 -1
  136. package/lib/chevre/repo/trip.js +8 -4
  137. package/lib/chevre/service/account.d.ts +1 -1
  138. package/lib/chevre/service/accountTransaction/deposit.d.ts +1 -1
  139. package/lib/chevre/service/accountTransaction/deposit.js +0 -5
  140. package/lib/chevre/service/accountTransaction/transfer.d.ts +1 -1
  141. package/lib/chevre/service/accountTransaction/transfer.js +0 -5
  142. package/lib/chevre/service/accountTransaction/withdraw.d.ts +1 -1
  143. package/lib/chevre/service/accountTransaction/withdraw.js +0 -5
  144. package/lib/chevre/service/accountTransaction.d.ts +1 -1
  145. package/lib/chevre/service/aggregation/event/aggregateScreeningEvent.d.ts +1 -1
  146. package/lib/chevre/service/aggregation/event/aggregateUseActionsOnEvent.d.ts +1 -1
  147. package/lib/chevre/service/aggregation/project.d.ts +1 -1
  148. package/lib/chevre/service/assetTransaction/cancelReservation.d.ts +3 -3
  149. package/lib/chevre/service/assetTransaction/moneyTransfer.d.ts +4 -4
  150. package/lib/chevre/service/assetTransaction/moneyTransfer.js +0 -5
  151. package/lib/chevre/service/assetTransaction/pay/potentialActions.d.ts +1 -1
  152. package/lib/chevre/service/assetTransaction/pay.d.ts +7 -7
  153. package/lib/chevre/service/assetTransaction/refund.d.ts +4 -4
  154. package/lib/chevre/service/assetTransaction/refund.js +0 -5
  155. package/lib/chevre/service/assetTransaction/registerService/factory.d.ts +1 -1
  156. package/lib/chevre/service/assetTransaction/registerService.d.ts +4 -4
  157. package/lib/chevre/service/assetTransaction/registerService.js +0 -5
  158. package/lib/chevre/service/assetTransaction/reserve/factory/price.d.ts +1 -1
  159. package/lib/chevre/service/assetTransaction/reserve/factory.d.ts +2 -2
  160. package/lib/chevre/service/assetTransaction/reserve.d.ts +6 -6
  161. package/lib/chevre/service/assetTransaction/reserve.js +0 -10
  162. package/lib/chevre/service/code.d.ts +2 -2
  163. package/lib/chevre/service/code.js +6 -1
  164. package/lib/chevre/service/delivery/factory.d.ts +1 -1
  165. package/lib/chevre/service/delivery/product/factory.d.ts +1 -1
  166. package/lib/chevre/service/delivery/reservation/factory.d.ts +1 -1
  167. package/lib/chevre/service/iam.d.ts +1 -1
  168. package/lib/chevre/service/moneyTransfer.d.ts +1 -1
  169. package/lib/chevre/service/notification.d.ts +1 -1
  170. package/lib/chevre/service/offer/event/authorize.d.ts +2 -2
  171. package/lib/chevre/service/offer/event/factory.d.ts +5 -5
  172. package/lib/chevre/service/offer/event/searchEventTicketOffers.d.ts +2 -2
  173. package/lib/chevre/service/offer/eventServiceByCOA/factory.d.ts +2 -2
  174. package/lib/chevre/service/offer/eventServiceByCOA/validateAcceptedOffers.d.ts +1 -1
  175. package/lib/chevre/service/offer/eventServiceByCOA.d.ts +2 -2
  176. package/lib/chevre/service/offer/factory.d.ts +2 -2
  177. package/lib/chevre/service/offer/moneyTransfer/authorize.d.ts +1 -1
  178. package/lib/chevre/service/offer/product.d.ts +2 -2
  179. package/lib/chevre/service/order/onOrderStatusChanged/factory.d.ts +1 -1
  180. package/lib/chevre/service/order/onOrderStatusChanged/factory.js +6 -1
  181. package/lib/chevre/service/order/onOrderStatusChanged.d.ts +2 -2
  182. package/lib/chevre/service/order/placeOrder.d.ts +1 -1
  183. package/lib/chevre/service/order/sendOrder.d.ts +1 -1
  184. package/lib/chevre/service/payment/any/factory.d.ts +1 -1
  185. package/lib/chevre/service/payment/any/onPaymentStatusChanged/onPaid.d.ts +1 -1
  186. package/lib/chevre/service/payment/any/onPaymentStatusChanged/onRefunded.d.ts +1 -1
  187. package/lib/chevre/service/payment/any.d.ts +3 -3
  188. package/lib/chevre/service/payment/creditCard.js +5 -0
  189. package/lib/chevre/service/payment/movieTicket.d.ts +4 -4
  190. package/lib/chevre/service/payment/paymentCard.d.ts +1 -1
  191. package/lib/chevre/service/permit.d.ts +1 -1
  192. package/lib/chevre/service/report/ownershipInfo.js +4 -0
  193. package/lib/chevre/service/report/telemetry.d.ts +7 -7
  194. package/lib/chevre/service/reserve/cancelReservation.d.ts +1 -1
  195. package/lib/chevre/service/reserve/factory.d.ts +5 -5
  196. package/lib/chevre/service/reserve/potentialActions/onReservationCanceled.d.ts +1 -1
  197. package/lib/chevre/service/reserve/potentialActions/onReservationConfirmed.d.ts +1 -1
  198. package/lib/chevre/service/reserve/potentialActions/onReservationUsed.d.ts +2 -2
  199. package/lib/chevre/service/task/aggregateScreeningEvent.d.ts +1 -1
  200. package/lib/chevre/service/task/aggregateUseActionsOnEvent.d.ts +1 -1
  201. package/lib/chevre/service/task/cancelMoneyTransfer.d.ts +1 -1
  202. package/lib/chevre/service/task/cancelPendingReservation.d.ts +1 -1
  203. package/lib/chevre/service/task/cancelReservation.d.ts +1 -1
  204. package/lib/chevre/service/task/importEventCapacitiesFromCOA.d.ts +1 -1
  205. package/lib/chevre/service/task/importEventsFromCOA.d.ts +1 -1
  206. package/lib/chevre/service/task/importOffersFromCOA.d.ts +1 -1
  207. package/lib/chevre/service/task/moneyTransfer.d.ts +1 -1
  208. package/lib/chevre/service/task/registerService.d.ts +1 -1
  209. package/lib/chevre/service/task/reserve.d.ts +1 -1
  210. package/lib/chevre/service/task.d.ts +2 -2
  211. package/lib/chevre/service/task.js +1 -1
  212. package/lib/chevre/service/transaction/moneyTransfer/potentialActions.d.ts +1 -1
  213. package/lib/chevre/service/transaction/moneyTransfer.d.ts +6 -6
  214. package/lib/chevre/service/transaction/moneyTransfer.js +0 -5
  215. package/lib/chevre/service/transaction/orderProgramMembership.d.ts +1 -1
  216. package/lib/chevre/service/transaction/placeOrder/exportTasks/factory.d.ts +1 -1
  217. package/lib/chevre/service/transaction/placeOrder.d.ts +1 -1
  218. package/lib/chevre/service/transaction/placeOrderInProgress/potentialActions/moneyTransfer.d.ts +1 -1
  219. package/lib/chevre/service/transaction/placeOrderInProgress/result/acceptedOffers.d.ts +2 -2
  220. package/lib/chevre/service/transaction/placeOrderInProgress/result.d.ts +1 -1
  221. package/lib/chevre/service/transaction/placeOrderInProgress/validation.d.ts +8 -8
  222. package/lib/chevre/service/transaction/placeOrderInProgress.d.ts +7 -7
  223. package/lib/chevre/service/transaction/placeOrderInProgress.js +2 -2
  224. package/lib/chevre/service/transaction/returnOrder/potentialActions/returnMoneyTransfer.d.ts +1 -1
  225. package/lib/chevre/service/transaction/returnOrder/potentialActions/returnPointAward.d.ts +1 -1
  226. package/lib/chevre/service/transaction/returnOrder/potentialActions.d.ts +1 -1
  227. package/lib/chevre/service/transaction/returnOrder.d.ts +2 -2
  228. package/lib/chevre/service/transaction/returnOrder.js +1 -1
  229. package/lib/chevre/service/transaction/validation.d.ts +2 -2
  230. package/lib/chevre/service/transaction.d.ts +2 -2
  231. package/lib/chevre/settings.d.ts +1 -1
  232. package/package.json +11 -11
  233. package/lib/chevre/repo/mongoose/model/account.d.ts +0 -30
  234. package/lib/chevre/repo/mongoose/model/accountTitle.d.ts +0 -40
  235. package/lib/chevre/repo/mongoose/model/accountTransaction.d.ts +0 -43
  236. package/lib/chevre/repo/mongoose/model/accountingReport.d.ts +0 -34
  237. package/lib/chevre/repo/mongoose/model/action.d.ts +0 -49
  238. package/lib/chevre/repo/mongoose/model/additionalProperty.d.ts +0 -36
  239. package/lib/chevre/repo/mongoose/model/aggregation.d.ts +0 -30
  240. package/lib/chevre/repo/mongoose/model/assetTransaction.d.ts +0 -48
  241. package/lib/chevre/repo/mongoose/model/authorization.d.ts +0 -37
  242. package/lib/chevre/repo/mongoose/model/categoryCode.d.ts +0 -40
  243. package/lib/chevre/repo/mongoose/model/comments.d.ts +0 -41
  244. package/lib/chevre/repo/mongoose/model/creativeWork.d.ts +0 -49
  245. package/lib/chevre/repo/mongoose/model/customer.d.ts +0 -40
  246. package/lib/chevre/repo/mongoose/model/emailMessages.d.ts +0 -38
  247. package/lib/chevre/repo/mongoose/model/member.d.ts +0 -34
  248. package/lib/chevre/repo/mongoose/model/merchantReturnPolicy.d.ts +0 -38
  249. package/lib/chevre/repo/mongoose/model/offer.d.ts +0 -59
  250. package/lib/chevre/repo/mongoose/model/offerCatalog.d.ts +0 -40
  251. package/lib/chevre/repo/mongoose/model/order.d.ts +0 -53
  252. package/lib/chevre/repo/mongoose/model/ownershipInfo.d.ts +0 -40
  253. package/lib/chevre/repo/mongoose/model/place.d.ts +0 -52
  254. package/lib/chevre/repo/mongoose/model/priceSpecification.d.ts +0 -42
  255. package/lib/chevre/repo/mongoose/model/product.d.ts +0 -43
  256. package/lib/chevre/repo/mongoose/model/project.d.ts +0 -39
  257. package/lib/chevre/repo/mongoose/model/role.d.ts +0 -33
  258. package/lib/chevre/repo/mongoose/model/seller.d.ts +0 -43
  259. package/lib/chevre/repo/mongoose/model/serviceOutput.d.ts +0 -33
  260. package/lib/chevre/repo/mongoose/model/task.d.ts +0 -41
  261. package/lib/chevre/repo/mongoose/model/telemetry.d.ts +0 -38
  262. package/lib/chevre/repo/mongoose/model/transaction.d.ts +0 -46
  263. package/lib/chevre/repo/mongoose/model/trip.d.ts +0 -33
@@ -9,10 +9,10 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
9
9
  });
10
10
  };
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.MongoRepository = exports.modelName = void 0;
12
+ exports.MongoRepository = void 0;
13
13
  const uuid = require("uuid");
14
- const ownershipInfo_1 = require("./mongoose/model/ownershipInfo");
15
- Object.defineProperty(exports, "modelName", { enumerable: true, get: function () { return ownershipInfo_1.modelName; } });
14
+ const onIndexCreated_1 = require("./mongoose/onIndexCreated");
15
+ const ownershipInfo_1 = require("./mongoose/schemas/ownershipInfo");
16
16
  const errorHandler_1 = require("../errorHandler");
17
17
  const factory = require("../factory");
18
18
  /**
@@ -20,7 +20,10 @@ const factory = require("../factory");
20
20
  */
21
21
  class MongoRepository {
22
22
  constructor(connection) {
23
- this.ownershipInfoModel = connection.model(ownershipInfo_1.modelName);
23
+ this.ownershipInfoModel = connection.model(ownershipInfo_1.modelName, ownershipInfo_1.schema);
24
+ if (connection.get('autoIndex') === true) {
25
+ this.ownershipInfoModel.on(onIndexCreated_1.INDEX_EVENT, onIndexCreated_1.onIndexCreated);
26
+ }
24
27
  }
25
28
  // tslint:disable-next-line:cyclomatic-complexity max-func-body-length
26
29
  static CREATE_MONGO_CONDITIONS(params) {
@@ -242,7 +245,7 @@ class MongoRepository {
242
245
  .exec();
243
246
  }
244
247
  catch (error) {
245
- if (error.name === 'MongoError') {
248
+ if ((0, errorHandler_1.isMongoError)(error)) {
246
249
  // すでに所有権が存在する場合ok
247
250
  if (error.code === errorHandler_1.MongoErrorCode.DuplicateKey) {
248
251
  duplicate = true;
@@ -291,8 +294,8 @@ class MongoRepository {
291
294
  return __awaiter(this, void 0, void 0, function* () {
292
295
  const conditions = MongoRepository.CREATE_MONGO_CONDITIONS(params);
293
296
  const query = this.ownershipInfoModel.find((conditions.length > 0) ? { $and: conditions } : {}, Object.assign({ __v: 0, createdAt: 0, updatedAt: 0 }, projection));
294
- if (typeof params.limit === 'number') {
295
- const page = (typeof params.page === 'number') ? params.page : 1;
297
+ if (typeof params.limit === 'number' && params.limit > 0) {
298
+ const page = (typeof params.page === 'number' && params.page > 0) ? params.page : 1;
296
299
  query.limit(params.limit)
297
300
  .skip(params.limit * (page - 1));
298
301
  }
@@ -1,8 +1,8 @@
1
1
  import * as GMO from '@motionpicture/gmo-service';
2
2
  import * as factory from '../../factory';
3
- export declare type IUncheckedCardRaw = factory.paymentMethod.paymentCard.creditCard.IUncheckedCardRaw;
4
- export declare type IUncheckedCardTokenized = factory.paymentMethod.paymentCard.creditCard.IUncheckedCardTokenized;
5
- export declare type ISearchCardResult = GMO.factory.card.ISearchCardResult;
3
+ export type IUncheckedCardRaw = factory.paymentMethod.paymentCard.creditCard.IUncheckedCardRaw;
4
+ export type IUncheckedCardTokenized = factory.paymentMethod.paymentCard.creditCard.IUncheckedCardTokenized;
5
+ export type ISearchCardResult = GMO.factory.card.ISearchCardResult;
6
6
  export interface IOptions {
7
7
  /**
8
8
  * GMOサイトID
@@ -10,14 +10,18 @@ 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 serviceOutput_1 = require("./mongoose/model/serviceOutput");
13
+ const onIndexCreated_1 = require("./mongoose/onIndexCreated");
14
+ const serviceOutput_1 = require("./mongoose/schemas/serviceOutput");
14
15
  const factory = require("../factory");
15
16
  /**
16
17
  * 許可証リポジトリ
17
18
  */
18
19
  class MongoRepository {
19
20
  constructor(connection) {
20
- this.serviceOutputModel = connection.model(serviceOutput_1.modelName);
21
+ this.serviceOutputModel = connection.model(serviceOutput_1.modelName, serviceOutput_1.schema);
22
+ if (connection.get('autoIndex') === true) {
23
+ this.serviceOutputModel.on(onIndexCreated_1.INDEX_EVENT, onIndexCreated_1.onIndexCreated);
24
+ }
21
25
  }
22
26
  findByIdentifier(params, projection) {
23
27
  var _a, _b;
@@ -1,7 +1,7 @@
1
1
  import * as AWS from 'aws-sdk';
2
2
  import * as factory from '../factory';
3
- export declare type AttributeListType = AWS.CognitoIdentityServiceProvider.AttributeListType;
4
- export declare type IPerson = factory.person.IPerson;
3
+ export type AttributeListType = AWS.CognitoIdentityServiceProvider.AttributeListType;
4
+ export type IPerson = factory.person.IPerson;
5
5
  /**
6
6
  * 会員リポジトリ
7
7
  */
@@ -24,8 +24,8 @@
24
24
  /// <reference types="mongoose/types/inferschematype" />
25
25
  import { Connection } from 'mongoose';
26
26
  import * as factory from '../factory';
27
- declare type IScreeningRoomSectionWithoutContainsPlace = Omit<factory.place.screeningRoomSection.IPlace, 'containsPlace'>;
28
- export declare type IScreeningRoomFoundByBranchCode = Pick<factory.place.screeningRoom.IPlace, 'typeOf' | 'branchCode' | 'name' | 'containsPlace'>;
27
+ type IScreeningRoomSectionWithoutContainsPlace = Omit<factory.place.screeningRoomSection.IPlace, 'containsPlace'>;
28
+ export type IScreeningRoomFoundByBranchCode = Pick<factory.place.screeningRoom.IPlace, 'typeOf' | 'branchCode' | 'name' | 'containsPlace'>;
29
29
  /**
30
30
  * 施設リポジトリ
31
31
  */
@@ -22,14 +22,18 @@ var __rest = (this && this.__rest) || function (s, e) {
22
22
  Object.defineProperty(exports, "__esModule", { value: true });
23
23
  exports.MongoRepository = void 0;
24
24
  const mongoose_1 = require("mongoose");
25
- const place_1 = require("./mongoose/model/place");
25
+ const onIndexCreated_1 = require("./mongoose/onIndexCreated");
26
+ const place_1 = require("./mongoose/schemas/place");
26
27
  const factory = require("../factory");
27
28
  /**
28
29
  * 施設リポジトリ
29
30
  */
30
31
  class MongoRepository {
31
32
  constructor(connection) {
32
- this.placeModel = connection.model(place_1.modelName);
33
+ this.placeModel = connection.model(place_1.modelName, place_1.schema);
34
+ if (connection.get('autoIndex') === true) {
35
+ this.placeModel.on(onIndexCreated_1.INDEX_EVENT, onIndexCreated_1.onIndexCreated);
36
+ }
33
37
  }
34
38
  // tslint:disable-next-line:max-func-body-length
35
39
  static CREATE_BUS_STOP_MONGO_CONDITIONS(params) {
@@ -278,8 +282,8 @@ class MongoRepository {
278
282
  updatedAt: 0,
279
283
  containsPlace: 0
280
284
  });
281
- if (typeof params.limit === 'number') {
282
- const page = (typeof params.page === 'number') ? params.page : 1;
285
+ if (typeof params.limit === 'number' && params.limit > 0) {
286
+ const page = (typeof params.page === 'number' && params.page > 0) ? params.page : 1;
283
287
  query.limit(params.limit)
284
288
  .skip(params.limit * (page - 1));
285
289
  }
@@ -629,8 +633,8 @@ class MongoRepository {
629
633
  ]);
630
634
  // tslint:disable-next-line:no-single-line-block-comment
631
635
  /* istanbul ignore else */
632
- if (typeof searchConditions.limit === 'number') {
633
- const page = (typeof searchConditions.page === 'number') ? searchConditions.page : 1;
636
+ if (typeof searchConditions.limit === 'number' && searchConditions.limit > 0) {
637
+ const page = (typeof searchConditions.page === 'number' && searchConditions.page > 0) ? searchConditions.page : 1;
634
638
  aggregate.limit(searchConditions.limit * page)
635
639
  .skip(searchConditions.limit * (page - 1));
636
640
  }
@@ -805,8 +809,8 @@ class MongoRepository {
805
809
  ]);
806
810
  // tslint:disable-next-line:no-single-line-block-comment
807
811
  /* istanbul ignore else */
808
- if (typeof searchConditions.limit === 'number') {
809
- const page = (typeof searchConditions.page === 'number') ? searchConditions.page : 1;
812
+ if (typeof searchConditions.limit === 'number' && searchConditions.limit > 0) {
813
+ const page = (typeof searchConditions.page === 'number' && searchConditions.page > 0) ? searchConditions.page : 1;
810
814
  aggregate.limit(searchConditions.limit * page)
811
815
  .skip(searchConditions.limit * (page - 1));
812
816
  }
@@ -1142,8 +1146,8 @@ class MongoRepository {
1142
1146
  }
1143
1147
  }
1144
1148
  ]);
1145
- if (typeof params.limit === 'number') {
1146
- const page = (typeof params.page === 'number') ? params.page : 1;
1149
+ if (typeof params.limit === 'number' && params.limit > 0) {
1150
+ const page = (typeof params.page === 'number' && params.page > 0) ? params.page : 1;
1147
1151
  aggregate.limit(params.limit * page)
1148
1152
  .skip(params.limit * (page - 1));
1149
1153
  }
@@ -1230,8 +1234,8 @@ class MongoRepository {
1230
1234
  updatedAt: 0,
1231
1235
  containsPlace: 0
1232
1236
  });
1233
- if (typeof params.limit === 'number') {
1234
- const page = (typeof params.page === 'number') ? params.page : 1;
1237
+ if (typeof params.limit === 'number' && params.limit > 0) {
1238
+ const page = (typeof params.page === 'number' && params.page > 0) ? params.page : 1;
1235
1239
  query.limit(params.limit)
1236
1240
  .skip(params.limit * (page - 1));
1237
1241
  }
@@ -22,13 +22,17 @@ var __rest = (this && this.__rest) || function (s, e) {
22
22
  Object.defineProperty(exports, "__esModule", { value: true });
23
23
  exports.MongoRepository = void 0;
24
24
  const factory = require("../factory");
25
- const priceSpecification_1 = require("./mongoose/model/priceSpecification");
25
+ const onIndexCreated_1 = require("./mongoose/onIndexCreated");
26
+ const priceSpecification_1 = require("./mongoose/schemas/priceSpecification");
26
27
  /**
27
28
  * 価格仕様リポジトリ
28
29
  */
29
30
  class MongoRepository {
30
31
  constructor(connection) {
31
- this.priceSpecificationModel = connection.model(priceSpecification_1.modelName);
32
+ this.priceSpecificationModel = connection.model(priceSpecification_1.modelName, priceSpecification_1.schema);
33
+ if (connection.get('autoIndex') === true) {
34
+ this.priceSpecificationModel.on(onIndexCreated_1.INDEX_EVENT, onIndexCreated_1.onIndexCreated);
35
+ }
32
36
  }
33
37
  // tslint:disable-next-line:cyclomatic-complexity max-func-body-length
34
38
  static CREATE_MONGO_CONDITIONS(params) {
@@ -169,8 +173,8 @@ class MongoRepository {
169
173
  createdAt: 0,
170
174
  updatedAt: 0
171
175
  });
172
- if (typeof params.limit === 'number') {
173
- const page = (typeof params.page === 'number') ? params.page : 1;
176
+ if (typeof params.limit === 'number' && params.limit > 0) {
177
+ const page = (typeof params.page === 'number' && params.page > 0) ? params.page : 1;
174
178
  query.limit(params.limit)
175
179
  .skip(params.limit * (page - 1));
176
180
  }
@@ -24,7 +24,7 @@
24
24
  /// <reference types="mongoose/types/inferschematype" />
25
25
  import { Connection } from 'mongoose';
26
26
  import * as factory from '../factory';
27
- export declare type IProduct = factory.product.IProduct | factory.service.paymentService.IService;
27
+ export type IProduct = factory.product.IProduct | factory.service.paymentService.IService;
28
28
  /**
29
29
  * プロダクトリポジトリ
30
30
  */
@@ -21,14 +21,18 @@ var __rest = (this && this.__rest) || function (s, e) {
21
21
  };
22
22
  Object.defineProperty(exports, "__esModule", { value: true });
23
23
  exports.MongoRepository = void 0;
24
- const product_1 = require("./mongoose/model/product");
24
+ const onIndexCreated_1 = require("./mongoose/onIndexCreated");
25
+ const product_1 = require("./mongoose/schemas/product");
25
26
  const factory = require("../factory");
26
27
  /**
27
28
  * プロダクトリポジトリ
28
29
  */
29
30
  class MongoRepository {
30
31
  constructor(connection) {
31
- this.productModel = connection.model(product_1.modelName);
32
+ this.productModel = connection.model(product_1.modelName, product_1.schema);
33
+ if (connection.get('autoIndex') === true) {
34
+ this.productModel.on(onIndexCreated_1.INDEX_EVENT, onIndexCreated_1.onIndexCreated);
35
+ }
32
36
  }
33
37
  // tslint:disable-next-line:max-func-body-length
34
38
  static CREATE_MONGO_CONDITIONS(params) {
@@ -160,8 +164,8 @@ class MongoRepository {
160
164
  return __awaiter(this, void 0, void 0, function* () {
161
165
  const andConditions = MongoRepository.CREATE_MONGO_CONDITIONS(conditions);
162
166
  const query = this.productModel.find((andConditions.length > 0) ? { $and: andConditions } : {}, Object.assign({ __v: 0, createdAt: 0, updatedAt: 0 }, projection));
163
- if (typeof conditions.limit === 'number') {
164
- const page = (typeof conditions.page === 'number') ? conditions.page : 1;
167
+ if (typeof conditions.limit === 'number' && conditions.limit > 0) {
168
+ const page = (typeof conditions.page === 'number' && conditions.page > 0) ? conditions.page : 1;
165
169
  query.limit(conditions.limit)
166
170
  .skip(conditions.limit * (page - 1));
167
171
  }
@@ -10,7 +10,8 @@ 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 project_1 = require("./mongoose/model/project");
13
+ const onIndexCreated_1 = require("./mongoose/onIndexCreated");
14
+ const project_1 = require("./mongoose/schemas/project");
14
15
  const factory = require("../factory");
15
16
  /**
16
17
  * プロジェクトリポジトリ
@@ -18,6 +19,9 @@ const factory = require("../factory");
18
19
  class MongoRepository {
19
20
  constructor(connection) {
20
21
  this.projectModel = connection.model(project_1.modelName, project_1.schema);
22
+ if (connection.get('autoIndex') === true) {
23
+ this.projectModel.on(onIndexCreated_1.INDEX_EVENT, onIndexCreated_1.onIndexCreated);
24
+ }
21
25
  }
22
26
  static CREATE_MONGO_CONDITIONS(params) {
23
27
  // MongoDB検索条件
@@ -79,8 +83,8 @@ class MongoRepository {
79
83
  return __awaiter(this, void 0, void 0, function* () {
80
84
  const andConditions = MongoRepository.CREATE_MONGO_CONDITIONS(conditions);
81
85
  const query = this.projectModel.find((andConditions.length > 0) ? { $and: andConditions } : {}, Object.assign({ __v: 0, createdAt: 0, updatedAt: 0 }, projection));
82
- if (typeof conditions.limit === 'number') {
83
- const page = (typeof conditions.page === 'number') ? conditions.page : 1;
86
+ if (typeof conditions.limit === 'number' && conditions.limit > 0) {
87
+ const page = (typeof conditions.page === 'number' && conditions.page > 0) ? conditions.page : 1;
84
88
  query.limit(conditions.limit)
85
89
  .skip(conditions.limit * (page - 1));
86
90
  }
@@ -131,5 +131,5 @@ class RedisRepository {
131
131
  });
132
132
  }
133
133
  }
134
- exports.RedisRepository = RedisRepository;
135
134
  RedisRepository.KEY_PREFIX = 'chevre:rateLimit:offer';
135
+ exports.RedisRepository = RedisRepository;
@@ -4,7 +4,7 @@ export interface IUpdatePartiallyParams {
4
4
  additionalTicketText?: string;
5
5
  'reservedTicket.dateUsed'?: Date;
6
6
  }
7
- export declare type ICancelResult = UpdateWriteOpResult;
7
+ export type ICancelResult = UpdateWriteOpResult;
8
8
  /**
9
9
  * 予約リポジトリ
10
10
  */
@@ -10,14 +10,18 @@ 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 reservation_1 = require("./mongoose/model/reservation");
13
+ const onIndexCreated_1 = require("./mongoose/onIndexCreated");
14
+ const reservation_1 = require("./mongoose/schemas/reservation");
14
15
  const factory = require("../factory");
15
16
  /**
16
17
  * 予約リポジトリ
17
18
  */
18
19
  class MongoRepository {
19
20
  constructor(connection) {
20
- this.reservationModel = connection.model(reservation_1.modelName);
21
+ this.reservationModel = connection.model(reservation_1.modelName, reservation_1.schema);
22
+ if (connection.get('autoIndex') === true) {
23
+ this.reservationModel.on(onIndexCreated_1.INDEX_EVENT, onIndexCreated_1.onIndexCreated);
24
+ }
21
25
  }
22
26
  // tslint:disable-next-line:cyclomatic-complexity max-func-body-length
23
27
  static CREATE_MONGO_CONDITIONS(params) {
@@ -867,8 +871,8 @@ class MongoRepository {
867
871
  createdAt: 0,
868
872
  updatedAt: 0
869
873
  });
870
- if (typeof params.limit === 'number') {
871
- const page = (typeof params.page === 'number') ? params.page : 1;
874
+ if (typeof params.limit === 'number' && params.limit > 0) {
875
+ const page = (typeof params.page === 'number' && params.page > 0) ? params.page : 1;
872
876
  query.limit(params.limit)
873
877
  .skip(params.limit * (page - 1));
874
878
  }
@@ -882,23 +886,6 @@ class MongoRepository {
882
886
  .then((docs) => docs.map((doc) => doc.toObject()));
883
887
  });
884
888
  }
885
- // public stream<T extends factory.reservationType>(params: factory.reservation.ISearchConditions<T>): QueryCursor<Document> {
886
- // const conditions = MongoRepository.CREATE_MONGO_CONDITIONS(params);
887
- // const query = this.reservationModel.find((conditions.length > 0) ? { $and: conditions } : {})
888
- // .select({ __v: 0, createdAt: 0, updatedAt: 0 });
889
- // // tslint:disable-next-line:no-single-line-block-comment
890
- // /* istanbul ignore else */
891
- // if (params.limit !== undefined && params.page !== undefined) {
892
- // query.limit(params.limit)
893
- // .skip(params.limit * (params.page - 1));
894
- // }
895
- // // tslint:disable-next-line:no-single-line-block-comment
896
- // /* istanbul ignore else */
897
- // if (params.sort !== undefined) {
898
- // query.sort(params.sort);
899
- // }
900
- // return query.cursor();
901
- // }
902
889
  findById(params) {
903
890
  return __awaiter(this, void 0, void 0, function* () {
904
891
  let projection = {};
@@ -11,7 +11,8 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
12
  exports.MongoRepository = exports.RoleType = void 0;
13
13
  const factory = require("../factory");
14
- const role_1 = require("./mongoose/model/role");
14
+ const onIndexCreated_1 = require("./mongoose/onIndexCreated");
15
+ const role_1 = require("./mongoose/schemas/role");
15
16
  var RoleType;
16
17
  (function (RoleType) {
17
18
  RoleType["OrganizationRole"] = "OrganizationRole";
@@ -21,7 +22,10 @@ var RoleType;
21
22
  */
22
23
  class MongoRepository {
23
24
  constructor(connection) {
24
- this.roleModel = connection.model(role_1.modelName);
25
+ this.roleModel = connection.model(role_1.modelName, role_1.schema);
26
+ if (connection.get('autoIndex') === true) {
27
+ this.roleModel.on(onIndexCreated_1.INDEX_EVENT, onIndexCreated_1.onIndexCreated);
28
+ }
25
29
  }
26
30
  static CREATE_MONGO_CONDITIONS(params) {
27
31
  var _a, _b, _c;
@@ -79,8 +83,8 @@ class MongoRepository {
79
83
  createdAt: 0,
80
84
  updatedAt: 0
81
85
  });
82
- if (typeof params.limit === 'number') {
83
- const page = (typeof params.page === 'number') ? params.page : 1;
86
+ if (typeof params.limit === 'number' && params.limit > 0) {
87
+ const page = (typeof params.page === 'number' && params.page > 0) ? params.page : 1;
84
88
  query.limit(params.limit)
85
89
  .skip(params.limit * (page - 1));
86
90
  }
@@ -24,7 +24,7 @@
24
24
  /// <reference types="mongoose/types/inferschematype" />
25
25
  import { Connection } from 'mongoose';
26
26
  import * as factory from '../factory';
27
- export declare type ISeller = factory.seller.ISeller;
27
+ export type ISeller = factory.seller.ISeller;
28
28
  /**
29
29
  * 販売者リポジトリ
30
30
  */
@@ -21,14 +21,18 @@ var __rest = (this && this.__rest) || function (s, e) {
21
21
  };
22
22
  Object.defineProperty(exports, "__esModule", { value: true });
23
23
  exports.MongoRepository = void 0;
24
- const seller_1 = require("./mongoose/model/seller");
24
+ const onIndexCreated_1 = require("./mongoose/onIndexCreated");
25
+ const seller_1 = require("./mongoose/schemas/seller");
25
26
  const factory = require("../factory");
26
27
  /**
27
28
  * 販売者リポジトリ
28
29
  */
29
30
  class MongoRepository {
30
31
  constructor(connection) {
31
- this.organizationModel = connection.model(seller_1.modelName);
32
+ this.organizationModel = connection.model(seller_1.modelName, seller_1.schema);
33
+ if (connection.get('autoIndex') === true) {
34
+ this.organizationModel.on(onIndexCreated_1.INDEX_EVENT, onIndexCreated_1.onIndexCreated);
35
+ }
32
36
  }
33
37
  // tslint:disable-next-line:max-func-body-length
34
38
  static CREATE_MONGO_CONDITIONS(params) {
@@ -172,8 +176,8 @@ class MongoRepository {
172
176
  return __awaiter(this, void 0, void 0, function* () {
173
177
  const andConditions = MongoRepository.CREATE_MONGO_CONDITIONS(conditions);
174
178
  const query = this.organizationModel.find((andConditions.length > 0) ? { $and: andConditions } : {}, Object.assign({ __v: 0, createdAt: 0, updatedAt: 0 }, projection));
175
- if (typeof conditions.limit === 'number') {
176
- const page = (typeof conditions.page === 'number') ? conditions.page : 1;
179
+ if (typeof conditions.limit === 'number' && conditions.limit > 0) {
180
+ const page = (typeof conditions.page === 'number' && conditions.page > 0) ? conditions.page : 1;
177
181
  query.limit(conditions.limit)
178
182
  .skip(conditions.limit * (page - 1));
179
183
  }
@@ -10,14 +10,18 @@ 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 serviceOutput_1 = require("./mongoose/model/serviceOutput");
13
+ const onIndexCreated_1 = require("./mongoose/onIndexCreated");
14
+ const serviceOutput_1 = require("./mongoose/schemas/serviceOutput");
14
15
  const factory = require("../factory");
15
16
  /**
16
17
  * サービスアウトプットリポジトリ
17
18
  */
18
19
  class MongoRepository {
19
20
  constructor(connection) {
20
- this.serviceOutputModel = connection.model(serviceOutput_1.modelName);
21
+ this.serviceOutputModel = connection.model(serviceOutput_1.modelName, serviceOutput_1.schema);
22
+ if (connection.get('autoIndex') === true) {
23
+ this.serviceOutputModel.on(onIndexCreated_1.INDEX_EVENT, onIndexCreated_1.onIndexCreated);
24
+ }
21
25
  }
22
26
  // tslint:disable-next-line:max-func-body-length
23
27
  static CREATE_MONGO_CONDITIONS(params) {
@@ -118,8 +122,8 @@ class MongoRepository {
118
122
  return __awaiter(this, void 0, void 0, function* () {
119
123
  const conditions = MongoRepository.CREATE_MONGO_CONDITIONS(params);
120
124
  const query = this.serviceOutputModel.find((conditions.length > 0) ? { $and: conditions } : {}, Object.assign({ __v: 0, createdAt: 0, updatedAt: 0 }, projection));
121
- if (typeof params.limit === 'number') {
122
- const page = (typeof params.page === 'number') ? params.page : 1;
125
+ if (typeof params.limit === 'number' && params.limit > 0) {
126
+ const page = (typeof params.page === 'number' && params.page > 0) ? params.page : 1;
123
127
  query.limit(params.limit)
124
128
  .skip(params.limit * (page - 1));
125
129
  }
@@ -79,5 +79,5 @@ class RedisRepository {
79
79
  });
80
80
  }
81
81
  }
82
- exports.RedisRepository = RedisRepository;
83
82
  RedisRepository.REDIS_KEY_PREFIX = 'chevre:serviceOutputIdentifier';
83
+ exports.RedisRepository = RedisRepository;
@@ -12,7 +12,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
12
12
  exports.MongoRepository = void 0;
13
13
  const moment = require("moment");
14
14
  const factory = require("../factory");
15
- const task_1 = require("./mongoose/model/task");
15
+ const onIndexCreated_1 = require("./mongoose/onIndexCreated");
16
+ const task_1 = require("./mongoose/schemas/task");
16
17
  /**
17
18
  * タスク実行時のソート条件
18
19
  */
@@ -25,7 +26,10 @@ const sortOrder4executionOfTasks = {
25
26
  */
26
27
  class MongoRepository {
27
28
  constructor(connection) {
28
- this.taskModel = connection.model(task_1.modelName);
29
+ this.taskModel = connection.model(task_1.modelName, task_1.schema);
30
+ if (connection.get('autoIndex') === true) {
31
+ this.taskModel.on(onIndexCreated_1.INDEX_EVENT, onIndexCreated_1.onIndexCreated);
32
+ }
29
33
  }
30
34
  // tslint:disable-next-line:max-func-body-length
31
35
  static CREATE_MONGO_CONDITIONS(params) {
@@ -309,8 +313,8 @@ class MongoRepository {
309
313
  return __awaiter(this, void 0, void 0, function* () {
310
314
  const conditions = MongoRepository.CREATE_MONGO_CONDITIONS(params);
311
315
  const query = this.taskModel.find((conditions.length > 0) ? { $and: conditions } : {}, Object.assign({ __v: 0, createdAt: 0, updatedAt: 0 }, projection));
312
- if (typeof params.limit === 'number') {
313
- const page = (typeof params.page === 'number') ? params.page : 1;
316
+ if (typeof params.limit === 'number' && params.limit > 0) {
317
+ const page = (typeof params.page === 'number' && params.page > 0) ? params.page : 1;
314
318
  query.limit(params.limit)
315
319
  .skip(params.limit * (page - 1));
316
320
  }
@@ -1,13 +1,17 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.MongoRepository = void 0;
4
- const telemetry_1 = require("./mongoose/model/telemetry");
4
+ const onIndexCreated_1 = require("./mongoose/onIndexCreated");
5
+ const telemetry_1 = require("./mongoose/schemas/telemetry");
5
6
  /**
6
7
  * 測定リポジトリ
7
8
  */
8
9
  class MongoRepository {
9
10
  constructor(connection) {
10
- this.telemetryModel = connection.model(telemetry_1.modelName);
11
+ this.telemetryModel = connection.model(telemetry_1.modelName, telemetry_1.schema);
12
+ if (connection.get('autoIndex') === true) {
13
+ this.telemetryModel.on(onIndexCreated_1.INDEX_EVENT, onIndexCreated_1.onIndexCreated);
14
+ }
11
15
  }
12
16
  }
13
17
  exports.MongoRepository = MongoRepository;
@@ -1,7 +1,5 @@
1
1
  import { Connection } from 'mongoose';
2
2
  import * as factory from '../factory';
3
- import { modelName } from './mongoose/model/transaction';
4
- export { modelName };
5
3
  interface IAggregationByStatus {
6
4
  transactionCount: number;
7
5
  avgDuration: number;
@@ -185,3 +183,4 @@ export declare class MongoRepository {
185
183
  }): Promise<IAggregatePlaceOrder>;
186
184
  private agggregateByStatus;
187
185
  }
186
+ export {};
@@ -9,17 +9,20 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
9
9
  });
10
10
  };
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.MongoRepository = exports.modelName = void 0;
12
+ exports.MongoRepository = void 0;
13
13
  const moment = require("moment");
14
14
  const factory = require("../factory");
15
- const transaction_1 = require("./mongoose/model/transaction");
16
- Object.defineProperty(exports, "modelName", { enumerable: true, get: function () { return transaction_1.modelName; } });
15
+ const onIndexCreated_1 = require("./mongoose/onIndexCreated");
16
+ const transaction_1 = require("./mongoose/schemas/transaction");
17
17
  /**
18
18
  * 取引リポジトリ
19
19
  */
20
20
  class MongoRepository {
21
21
  constructor(connection) {
22
- this.transactionModel = connection.model(transaction_1.modelName);
22
+ this.transactionModel = connection.model(transaction_1.modelName, transaction_1.schema);
23
+ if (connection.get('autoIndex') === true) {
24
+ this.transactionModel.on(onIndexCreated_1.INDEX_EVENT, onIndexCreated_1.onIndexCreated);
25
+ }
23
26
  }
24
27
  // tslint:disable-next-line:cyclomatic-complexity max-func-body-length
25
28
  static CREATE_MONGO_CONDITIONS(params) {
@@ -592,8 +595,8 @@ class MongoRepository {
592
595
  }
593
596
  const query = this.transactionModel.find((conditions.length > 0) ? { $and: conditions } : {})
594
597
  .select(projection);
595
- if (typeof params.limit === 'number') {
596
- const page = (typeof params.page === 'number') ? params.page : 1;
598
+ if (typeof params.limit === 'number' && params.limit > 0) {
599
+ const page = (typeof params.page === 'number' && params.page > 0) ? params.page : 1;
597
600
  query.limit(params.limit)
598
601
  .skip(params.limit * (page - 1));
599
602
  }
@@ -85,5 +85,5 @@ class RedisRepository {
85
85
  });
86
86
  }
87
87
  }
88
- exports.RedisRepository = RedisRepository;
89
88
  RedisRepository.REDIS_KEY_PREFIX = 'chevre:transactionNumber';
89
+ exports.RedisRepository = RedisRepository;
@@ -1,6 +1,6 @@
1
1
  import { Connection } from 'mongoose';
2
2
  import * as factory from '../factory';
3
- export declare type ISearchConditions<T extends factory.tripType> = factory.trip.ISearchConditions<T>;
3
+ export type ISearchConditions<T extends factory.tripType> = factory.trip.ISearchConditions<T>;
4
4
  export interface IAttributes4patchUpdate<T extends factory.tripType> {
5
5
  typeOf: T;
6
6
  }
@@ -22,13 +22,17 @@ var __rest = (this && this.__rest) || function (s, e) {
22
22
  Object.defineProperty(exports, "__esModule", { value: true });
23
23
  exports.MongoRepository = void 0;
24
24
  const factory = require("../factory");
25
- const trip_1 = require("./mongoose/model/trip");
25
+ const onIndexCreated_1 = require("./mongoose/onIndexCreated");
26
+ const trip_1 = require("./mongoose/schemas/trip");
26
27
  /**
27
28
  * トリップリポジトリ
28
29
  */
29
30
  class MongoRepository {
30
31
  constructor(connection) {
31
- this.tripModel = connection.model(trip_1.modelName);
32
+ this.tripModel = connection.model(trip_1.modelName, trip_1.schema);
33
+ if (connection.get('autoIndex') === true) {
34
+ this.tripModel.on(onIndexCreated_1.INDEX_EVENT, onIndexCreated_1.onIndexCreated);
35
+ }
32
36
  }
33
37
  // tslint:disable-next-line:cyclomatic-complexity max-func-body-length
34
38
  static CREATE_MONGO_CONDITIONS(conditions) {
@@ -175,8 +179,8 @@ class MongoRepository {
175
179
  return __awaiter(this, void 0, void 0, function* () {
176
180
  const conditions = MongoRepository.CREATE_MONGO_CONDITIONS(params);
177
181
  const query = this.tripModel.find({ $and: conditions }, Object.assign({ __v: 0, createdAt: 0, updatedAt: 0 }, projection));
178
- if (typeof params.limit === 'number') {
179
- const page = (typeof params.page === 'number') ? params.page : 1;
182
+ if (typeof params.limit === 'number' && params.limit > 0) {
183
+ const page = (typeof params.page === 'number' && params.page > 0) ? params.page : 1;
180
184
  query.limit(params.limit)
181
185
  .skip(params.limit * (page - 1));
182
186
  }
@@ -5,7 +5,7 @@
5
5
  import * as factory from '../factory';
6
6
  import { MongoRepository as AccountRepo } from '../repo/account';
7
7
  import { MongoRepository as AccountTransactionRepo } from '../repo/accountTransaction';
8
- export declare type IOpenOperation<T> = (repos: {
8
+ export type IOpenOperation<T> = (repos: {
9
9
  account: AccountRepo;
10
10
  }) => Promise<T>;
11
11
  /**