@chevre/domain 22.2.0-alpha.9 → 22.3.0-alpha.0

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 (249) hide show
  1. package/example/src/chevre/createProject.ts +19 -0
  2. package/example/src/chevre/findValidAuthorization.ts +1 -2
  3. package/example/src/chevre/migrateDeleteTransactionTasks.ts +1 -1
  4. package/example/src/chevre/{migrateMovieTheaterAdditionalProperties.ts → migrateRoomAdditionalProperties.ts} +17 -17
  5. package/example/src/chevre/migrateRoomSectionAdditionalProperties.ts +119 -0
  6. package/example/src/chevre/playAroundTicket.ts +3 -2
  7. package/example/src/chevre/processAction.ts +3 -1
  8. package/example/src/chevre/projectFields.ts +42 -0
  9. package/example/src/chevre/{projectEventFieldsById.ts → projectFieldsById.ts} +7 -12
  10. package/example/src/chevre/searchActionsByPurpose.ts +38 -0
  11. package/example/src/chevre/searchProjects.ts +9 -4
  12. package/example/src/chevre/searchSellersByAggregate.ts +3 -3
  13. package/example/src/chevre/searchTransactions.ts +1 -1
  14. package/example/src/chevre/unsetUnnecessaryFields.ts +2 -41
  15. package/lib/chevre/repo/accountTitle.d.ts +9 -3
  16. package/lib/chevre/repo/accountingReport.d.ts +2 -15
  17. package/lib/chevre/repo/action.d.ts +110 -47
  18. package/lib/chevre/repo/action.js +170 -133
  19. package/lib/chevre/repo/aggregateReservation.d.ts +1 -14
  20. package/lib/chevre/repo/assetTransaction.d.ts +134 -7
  21. package/lib/chevre/repo/assetTransaction.js +2 -2
  22. package/lib/chevre/repo/categoryCode.d.ts +14 -2
  23. package/lib/chevre/repo/categoryCode.js +47 -19
  24. package/lib/chevre/repo/comment.d.ts +5 -1
  25. package/lib/chevre/repo/creativeWork.d.ts +14 -2
  26. package/lib/chevre/repo/customer.d.ts +5 -1
  27. package/lib/chevre/repo/customerType.d.ts +1 -1
  28. package/lib/chevre/repo/event.d.ts +49 -2
  29. package/lib/chevre/repo/member.d.ts +5 -1
  30. package/lib/chevre/repo/merchantReturnPolicy.d.ts +22 -2
  31. package/lib/chevre/repo/message.d.ts +1 -15
  32. package/lib/chevre/repo/mongoose/schemas/account.d.ts +8 -3
  33. package/lib/chevre/repo/mongoose/schemas/account.js +1 -1
  34. package/lib/chevre/repo/mongoose/schemas/accountTitle.d.ts +8 -3
  35. package/lib/chevre/repo/mongoose/schemas/accountTitle.js +2 -2
  36. package/lib/chevre/repo/mongoose/schemas/accountTransaction.d.ts +8 -3
  37. package/lib/chevre/repo/mongoose/schemas/accountTransaction.js +1 -1
  38. package/lib/chevre/repo/mongoose/schemas/accountingReport.d.ts +22 -3
  39. package/lib/chevre/repo/mongoose/schemas/accountingReport.js +1 -1
  40. package/lib/chevre/repo/mongoose/schemas/action.d.ts +8 -3
  41. package/lib/chevre/repo/mongoose/schemas/action.js +1 -1
  42. package/lib/chevre/repo/mongoose/schemas/actionRecipe.d.ts +14 -3
  43. package/lib/chevre/repo/mongoose/schemas/actionRecipe.js +2 -5
  44. package/lib/chevre/repo/mongoose/schemas/additionalProperty.d.ts +8 -3
  45. package/lib/chevre/repo/mongoose/schemas/additionalProperty.js +12 -12
  46. package/lib/chevre/repo/mongoose/schemas/aggregateOffer.d.ts +11 -3
  47. package/lib/chevre/repo/mongoose/schemas/aggregateOffer.js +1 -1
  48. package/lib/chevre/repo/mongoose/schemas/aggregateReservation.d.ts +22 -3
  49. package/lib/chevre/repo/mongoose/schemas/aggregateReservation.js +1 -1
  50. package/lib/chevre/repo/mongoose/schemas/aggregation.d.ts +7 -3
  51. package/lib/chevre/repo/mongoose/schemas/aggregation.js +2 -1
  52. package/lib/chevre/repo/mongoose/schemas/assetTransaction.d.ts +10 -3
  53. package/lib/chevre/repo/mongoose/schemas/assetTransaction.js +1 -1
  54. package/lib/chevre/repo/mongoose/schemas/authorization.d.ts +8 -3
  55. package/lib/chevre/repo/mongoose/schemas/authorization.js +1 -1
  56. package/lib/chevre/repo/mongoose/schemas/categoryCode.d.ts +8 -3
  57. package/lib/chevre/repo/mongoose/schemas/categoryCode.js +22 -24
  58. package/lib/chevre/repo/mongoose/schemas/comments.d.ts +8 -3
  59. package/lib/chevre/repo/mongoose/schemas/comments.js +1 -1
  60. package/lib/chevre/repo/mongoose/schemas/creativeWork.d.ts +10 -3
  61. package/lib/chevre/repo/mongoose/schemas/creativeWork.js +2 -2
  62. package/lib/chevre/repo/mongoose/schemas/customer.d.ts +8 -3
  63. package/lib/chevre/repo/mongoose/schemas/customer.js +1 -1
  64. package/lib/chevre/repo/mongoose/schemas/customerType.d.ts +9 -3
  65. package/lib/chevre/repo/mongoose/schemas/customerType.js +1 -1
  66. package/lib/chevre/repo/mongoose/schemas/emailMessages.d.ts +8 -3
  67. package/lib/chevre/repo/mongoose/schemas/emailMessages.js +1 -1
  68. package/lib/chevre/repo/mongoose/schemas/event.d.ts +19 -3
  69. package/lib/chevre/repo/mongoose/schemas/event.js +1 -1
  70. package/lib/chevre/repo/mongoose/schemas/member.d.ts +8 -3
  71. package/lib/chevre/repo/mongoose/schemas/member.js +1 -1
  72. package/lib/chevre/repo/mongoose/schemas/merchantReturnPolicy.d.ts +8 -3
  73. package/lib/chevre/repo/mongoose/schemas/merchantReturnPolicy.js +1 -1
  74. package/lib/chevre/repo/mongoose/schemas/message.d.ts +23 -3
  75. package/lib/chevre/repo/mongoose/schemas/message.js +1 -1
  76. package/lib/chevre/repo/mongoose/schemas/note.d.ts +8 -3
  77. package/lib/chevre/repo/mongoose/schemas/note.js +1 -1
  78. package/lib/chevre/repo/mongoose/schemas/offerCatalog.d.ts +12 -3
  79. package/lib/chevre/repo/mongoose/schemas/offerCatalog.js +1 -1
  80. package/lib/chevre/repo/mongoose/schemas/offerCatalogItem.d.ts +12 -3
  81. package/lib/chevre/repo/mongoose/schemas/offerCatalogItem.js +1 -1
  82. package/lib/chevre/repo/mongoose/schemas/offerItemCondition.d.ts +8 -3
  83. package/lib/chevre/repo/mongoose/schemas/offerItemCondition.js +1 -1
  84. package/lib/chevre/repo/mongoose/schemas/order.d.ts +10 -3
  85. package/lib/chevre/repo/mongoose/schemas/order.js +1 -1
  86. package/lib/chevre/repo/mongoose/schemas/ownershipInfo.d.ts +10 -3
  87. package/lib/chevre/repo/mongoose/schemas/ownershipInfo.js +1 -1
  88. package/lib/chevre/repo/mongoose/schemas/paymentService.d.ts +10 -3
  89. package/lib/chevre/repo/mongoose/schemas/paymentService.js +13 -4
  90. package/lib/chevre/repo/mongoose/schemas/place.d.ts +16 -3
  91. package/lib/chevre/repo/mongoose/schemas/place.js +1 -1
  92. package/lib/chevre/repo/mongoose/schemas/priceSpecification.d.ts +11 -3
  93. package/lib/chevre/repo/mongoose/schemas/priceSpecification.js +1 -1
  94. package/lib/chevre/repo/mongoose/schemas/product.d.ts +12 -3
  95. package/lib/chevre/repo/mongoose/schemas/product.js +6 -13
  96. package/lib/chevre/repo/mongoose/schemas/productModel.d.ts +30 -3
  97. package/lib/chevre/repo/mongoose/schemas/productModel.js +1 -1
  98. package/lib/chevre/repo/mongoose/schemas/project.d.ts +12 -3
  99. package/lib/chevre/repo/mongoose/schemas/project.js +3 -3
  100. package/lib/chevre/repo/mongoose/schemas/reservation.d.ts +12 -3
  101. package/lib/chevre/repo/mongoose/schemas/reservation.js +5 -5
  102. package/lib/chevre/repo/mongoose/schemas/role.d.ts +9 -3
  103. package/lib/chevre/repo/mongoose/schemas/role.js +1 -1
  104. package/lib/chevre/repo/mongoose/schemas/seller.d.ts +8 -3
  105. package/lib/chevre/repo/mongoose/schemas/seller.js +22 -24
  106. package/lib/chevre/repo/mongoose/schemas/serviceOutput.d.ts +8 -3
  107. package/lib/chevre/repo/mongoose/schemas/serviceOutput.js +1 -1
  108. package/lib/chevre/repo/mongoose/schemas/task.d.ts +8 -3
  109. package/lib/chevre/repo/mongoose/schemas/task.js +1 -1
  110. package/lib/chevre/repo/mongoose/schemas/telemetry.d.ts +7 -3
  111. package/lib/chevre/repo/mongoose/schemas/telemetry.js +2 -1
  112. package/lib/chevre/repo/mongoose/schemas/ticket.d.ts +26 -3
  113. package/lib/chevre/repo/mongoose/schemas/ticket.js +1 -1
  114. package/lib/chevre/repo/mongoose/schemas/transaction.d.ts +8 -3
  115. package/lib/chevre/repo/mongoose/schemas/transaction.js +2 -2
  116. package/lib/chevre/repo/mongoose/schemas/trip.d.ts +8 -3
  117. package/lib/chevre/repo/mongoose/schemas/trip.js +3 -3
  118. package/lib/chevre/repo/offer.d.ts +13 -4
  119. package/lib/chevre/repo/offerCatalog.d.ts +15 -2
  120. package/lib/chevre/repo/order.d.ts +13 -1
  121. package/lib/chevre/repo/ownershipInfo.d.ts +15 -3
  122. package/lib/chevre/repo/ownershipInfo.js +40 -11
  123. package/lib/chevre/repo/paymentService.d.ts +2 -2
  124. package/lib/chevre/repo/paymentService.js +108 -58
  125. package/lib/chevre/repo/paymentServiceProvider.d.ts +1 -10
  126. package/lib/chevre/repo/place/movieTheater.d.ts +54 -2
  127. package/lib/chevre/repo/priceSpecification.d.ts +42 -1
  128. package/lib/chevre/repo/product.d.ts +8 -3
  129. package/lib/chevre/repo/product.js +67 -33
  130. package/lib/chevre/repo/productModel.d.ts +1 -22
  131. package/lib/chevre/repo/project.d.ts +25 -5
  132. package/lib/chevre/repo/project.js +69 -28
  133. package/lib/chevre/repo/reservation.d.ts +35 -3
  134. package/lib/chevre/repo/reservation.js +1 -1
  135. package/lib/chevre/repo/role.d.ts +2 -9
  136. package/lib/chevre/repo/role.js +20 -10
  137. package/lib/chevre/repo/seller.d.ts +64 -14
  138. package/lib/chevre/repo/seller.js +61 -27
  139. package/lib/chevre/repo/task.d.ts +64 -3
  140. package/lib/chevre/repo/telemetry.d.ts +3 -2
  141. package/lib/chevre/repo/ticket.d.ts +4 -20
  142. package/lib/chevre/repo/ticket.js +23 -10
  143. package/lib/chevre/repo/transaction.d.ts +30 -14
  144. package/lib/chevre/repo/transaction.js +106 -77
  145. package/lib/chevre/service/aggregation/event/aggregateScreeningEvent.js +1 -1
  146. package/lib/chevre/service/aggregation/event/findEventOffers.js +1 -1
  147. package/lib/chevre/service/aggregation/project.js +1 -1
  148. package/lib/chevre/service/assetTransaction/cancelReservation.d.ts +1 -1
  149. package/lib/chevre/service/assetTransaction/cancelReservation.js +2 -2
  150. package/lib/chevre/service/assetTransaction/moneyTransfer.js +1 -1
  151. package/lib/chevre/service/assetTransaction/pay/factory.d.ts +1 -1
  152. package/lib/chevre/service/assetTransaction/pay.js +3 -3
  153. package/lib/chevre/service/assetTransaction/refund/factory.d.ts +1 -1
  154. package/lib/chevre/service/assetTransaction/refund.js +3 -3
  155. package/lib/chevre/service/assetTransaction/registerService.js +4 -6
  156. package/lib/chevre/service/assetTransaction/reserve/start/createSubReservations.js +9 -11
  157. package/lib/chevre/service/assetTransaction/reserve/start/factory/createReservation.js +1 -1
  158. package/lib/chevre/service/assetTransaction/reserve/start.js +1 -3
  159. package/lib/chevre/service/code.d.ts +0 -4
  160. package/lib/chevre/service/code.js +22 -18
  161. package/lib/chevre/service/event.js +4 -4
  162. package/lib/chevre/service/moneyTransfer.js +3 -5
  163. package/lib/chevre/service/notification.js +2 -2
  164. package/lib/chevre/service/offer/event/authorize/factory.d.ts +3 -3
  165. package/lib/chevre/service/offer/event/authorize/factory.js +16 -2
  166. package/lib/chevre/service/offer/event/authorize/processStartReserve4chevre/requestedProgramMembershipUsed2permit.js +2 -2
  167. package/lib/chevre/service/offer/event/authorize/processStartReserve4chevre.d.ts +3 -2
  168. package/lib/chevre/service/offer/event/authorize.d.ts +4 -2
  169. package/lib/chevre/service/offer/event/authorize.js +3 -2
  170. package/lib/chevre/service/offer/event/importFromCOA.js +2 -2
  171. package/lib/chevre/service/offer/event/searchEventTicketOffers.js +4 -12
  172. package/lib/chevre/service/offer/event/voidTransaction.js +2 -2
  173. package/lib/chevre/service/offer/event/voidTransactionByActionId.js +1 -1
  174. package/lib/chevre/service/offer/eventServiceByCOA/acceptOffer/authorize.d.ts +2 -2
  175. package/lib/chevre/service/offer/eventServiceByCOA/acceptOffer/authorize.js +45 -5
  176. package/lib/chevre/service/offer/eventServiceByCOA/acceptOffer/factory.d.ts +3 -3
  177. package/lib/chevre/service/offer/eventServiceByCOA/acceptOffer.js +3 -3
  178. package/lib/chevre/service/offer/eventServiceByCOA/authorize.d.ts +7 -3
  179. package/lib/chevre/service/offer/eventServiceByCOA/authorize.js +10 -5
  180. package/lib/chevre/service/offer/eventServiceByCOA/authorizeByAcceptAction.d.ts +3 -1
  181. package/lib/chevre/service/offer/eventServiceByCOA/changeOffers.d.ts +3 -1
  182. package/lib/chevre/service/offer/eventServiceByCOA/changeOffers.js +14 -6
  183. package/lib/chevre/service/offer/eventServiceByCOA/factory.d.ts +8 -5
  184. package/lib/chevre/service/offer/eventServiceByCOA/validateAcceptedOffers.d.ts +1 -1
  185. package/lib/chevre/service/offer/eventServiceByCOA/validateAcceptedOffers.js +38 -17
  186. package/lib/chevre/service/offer/moneyTransfer/authorize.js +1 -1
  187. package/lib/chevre/service/offer/moneyTransfer/voidTransaction.js +1 -1
  188. package/lib/chevre/service/offer/product/searchProductOffers.js +1 -3
  189. package/lib/chevre/service/offer/product.d.ts +4 -2
  190. package/lib/chevre/service/offer/product.js +12 -12
  191. package/lib/chevre/service/order/findPlaceOrderTransaction.js +1 -1
  192. package/lib/chevre/service/order/onOrderStatusChanged/onOrderCancelled/factory.d.ts +1 -1
  193. package/lib/chevre/service/order/onOrderStatusChanged/onOrderDeliveredPartially/factory.d.ts +1 -1
  194. package/lib/chevre/service/order/onOrderStatusChanged/onOrderInTransit.js +1 -1
  195. package/lib/chevre/service/order/onOrderStatusChanged/onOrderReturned/factory.d.ts +1 -1
  196. package/lib/chevre/service/order/placeOrder/createPlacingOrderFromExistingTransaction.js +3 -3
  197. package/lib/chevre/service/order/placeOrder.js +1 -1
  198. package/lib/chevre/service/order/returnOrder.js +1 -1
  199. package/lib/chevre/service/payment/any/factory.d.ts +1 -1
  200. package/lib/chevre/service/payment/any/onPaid.d.ts +1 -1
  201. package/lib/chevre/service/payment/any/onRefund.d.ts +1 -1
  202. package/lib/chevre/service/payment/any/verifyTicketTokenAsNeeded.d.ts +1 -4
  203. package/lib/chevre/service/payment/any/verifyTicketTokenAsNeeded.js +21 -26
  204. package/lib/chevre/service/payment/any.d.ts +3 -1
  205. package/lib/chevre/service/payment/any.js +21 -13
  206. package/lib/chevre/service/payment/creditCard/authorize/processAuthorizeCreditCard.js +1 -1
  207. package/lib/chevre/service/payment/creditCard/authorize/processAuthorizeCreditCard3ds.js +1 -1
  208. package/lib/chevre/service/payment/creditCard/payCreditCard.d.ts +1 -2
  209. package/lib/chevre/service/payment/creditCard/payCreditCard.js +12 -5
  210. package/lib/chevre/service/payment/creditCard/refundCreditCard.js +13 -3
  211. package/lib/chevre/service/payment/creditCard/voidTransaction.js +1 -1
  212. package/lib/chevre/service/payment/faceToFace.d.ts +2 -2
  213. package/lib/chevre/service/payment/faceToFace.js +28 -10
  214. package/lib/chevre/service/payment/movieTicket/authorize.d.ts +0 -1
  215. package/lib/chevre/service/payment/movieTicket/authorize.js +8 -3
  216. package/lib/chevre/service/payment/movieTicket/payMovieTicket.d.ts +1 -2
  217. package/lib/chevre/service/payment/movieTicket/payMovieTicket.js +12 -4
  218. package/lib/chevre/service/payment/movieTicket/refundMovieTicket.js +15 -4
  219. package/lib/chevre/service/payment/movieTicket/validation.js +1 -1
  220. package/lib/chevre/service/payment/paymentCard.d.ts +2 -2
  221. package/lib/chevre/service/payment/paymentCard.js +29 -16
  222. package/lib/chevre/service/payment.d.ts +1 -1
  223. package/lib/chevre/service/report/telemetry.js +2 -2
  224. package/lib/chevre/service/reserve/cancelReservation.js +1 -1
  225. package/lib/chevre/service/reserve/confirmReservation.js +1 -1
  226. package/lib/chevre/service/task/onAuthorizationCreated.js +20 -16
  227. package/lib/chevre/service/task/onResourceUpdated/onResourceDeleted.js +2 -2
  228. package/lib/chevre/service/task/onResourceUpdated/syncCategoryCode.js +1 -1
  229. package/lib/chevre/service/task/onResourceUpdated.js +16 -4
  230. package/lib/chevre/service/task/publishPaymentUrl.js +4 -0
  231. package/lib/chevre/service/task/returnPayTransaction.js +1 -1
  232. package/lib/chevre/service/transaction/deleteTransaction.js +2 -2
  233. package/lib/chevre/service/transaction/moneyTransfer.js +4 -4
  234. package/lib/chevre/service/transaction/placeOrder/confirm.js +1 -1
  235. package/lib/chevre/service/transaction/placeOrder/exportTasksById.js +1 -1
  236. package/lib/chevre/service/transaction/placeOrder/start/validateStartRequest.d.ts +2 -2
  237. package/lib/chevre/service/transaction/placeOrder/start/validateStartRequest.js +1 -1
  238. package/lib/chevre/service/transaction/placeOrder/start.js +1 -1
  239. package/lib/chevre/service/transaction/returnOrder/preStart.d.ts +2 -2
  240. package/lib/chevre/service/transaction/returnOrder/preStart.js +1 -1
  241. package/lib/chevre/service/transaction/returnOrder.js +2 -2
  242. package/lib/chevre/service/transaction.js +1 -1
  243. package/package.json +4 -4
  244. package/example/src/chevre/findTransactionById.ts +0 -23
  245. package/example/src/chevre/findTransactionInProgressById.ts +0 -23
  246. package/example/src/chevre/migrateTransactionObjectPaymentMethods.ts +0 -154
  247. package/example/src/chevre/projectReservationFields.ts +0 -31
  248. package/example/src/chevre/searchActions.ts +0 -40
  249. package/example/src/chevre/searchProducts.ts +0 -28
@@ -24,6 +24,18 @@ exports.ProductRepo = void 0;
24
24
  const product_1 = require("./mongoose/schemas/product");
25
25
  const factory = require("../factory");
26
26
  const settings_1 = require("../settings");
27
+ const AVAILABLE_PROJECT_FIELDS = [
28
+ 'project',
29
+ 'typeOf',
30
+ 'additionalProperty',
31
+ 'availableChannel',
32
+ 'description',
33
+ 'hasOfferCatalog',
34
+ 'name',
35
+ 'productID',
36
+ 'serviceOutput',
37
+ 'serviceType'
38
+ ];
27
39
  /**
28
40
  * プロダクトリポジトリ
29
41
  */
@@ -33,7 +45,7 @@ class ProductRepo {
33
45
  }
34
46
  // tslint:disable-next-line:max-func-body-length
35
47
  static CREATE_MONGO_CONDITIONS(params) {
36
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x;
48
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v;
37
49
  // MongoDB検索条件
38
50
  const andConditions = [];
39
51
  const projectIdEq = (_b = (_a = params.project) === null || _a === void 0 ? void 0 : _a.id) === null || _b === void 0 ? void 0 : _b.$eq;
@@ -144,38 +156,46 @@ class ProductRepo {
144
156
  ]
145
157
  });
146
158
  }
147
- // プロバイダー条件を追加(2023-06-21~)
148
- const providerIdEq = (_x = (_w = params.provider) === null || _w === void 0 ? void 0 : _w.id) === null || _x === void 0 ? void 0 : _x.$eq;
149
- if (typeof providerIdEq === 'string') {
150
- andConditions.push({ 'provider.id': { $exists: true, $eq: providerIdEq } });
151
- }
159
+ // const providerIdEq = params.provider?.id?.$eq;
160
+ // if (typeof providerIdEq === 'string') {
161
+ // andConditions.push({ 'provider.id': { $exists: true, $eq: providerIdEq } });
162
+ // }
152
163
  return andConditions;
153
164
  }
154
165
  /**
155
166
  * プロダクトを検索する
156
167
  */
157
- searchProducts(conditions, inclusion, exclusion) {
168
+ projectFields(conditions, inclusion, exclusion) {
158
169
  var _a;
159
170
  return __awaiter(this, void 0, void 0, function* () {
160
171
  const andConditions = ProductRepo.CREATE_MONGO_CONDITIONS(conditions);
161
- let projection = {};
172
+ let positiveProjectionFields = AVAILABLE_PROJECT_FIELDS;
162
173
  if (Array.isArray(inclusion) && inclusion.length > 0) {
163
- inclusion.forEach((field) => {
164
- projection[field] = 1;
165
- });
174
+ positiveProjectionFields = inclusion.filter((key) => AVAILABLE_PROJECT_FIELDS.includes(key));
166
175
  }
167
176
  else {
168
- projection = {
169
- __v: 0,
170
- createdAt: 0,
171
- updatedAt: 0
172
- };
173
177
  if (Array.isArray(exclusion) && exclusion.length > 0) {
174
- exclusion.forEach((field) => {
175
- projection[field] = 0;
176
- });
178
+ positiveProjectionFields = positiveProjectionFields.filter((key) => !exclusion.includes(key));
177
179
  }
178
180
  }
181
+ const projection = Object.assign({ _id: 0, id: { $toString: '$_id' } }, Object.fromEntries(positiveProjectionFields.map((key) => ([key, 1]))));
182
+ // let projection: { [key: string]: number } = {};
183
+ // if (Array.isArray(inclusion) && inclusion.length > 0) {
184
+ // inclusion.forEach((field) => {
185
+ // projection[field] = 1;
186
+ // });
187
+ // } else {
188
+ // projection = {
189
+ // __v: 0,
190
+ // createdAt: 0,
191
+ // updatedAt: 0
192
+ // };
193
+ // if (Array.isArray(exclusion) && exclusion.length > 0) {
194
+ // exclusion.forEach((field) => {
195
+ // projection[field] = 0;
196
+ // });
197
+ // }
198
+ // }
179
199
  const query = this.productModel.find((andConditions.length > 0) ? { $and: andConditions } : {}, projection);
180
200
  if (typeof conditions.limit === 'number' && conditions.limit > 0) {
181
201
  const page = (typeof conditions.page === 'number' && conditions.page > 0) ? conditions.page : 1;
@@ -188,13 +208,13 @@ class ProductRepo {
188
208
  query.sort({ productID: conditions.sort.productID });
189
209
  }
190
210
  return query.setOptions({ maxTimeMS: settings_1.MONGO_MAX_TIME_MS })
191
- .exec()
192
- .then((docs) => docs.map((doc) => doc.toObject()));
211
+ .lean() // 2024-08-20~
212
+ .exec();
193
213
  });
194
214
  }
195
215
  deleteProductById(params) {
196
216
  return __awaiter(this, void 0, void 0, function* () {
197
- yield this.productModel.findOneAndDelete({ _id: params.id })
217
+ yield this.productModel.findOneAndDelete({ _id: { $eq: params.id } }, { projection: { _id: 1 } })
198
218
  .exec();
199
219
  });
200
220
  }
@@ -202,11 +222,13 @@ class ProductRepo {
202
222
  * プロダクトを保管する
203
223
  */
204
224
  saveProduct(params) {
225
+ var _a, _b;
205
226
  return __awaiter(this, void 0, void 0, function* () {
206
227
  let doc;
228
+ let savedId;
207
229
  if (typeof params.id === 'string') {
208
230
  // 上書き禁止属性を除外
209
- const _a = params.$set, { id, productID, project, typeOf, offers } = _a, setFields = __rest(_a, ["id", "productID", "project", "typeOf", "offers"]);
231
+ const _c = params.$set, { id, productID, project, typeOf, offers } = _c, setFields = __rest(_c, ["id", "productID", "project", "typeOf", "offers"]);
210
232
  switch (typeOf) {
211
233
  case factory.product.ProductType.EventService:
212
234
  case factory.product.ProductType.MembershipService:
@@ -219,30 +241,43 @@ class ProductRepo {
219
241
  }, {
220
242
  $set: setFields,
221
243
  $unset: params.$unset
222
- }, { upsert: false, new: true, projection: { _id: 1 } })
244
+ }, { upsert: false, new: true, projection: { _id: 1, id: { $toString: '$_id' } } })
245
+ .lean()
223
246
  .exec();
247
+ if (doc === null) {
248
+ throw new factory.errors.NotFound(this.productModel.modelName);
249
+ }
224
250
  break;
225
251
  default:
226
252
  throw new factory.errors.NotImplemented(`${typeOf} not implemented`);
227
253
  }
254
+ savedId = params.id;
228
255
  }
229
256
  else {
230
- const _b = params.$set, { id } = _b, createParams = __rest(_b, ["id"]);
257
+ const _d = params.$set, { id } = _d, createParams = __rest(_d, ["id"]);
231
258
  if (params.createIfNotExist === true) {
232
259
  doc = yield this.productModel.findOneAndUpdate({
233
260
  'project.id': { $eq: createParams.project.id },
234
261
  typeOf: { $eq: createParams.typeOf }
235
- }, { $setOnInsert: createParams }, { new: true, upsert: true, projection: { _id: 1 } })
262
+ }, { $setOnInsert: createParams }, { new: true, upsert: true, projection: { _id: 1, id: { $toString: '$_id' } } })
263
+ .lean()
236
264
  .exec();
265
+ if (doc === null) {
266
+ throw new factory.errors.NotFound(this.productModel.modelName);
267
+ }
268
+ savedId = doc.id;
237
269
  }
238
270
  else {
239
- doc = yield this.productModel.create(createParams);
271
+ // doc = await this.productModel.create(createParams);
272
+ const result = yield this.productModel.insertMany(createParams, { rawResult: true });
273
+ const insertedId = (_b = (_a = result.insertedIds) === null || _a === void 0 ? void 0 : _a[0]) === null || _b === void 0 ? void 0 : _b.toHexString();
274
+ if (typeof insertedId !== 'string') {
275
+ throw new factory.errors.Internal(`product not saved unexpectedly. result:${JSON.stringify(result)}`);
276
+ }
277
+ savedId = insertedId;
240
278
  }
241
279
  }
242
- if (doc === null) {
243
- throw new factory.errors.NotFound(this.productModel.modelName);
244
- }
245
- return doc.toObject();
280
+ return { id: savedId };
246
281
  });
247
282
  }
248
283
  /**
@@ -297,8 +332,7 @@ class ProductRepo {
297
332
  */
298
333
  findAvailableChannel(params) {
299
334
  return __awaiter(this, void 0, void 0, function* () {
300
- let paymentService;
301
- paymentService = (yield this.searchProducts({
335
+ const paymentService = (yield this.projectFields({
302
336
  limit: 1,
303
337
  page: 1,
304
338
  project: { id: { $eq: params.project.id } },
@@ -1,27 +1,6 @@
1
1
  import type { Connection, FilterQuery } from 'mongoose';
2
2
  import * as factory from '../factory';
3
- interface IProductModel {
4
- id?: string;
5
- project: {
6
- id: string;
7
- typeOf: factory.organizationType.Project;
8
- };
9
- typeOf: 'ProductModel';
10
- category: Pick<factory.categoryCode.ICategoryCode, 'codeValue' | 'inCodeSet'> & {
11
- /**
12
- * 区分ID
13
- * 削除時同期に必要
14
- */
15
- id: string;
16
- };
17
- name: factory.multilingualString;
18
- offers: {
19
- typeOf: factory.offerType.Offer;
20
- eligibleCustomerType?: {
21
- codeValue: string;
22
- }[];
23
- }[];
24
- }
3
+ import { IProductModel } from './mongoose/schemas/productModel';
25
4
  type IKeyOfProjection = keyof IProductModel | '_id';
26
5
  type ISearchConditions = Pick<factory.product.ISearchConditions, 'id' | 'limit' | 'page' | 'project'> & {
27
6
  category?: {
@@ -24,7 +24,7 @@
24
24
  /// <reference types="mongoose/types/inferschematype" />
25
25
  import type { Connection, FilterQuery } from 'mongoose';
26
26
  import * as factory from '../factory';
27
- type IKeyOfProjection = keyof factory.project.IProject | '_id';
27
+ type IKeyOfProjection = keyof factory.project.IProject;
28
28
  /**
29
29
  * プロジェクトリポジトリ
30
30
  * makesOfferについてはsee ProjectMakesOfferRepo
@@ -44,9 +44,9 @@ export declare class ProjectRepo {
44
44
  /**
45
45
  * プロジェクト検索
46
46
  */
47
- search(conditions: factory.project.ISearchConditions, inclusion: IKeyOfProjection[], exclusion: IKeyOfProjection[]): Promise<factory.project.IProject[]>;
48
- createById(params: factory.project.IProject): Promise<factory.project.IProject>;
49
- findByIdAndIUpdate(params: {
47
+ projectFields(conditions: factory.project.ISearchConditions, inclusion: IKeyOfProjection[], exclusion: IKeyOfProjection[]): Promise<factory.project.IProject[]>;
48
+ createById(params: factory.project.IProject): Promise<Pick<factory.project.IProject, 'id'>>;
49
+ updateById(params: {
50
50
  id: string;
51
51
  alternateName?: string;
52
52
  logo?: string;
@@ -68,7 +68,27 @@ export declare class ProjectRepo {
68
68
  deleteById(params: {
69
69
  id: string;
70
70
  }): Promise<void>;
71
- getCursor(conditions: FilterQuery<factory.project.IProject>, projection: any): import("mongoose").Cursor<any, import("mongoose").QueryOptions<any>>;
71
+ getCursor(conditions: FilterQuery<factory.project.IProject>, projection: any): import("mongoose").Cursor<import("mongoose").Document<unknown, {}, Omit<factory.project.IProject, "id"> & {
72
+ _id: string;
73
+ aggregateReservation?: any;
74
+ makesOffer?: factory.project.IMakesOffer[] | undefined;
75
+ }> & Omit<Omit<factory.project.IProject, "id"> & {
76
+ _id: string;
77
+ aggregateReservation?: any;
78
+ makesOffer?: factory.project.IMakesOffer[] | undefined;
79
+ } & Required<{
80
+ _id: string;
81
+ }>, never>, import("mongoose").QueryOptions<import("mongoose").Document<unknown, {}, Omit<factory.project.IProject, "id"> & {
82
+ _id: string;
83
+ aggregateReservation?: any;
84
+ makesOffer?: factory.project.IMakesOffer[] | undefined;
85
+ }> & Omit<Omit<factory.project.IProject, "id"> & {
86
+ _id: string;
87
+ aggregateReservation?: any;
88
+ makesOffer?: factory.project.IMakesOffer[] | undefined;
89
+ } & Required<{
90
+ _id: string;
91
+ }>, never>>>;
72
92
  unsetUnnecessaryFields(params: {
73
93
  filter: any;
74
94
  $unset: any;
@@ -8,11 +8,33 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
8
8
  step((generator = generator.apply(thisArg, _arguments || [])).next());
9
9
  });
10
10
  };
11
+ var __rest = (this && this.__rest) || function (s, e) {
12
+ var t = {};
13
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
14
+ t[p] = s[p];
15
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
16
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
17
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
18
+ t[p[i]] = s[p[i]];
19
+ }
20
+ return t;
21
+ };
11
22
  Object.defineProperty(exports, "__esModule", { value: true });
12
23
  exports.ProjectRepo = void 0;
13
24
  const project_1 = require("./mongoose/schemas/project");
14
25
  const factory = require("../factory");
15
26
  const settings_1 = require("../settings");
27
+ const AVAILABLE_PROJECT_FIELDS = [
28
+ // 'aggregateReservation',
29
+ 'alternateName',
30
+ 'logo',
31
+ 'hasMerchantReturnPolicy',
32
+ // 'makesOffer',
33
+ 'name',
34
+ 'settings',
35
+ 'subscription',
36
+ 'typeOf'
37
+ ];
16
38
  /**
17
39
  * プロジェクトリポジトリ
18
40
  * makesOfferについてはsee ProjectMakesOfferRepo
@@ -43,7 +65,7 @@ class ProjectRepo {
43
65
  }
44
66
  findById(params) {
45
67
  return __awaiter(this, void 0, void 0, function* () {
46
- const project = (yield this.search({
68
+ const project = (yield this.projectFields({
47
69
  limit: 1,
48
70
  page: 1,
49
71
  id: { $eq: params.id }
@@ -56,42 +78,52 @@ class ProjectRepo {
56
78
  }
57
79
  findAlternateNameById(params) {
58
80
  return __awaiter(this, void 0, void 0, function* () {
59
- const doc = yield this.projectModel.findOne({ _id: { $eq: params.id } }, { alternateName: 1 })
81
+ const doc = yield this.projectModel.findOne({ _id: { $eq: params.id } }, { alternateName: 1, _id: 0 })
82
+ .lean()
60
83
  .exec();
61
84
  if (doc === null) {
62
85
  throw new factory.errors.NotFound(this.projectModel.modelName);
63
86
  }
64
- return doc.toObject();
87
+ return doc;
65
88
  });
66
89
  }
67
90
  /**
68
91
  * プロジェクト検索
69
92
  */
70
- search(conditions, inclusion, exclusion) {
93
+ projectFields(conditions, inclusion, exclusion) {
71
94
  var _a;
72
95
  return __awaiter(this, void 0, void 0, function* () {
73
96
  const andConditions = ProjectRepo.CREATE_MONGO_CONDITIONS(conditions);
74
- let projection = {};
97
+ let positiveProjectionFields = AVAILABLE_PROJECT_FIELDS;
75
98
  if (Array.isArray(inclusion) && inclusion.length > 0) {
76
- inclusion.forEach((field) => {
77
- if (String(field) !== 'makesOffer') {
78
- projection[field] = 1;
79
- }
80
- });
99
+ positiveProjectionFields = inclusion.filter((key) => AVAILABLE_PROJECT_FIELDS.includes(key));
81
100
  }
82
101
  else {
83
- projection = {
84
- __v: 0,
85
- createdAt: 0,
86
- updatedAt: 0,
87
- makesOffer: 0
88
- };
89
102
  if (Array.isArray(exclusion) && exclusion.length > 0) {
90
- exclusion.forEach((field) => {
91
- projection[field] = 0;
92
- });
103
+ positiveProjectionFields = positiveProjectionFields.filter((key) => !exclusion.includes(key));
93
104
  }
94
105
  }
106
+ const projection = Object.assign({ _id: 0, id: { $toString: '$_id' } }, Object.fromEntries(positiveProjectionFields.map((key) => ([key, 1]))));
107
+ // let projection: { [key: string]: number } = {};
108
+ // if (Array.isArray(inclusion) && inclusion.length > 0) {
109
+ // inclusion.forEach((field) => {
110
+ // if (String(field) !== 'makesOffer') {
111
+ // projection[field] = 1;
112
+ // }
113
+ // });
114
+ // } else {
115
+ // projection = {
116
+ // __v: 0,
117
+ // createdAt: 0,
118
+ // updatedAt: 0,
119
+ // makesOffer: 0
120
+ // };
121
+ // if (Array.isArray(exclusion) && exclusion.length > 0) {
122
+ // exclusion.forEach((field) => {
123
+ // projection[field] = 0;
124
+ // });
125
+ // }
126
+ // }
95
127
  const query = this.projectModel.find((andConditions.length > 0) ? { $and: andConditions } : {}, projection);
96
128
  if (typeof conditions.limit === 'number' && conditions.limit > 0) {
97
129
  const page = (typeof conditions.page === 'number' && conditions.page > 0) ? conditions.page : 1;
@@ -102,17 +134,28 @@ class ProjectRepo {
102
134
  query.sort({ _id: conditions.sort._id });
103
135
  }
104
136
  return query.setOptions({ maxTimeMS: settings_1.MONGO_MAX_TIME_MS })
105
- .exec()
106
- .then((docs) => docs.map((doc) => doc.toObject()));
137
+ .lean() // 2024-08-22~
138
+ .exec();
107
139
  });
108
140
  }
109
141
  createById(params) {
142
+ var _a;
110
143
  return __awaiter(this, void 0, void 0, function* () {
111
- return this.projectModel.create(Object.assign(Object.assign({}, params), { _id: params.id }))
112
- .then((doc) => doc.toObject());
144
+ // return this.projectModel.create({ ...params, _id: params.id })
145
+ // .then((doc) => doc.toObject());
146
+ const { id } = params, createParams = __rest(params, ["id"]);
147
+ if (typeof id !== 'string' || id === '') {
148
+ throw new factory.errors.ArgumentNull('id');
149
+ }
150
+ const result = yield this.projectModel.insertMany(Object.assign(Object.assign({}, createParams), { typeOf: factory.organizationType.Project, _id: id }), { rawResult: true });
151
+ const insertedId = (_a = result.insertedIds) === null || _a === void 0 ? void 0 : _a[0];
152
+ if (typeof insertedId !== 'string') {
153
+ throw new factory.errors.Internal(`project not saved unexpectedly. result:${JSON.stringify(result)}`);
154
+ }
155
+ return { id: insertedId };
113
156
  });
114
157
  }
115
- findByIdAndIUpdate(params) {
158
+ updateById(params) {
116
159
  var _a, _b, _c, _d, _e, _f, _g, _h;
117
160
  return __awaiter(this, void 0, void 0, function* () {
118
161
  let hasMerchantReturnPolicy;
@@ -136,7 +179,7 @@ class ProjectRepo {
136
179
  ? { 'subscription.useEventServiceAsProduct': params.subscription.useEventServiceAsProduct }
137
180
  : undefined), (hasMerchantReturnPolicy !== undefined) ? { hasMerchantReturnPolicy } : undefined), { $unset: {
138
181
  'settings.cognito': 1 // 廃止(2023-11-10~)
139
- } }))
182
+ } }), { projection: { _id: 1 } })
140
183
  .exec();
141
184
  });
142
185
  }
@@ -153,9 +196,7 @@ class ProjectRepo {
153
196
  }
154
197
  deleteById(params) {
155
198
  return __awaiter(this, void 0, void 0, function* () {
156
- yield this.projectModel.deleteOne({
157
- _id: { $eq: params.id }
158
- })
199
+ yield this.projectModel.deleteOne({ _id: { $eq: params.id } }, { projection: { _id: 1 } })
159
200
  .exec();
160
201
  });
161
202
  }
@@ -29,9 +29,9 @@ export interface IUpdatePartiallyParams {
29
29
  additionalTicketText?: string;
30
30
  }
31
31
  export type ICancelResult = UpdateWriteOpResult;
32
- export type ICreatingReservation<T extends factory.reservationType> = T extends factory.reservationType.BusReservation ? (factory.reservation.busReservation.IReservation) & {
32
+ export type ICreatingReservation<T extends factory.reservationType> = T extends factory.reservationType.BusReservation ? (Omit<factory.reservation.busReservation.IReservation, 'id'>) & {
33
33
  _id: string;
34
- } : T extends factory.reservationType.EventReservation ? (factory.reservation.eventReservation.IReservation) & {
34
+ } : T extends factory.reservationType.EventReservation ? (Omit<factory.reservation.eventReservation.IReservation, 'id'>) & {
35
35
  _id: string;
36
36
  } : never;
37
37
  type IKeyOfProjection = keyof factory.reservation.IReservation<factory.reservationType.BusReservation | factory.reservationType.EventReservation> | 'reservedTicket.dateUsed' | 'reservationFor.id' | 'reservationFor.typeOf';
@@ -151,7 +151,39 @@ export declare class ReservationRepo {
151
151
  $in: string[];
152
152
  };
153
153
  }): Promise<string[]>;
154
- getCursor(conditions: any, projection: any): import("mongoose").Cursor<any, import("mongoose").QueryOptions<any>>;
154
+ getCursor(conditions: any, projection: any): import("mongoose").Cursor<import("mongoose").Document<unknown, {}, (Omit<import("@chevre/factory/lib/reservation/busReservation").IReservation, "id"> | Omit<import("@chevre/factory/lib/reservation/event").IReservation, "id">) & {
155
+ _id: string;
156
+ bookingAgent?: any;
157
+ previousReservationStatus?: factory.reservationStatusType | undefined;
158
+ }> & Omit<(Omit<import("@chevre/factory/lib/reservation/busReservation").IReservation, "id"> & {
159
+ _id: string;
160
+ bookingAgent?: any;
161
+ previousReservationStatus?: factory.reservationStatusType | undefined;
162
+ } & Required<{
163
+ _id: string;
164
+ }>) | (Omit<import("@chevre/factory/lib/reservation/event").IReservation, "id"> & {
165
+ _id: string;
166
+ bookingAgent?: any;
167
+ previousReservationStatus?: factory.reservationStatusType | undefined;
168
+ } & Required<{
169
+ _id: string;
170
+ }>), never>, import("mongoose").QueryOptions<import("mongoose").Document<unknown, {}, (Omit<import("@chevre/factory/lib/reservation/busReservation").IReservation, "id"> | Omit<import("@chevre/factory/lib/reservation/event").IReservation, "id">) & {
171
+ _id: string;
172
+ bookingAgent?: any;
173
+ previousReservationStatus?: factory.reservationStatusType | undefined;
174
+ }> & Omit<(Omit<import("@chevre/factory/lib/reservation/busReservation").IReservation, "id"> & {
175
+ _id: string;
176
+ bookingAgent?: any;
177
+ previousReservationStatus?: factory.reservationStatusType | undefined;
178
+ } & Required<{
179
+ _id: string;
180
+ }>) | (Omit<import("@chevre/factory/lib/reservation/event").IReservation, "id"> & {
181
+ _id: string;
182
+ bookingAgent?: any;
183
+ previousReservationStatus?: factory.reservationStatusType | undefined;
184
+ } & Required<{
185
+ _id: string;
186
+ }>), never>>>;
155
187
  unsetUnnecessaryFields(params: {
156
188
  filter: any;
157
189
  $unset: any;
@@ -970,7 +970,7 @@ class ReservationRepo {
970
970
  }
971
971
  bulkWriteOps.push({
972
972
  updateOne: {
973
- filter: { _id: { $eq: setOnInsert.id } },
973
+ filter: { _id: { $eq: subReservation.id } },
974
974
  update: {
975
975
  $setOnInsert: setOnInsert
976
976
  },
@@ -1,13 +1,6 @@
1
1
  import type { Connection } from 'mongoose';
2
2
  import * as factory from '../factory';
3
- export declare enum RoleType {
4
- OrganizationRole = "OrganizationRole"
5
- }
6
- export interface IRole {
7
- typeOf: RoleType;
8
- roleName: string;
9
- permissions: string[];
10
- }
3
+ import { IRole } from './mongoose/schemas/role';
11
4
  /**
12
5
  * IAMロールリポジトリ
13
6
  */
@@ -15,7 +8,7 @@ export declare class RoleRepo {
15
8
  private readonly roleModel;
16
9
  constructor(connection: Connection);
17
10
  static CREATE_MONGO_CONDITIONS(params: factory.iam.IRoleSearchConditions): any[];
18
- search(params: factory.iam.IRoleSearchConditions): Promise<IRole[]>;
11
+ projectFields(params: factory.iam.IRoleSearchConditions): Promise<IRole[]>;
19
12
  aggregatePermissions(params: {
20
13
  roleName: {
21
14
  $in: string[];
@@ -9,13 +9,14 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
9
9
  });
10
10
  };
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.RoleRepo = exports.RoleType = void 0;
13
- const role_1 = require("./mongoose/schemas/role");
12
+ exports.RoleRepo = void 0;
14
13
  const settings_1 = require("../settings");
15
- var RoleType;
16
- (function (RoleType) {
17
- RoleType["OrganizationRole"] = "OrganizationRole";
18
- })(RoleType = exports.RoleType || (exports.RoleType = {}));
14
+ const role_1 = require("./mongoose/schemas/role");
15
+ const AVAILABLE_PROJECT_FIELDS = [
16
+ 'typeOf',
17
+ 'permissions',
18
+ 'roleName'
19
+ ];
19
20
  /**
20
21
  * IAMロールリポジトリ
21
22
  */
@@ -39,10 +40,19 @@ class RoleRepo {
39
40
  }
40
41
  return andConditions;
41
42
  }
42
- search(params) {
43
+ projectFields(params) {
43
44
  return __awaiter(this, void 0, void 0, function* () {
44
45
  const conditions = RoleRepo.CREATE_MONGO_CONDITIONS(params);
45
- const query = this.roleModel.find((conditions.length > 0) ? { $and: conditions } : {}, {});
46
+ const positiveProjectionFields = AVAILABLE_PROJECT_FIELDS;
47
+ // if (Array.isArray(inclusion) && inclusion.length > 0) {
48
+ // positiveProjectionFields = inclusion.filter((key) => AVAILABLE_PROJECT_FIELDS.includes(key));
49
+ // } else {
50
+ // if (Array.isArray(exclusion) && exclusion.length > 0) {
51
+ // positiveProjectionFields = positiveProjectionFields.filter((key) => !exclusion.includes(key));
52
+ // }
53
+ // }
54
+ const projection = Object.assign({ _id: 0 }, Object.fromEntries(positiveProjectionFields.map((key) => ([key, 1]))));
55
+ const query = this.roleModel.find((conditions.length > 0) ? { $and: conditions } : {}, projection);
46
56
  if (typeof params.limit === 'number' && params.limit > 0) {
47
57
  const page = (typeof params.page === 'number' && params.page > 0) ? params.page : 1;
48
58
  query.limit(params.limit)
@@ -56,8 +66,8 @@ class RoleRepo {
56
66
  // const explainResult = await (<any>query).explain();
57
67
  // console.log(explainResult[0].executionStats.allPlansExecution.map((e: any) => e.executionStages.inputStage));
58
68
  return query.setOptions({ maxTimeMS: settings_1.MONGO_MAX_TIME_MS })
59
- .exec()
60
- .then((docs) => docs.map((doc) => doc.toObject()));
69
+ .lean() // 2024-08-23~
70
+ .exec();
61
71
  });
62
72
  }
63
73
  aggregatePermissions(params) {