@chevre/domain 20.1.0-alpha.2 → 20.1.0-alpha.21

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 (77) hide show
  1. package/example/src/chevre/deleteEvents.ts +9 -1
  2. package/example/src/chevre/migrateEventOffersSellerMakesOffer.ts +139 -0
  3. package/example/src/chevre/migrateEventSeriesAdditionalProperties.ts +96 -0
  4. package/example/src/chevre/migrateSellerMakesOfferTransactionDuration.ts +71 -0
  5. package/example/src/chevre/searchEvents.ts +36 -16
  6. package/lib/chevre/repo/action.js +42 -31
  7. package/lib/chevre/repo/additionalProperty.d.ts +35 -0
  8. package/lib/chevre/repo/additionalProperty.js +211 -0
  9. package/lib/chevre/repo/event.d.ts +9 -4
  10. package/lib/chevre/repo/event.js +59 -47
  11. package/lib/chevre/repo/mongoose/model/action.js +9 -1
  12. package/lib/chevre/repo/mongoose/model/additionalProperty.d.ts +7 -0
  13. package/lib/chevre/repo/mongoose/model/additionalProperty.js +81 -0
  14. package/lib/chevre/repo/mongoose/model/event.js +53 -0
  15. package/lib/chevre/repo/mongoose/model/place.js +18 -0
  16. package/lib/chevre/repo/place.d.ts +1 -0
  17. package/lib/chevre/repo/place.js +5 -0
  18. package/lib/chevre/repo/transaction.js +20 -5
  19. package/lib/chevre/repository.d.ts +6 -0
  20. package/lib/chevre/repository.js +8 -1
  21. package/lib/chevre/service/account.d.ts +0 -4
  22. package/lib/chevre/service/account.js +24 -22
  23. package/lib/chevre/service/accountTransaction/deposit.d.ts +0 -2
  24. package/lib/chevre/service/accountTransaction/deposit.js +3 -3
  25. package/lib/chevre/service/accountTransaction/transfer.d.ts +0 -2
  26. package/lib/chevre/service/accountTransaction/transfer.js +3 -3
  27. package/lib/chevre/service/accountTransaction/withdraw.d.ts +0 -2
  28. package/lib/chevre/service/accountTransaction/withdraw.js +3 -3
  29. package/lib/chevre/service/assetTransaction/pay/potentialActions.js +11 -20
  30. package/lib/chevre/service/delivery/factory.js +2 -1
  31. package/lib/chevre/service/event.js +10 -0
  32. package/lib/chevre/service/offer/event/authorize.d.ts +4 -0
  33. package/lib/chevre/service/offer/event/authorize.js +46 -10
  34. package/lib/chevre/service/offer/factory.js +7 -20
  35. package/lib/chevre/service/offer.js +6 -6
  36. package/lib/chevre/service/order/onOrderStatusChanged/factory.js +5 -3
  37. package/lib/chevre/service/order/onOrderStatusChanged.js +5 -4
  38. package/lib/chevre/service/order/placeOrder.js +17 -7
  39. package/lib/chevre/service/order/returnOrder.js +2 -1
  40. package/lib/chevre/service/order/sendOrder.js +4 -2
  41. package/lib/chevre/service/transaction/orderProgramMembership.js +6 -8
  42. package/lib/chevre/service/transaction/placeOrder/exportTasks/factory.js +6 -3
  43. package/lib/chevre/service/transaction/placeOrderInProgress/factory.js +9 -4
  44. package/lib/chevre/service/transaction/placeOrderInProgress/potentialActions/givePointAward.js +2 -1
  45. package/lib/chevre/service/transaction/placeOrderInProgress/potentialActions/moneyTransfer.js +2 -1
  46. package/lib/chevre/service/transaction/placeOrderInProgress/potentialActions/registerService.js +2 -1
  47. package/lib/chevre/service/transaction/placeOrderInProgress/potentialActions/sendEmailMessage.js +4 -3
  48. package/lib/chevre/service/transaction/placeOrderInProgress/potentialActions.js +4 -2
  49. package/lib/chevre/service/transaction/placeOrderInProgress/result.js +2 -4
  50. package/lib/chevre/service/transaction/placeOrderInProgress/validation/validateSeller.d.ts +3 -1
  51. package/lib/chevre/service/transaction/placeOrderInProgress/validation/validateSeller.js +3 -2
  52. package/lib/chevre/service/transaction/placeOrderInProgress.js +16 -2
  53. package/lib/chevre/service/transaction/returnOrder/potentialActions/returnMoneyTransfer.js +4 -5
  54. package/lib/chevre/service/transaction/returnOrder/potentialActions/returnPaymentMethod.js +6 -3
  55. package/lib/chevre/service/transaction/returnOrder/potentialActions/returnPointAward.js +4 -6
  56. package/lib/chevre/service/transaction/returnOrder/potentialActions/sendEmailMessage.js +2 -1
  57. package/lib/chevre/service/transaction/returnOrder.js +10 -1
  58. package/lib/chevre/service/transaction.js +1 -14
  59. package/package.json +3 -3
  60. package/example/src/chevre/accountBlanceTest.ts +0 -24
  61. package/example/src/chevre/checkOffersAppliesToMovieTicket.ts +0 -56
  62. package/example/src/chevre/createSeats.ts +0 -59
  63. package/example/src/chevre/manageOwnedByOfOwnershipInfo.ts +0 -35
  64. package/example/src/chevre/migrateEventOffersItemOfferedName.ts +0 -82
  65. package/example/src/chevre/migrateMovieTicketChargePriceSpecs.ts +0 -92
  66. package/example/src/chevre/migrateSellerMakesOffers.ts +0 -84
  67. package/example/src/chevre/migrateTTTSOldEventId.ts +0 -68
  68. package/example/src/chevre/publishConfirmationNumber.ts +0 -30
  69. package/example/src/chevre/publishServiceOutputIdentifier.ts +0 -28
  70. package/example/src/chevre/publishTransactionNumber.ts +0 -28
  71. package/example/src/chevre/renameTransaction.ts +0 -22
  72. package/lib/chevre/service/task/accountMoneyTransfer.d.ts +0 -3
  73. package/lib/chevre/service/task/accountMoneyTransfer.js +0 -31
  74. package/lib/chevre/service/task/cancelAccountMoneyTransfer.d.ts +0 -3
  75. package/lib/chevre/service/task/cancelAccountMoneyTransfer.js +0 -33
  76. package/lib/chevre/service/transaction/placeOrderInProgress/potentialActions/confirmReservation.d.ts +0 -11
  77. package/lib/chevre/service/transaction/placeOrderInProgress/potentialActions/confirmReservation.js +0 -187
@@ -22,7 +22,7 @@ class MongoRepository {
22
22
  }
23
23
  // tslint:disable-next-line:cyclomatic-complexity max-func-body-length
24
24
  static CREATE_MONGO_CONDITIONS(params) {
25
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, _20, _21, _22, _23, _24, _25, _26, _27, _28, _29, _30, _31, _32, _33, _34, _35, _36, _37, _38, _39, _40, _41, _42, _43, _44, _45, _46, _47, _48;
25
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, _20, _21, _22, _23, _24, _25, _26, _27, _28, _29, _30, _31, _32, _33, _34, _35, _36, _37, _38, _39, _40, _41, _42, _43, _44, _45, _46, _47, _48, _49, _50;
26
26
  const andConditions = [];
27
27
  const projectIdEq = (_b = (_a = params.project) === null || _a === void 0 ? void 0 : _a.id) === null || _b === void 0 ? void 0 : _b.$eq;
28
28
  // tslint:disable-next-line:no-single-line-block-comment
@@ -54,7 +54,18 @@ class MongoRepository {
54
54
  }
55
55
  });
56
56
  }
57
- const locationIdentifierEq = (_h = (_g = params.location) === null || _g === void 0 ? void 0 : _g.identifier) === null || _h === void 0 ? void 0 : _h.$eq;
57
+ const locationIdEq = (_h = (_g = params.location) === null || _g === void 0 ? void 0 : _g.id) === null || _h === void 0 ? void 0 : _h.$eq;
58
+ // tslint:disable-next-line:no-single-line-block-comment
59
+ /* istanbul ignore else */
60
+ if (typeof locationIdEq === 'string') {
61
+ andConditions.push({
62
+ 'location.id': {
63
+ $exists: true,
64
+ $eq: locationIdEq
65
+ }
66
+ });
67
+ }
68
+ const locationIdentifierEq = (_k = (_j = params.location) === null || _j === void 0 ? void 0 : _j.identifier) === null || _k === void 0 ? void 0 : _k.$eq;
58
69
  // tslint:disable-next-line:no-single-line-block-comment
59
70
  /* istanbul ignore else */
60
71
  if (typeof locationIdentifierEq === 'string') {
@@ -67,7 +78,7 @@ class MongoRepository {
67
78
  }
68
79
  // tslint:disable-next-line:no-single-line-block-comment
69
80
  /* istanbul ignore else */
70
- const objectPaymentMethodIdEq = (_k = (_j = params.object) === null || _j === void 0 ? void 0 : _j.paymentMethodId) === null || _k === void 0 ? void 0 : _k.$eq;
81
+ const objectPaymentMethodIdEq = (_m = (_l = params.object) === null || _l === void 0 ? void 0 : _l.paymentMethodId) === null || _m === void 0 ? void 0 : _m.$eq;
71
82
  if (typeof objectPaymentMethodIdEq === 'string') {
72
83
  andConditions.push({
73
84
  'object.paymentMethodId': {
@@ -76,7 +87,7 @@ class MongoRepository {
76
87
  }
77
88
  });
78
89
  }
79
- const objectObjectPaymentMethodIdEq = (_o = (_m = (_l = params.object) === null || _l === void 0 ? void 0 : _l.object) === null || _m === void 0 ? void 0 : _m.paymentMethodId) === null || _o === void 0 ? void 0 : _o.$eq;
90
+ const objectObjectPaymentMethodIdEq = (_q = (_p = (_o = params.object) === null || _o === void 0 ? void 0 : _o.object) === null || _p === void 0 ? void 0 : _p.paymentMethodId) === null || _q === void 0 ? void 0 : _q.$eq;
80
91
  if (typeof objectObjectPaymentMethodIdEq === 'string') {
81
92
  andConditions.push({
82
93
  'object.object.paymentMethodId': {
@@ -85,7 +96,7 @@ class MongoRepository {
85
96
  }
86
97
  });
87
98
  }
88
- const objectReservationForIdEq = (_r = (_q = (_p = params.object) === null || _p === void 0 ? void 0 : _p.reservationFor) === null || _q === void 0 ? void 0 : _q.id) === null || _r === void 0 ? void 0 : _r.$eq;
99
+ const objectReservationForIdEq = (_t = (_s = (_r = params.object) === null || _r === void 0 ? void 0 : _r.reservationFor) === null || _s === void 0 ? void 0 : _s.id) === null || _t === void 0 ? void 0 : _t.$eq;
89
100
  // tslint:disable-next-line:no-single-line-block-comment
90
101
  /* istanbul ignore else */
91
102
  if (typeof objectReservationForIdEq === 'string') {
@@ -96,7 +107,7 @@ class MongoRepository {
96
107
  }
97
108
  });
98
109
  }
99
- const objectPaymentMethodAccountIdEq = (_u = (_t = (_s = params.object) === null || _s === void 0 ? void 0 : _s.paymentMethod) === null || _t === void 0 ? void 0 : _t.accountId) === null || _u === void 0 ? void 0 : _u.$eq;
110
+ const objectPaymentMethodAccountIdEq = (_w = (_v = (_u = params.object) === null || _u === void 0 ? void 0 : _u.paymentMethod) === null || _v === void 0 ? void 0 : _v.accountId) === null || _w === void 0 ? void 0 : _w.$eq;
100
111
  // tslint:disable-next-line:no-single-line-block-comment
101
112
  /* istanbul ignore else */
102
113
  if (typeof objectPaymentMethodAccountIdEq === 'string') {
@@ -107,7 +118,7 @@ class MongoRepository {
107
118
  }
108
119
  });
109
120
  }
110
- const objectPaymentMethodPaymentMethodIdEq = (_x = (_w = (_v = params.object) === null || _v === void 0 ? void 0 : _v.paymentMethod) === null || _w === void 0 ? void 0 : _w.paymentMethodId) === null || _x === void 0 ? void 0 : _x.$eq;
121
+ const objectPaymentMethodPaymentMethodIdEq = (_z = (_y = (_x = params.object) === null || _x === void 0 ? void 0 : _x.paymentMethod) === null || _y === void 0 ? void 0 : _y.paymentMethodId) === null || _z === void 0 ? void 0 : _z.$eq;
111
122
  // tslint:disable-next-line:no-single-line-block-comment
112
123
  /* istanbul ignore else */
113
124
  if (typeof objectPaymentMethodPaymentMethodIdEq === 'string') {
@@ -118,7 +129,7 @@ class MongoRepository {
118
129
  }
119
130
  });
120
131
  }
121
- const objectPaymentMethodPaymentMethodIdIn = (_0 = (_z = (_y = params.object) === null || _y === void 0 ? void 0 : _y.paymentMethod) === null || _z === void 0 ? void 0 : _z.paymentMethodId) === null || _0 === void 0 ? void 0 : _0.$in;
132
+ const objectPaymentMethodPaymentMethodIdIn = (_2 = (_1 = (_0 = params.object) === null || _0 === void 0 ? void 0 : _0.paymentMethod) === null || _1 === void 0 ? void 0 : _1.paymentMethodId) === null || _2 === void 0 ? void 0 : _2.$in;
122
133
  if (Array.isArray(objectPaymentMethodPaymentMethodIdIn)) {
123
134
  andConditions.push({
124
135
  'object.paymentMethod.paymentMethodId': {
@@ -127,7 +138,7 @@ class MongoRepository {
127
138
  }
128
139
  });
129
140
  }
130
- const objectPaymentMethodTypeOfEq = (_3 = (_2 = (_1 = params.object) === null || _1 === void 0 ? void 0 : _1.paymentMethod) === null || _2 === void 0 ? void 0 : _2.typeOf) === null || _3 === void 0 ? void 0 : _3.$eq;
141
+ const objectPaymentMethodTypeOfEq = (_5 = (_4 = (_3 = params.object) === null || _3 === void 0 ? void 0 : _3.paymentMethod) === null || _4 === void 0 ? void 0 : _4.typeOf) === null || _5 === void 0 ? void 0 : _5.$eq;
131
142
  // tslint:disable-next-line:no-single-line-block-comment
132
143
  /* istanbul ignore else */
133
144
  if (typeof objectPaymentMethodTypeOfEq === 'string') {
@@ -138,7 +149,7 @@ class MongoRepository {
138
149
  }
139
150
  });
140
151
  }
141
- const objectTypeOfEq = (_5 = (_4 = params.object) === null || _4 === void 0 ? void 0 : _4.typeOf) === null || _5 === void 0 ? void 0 : _5.$eq;
152
+ const objectTypeOfEq = (_7 = (_6 = params.object) === null || _6 === void 0 ? void 0 : _6.typeOf) === null || _7 === void 0 ? void 0 : _7.$eq;
142
153
  // tslint:disable-next-line:no-single-line-block-comment
143
154
  /* istanbul ignore else */
144
155
  if (typeof objectTypeOfEq === 'string') {
@@ -149,7 +160,7 @@ class MongoRepository {
149
160
  }
150
161
  });
151
162
  }
152
- const objectTypeOfIn = (_7 = (_6 = params.object) === null || _6 === void 0 ? void 0 : _6.typeOf) === null || _7 === void 0 ? void 0 : _7.$in;
163
+ const objectTypeOfIn = (_9 = (_8 = params.object) === null || _8 === void 0 ? void 0 : _8.typeOf) === null || _9 === void 0 ? void 0 : _9.$in;
153
164
  if (Array.isArray(objectTypeOfIn)) {
154
165
  andConditions.push({
155
166
  'object.typeOf': {
@@ -158,7 +169,7 @@ class MongoRepository {
158
169
  }
159
170
  });
160
171
  }
161
- const objectIdEq = (_9 = (_8 = params.object) === null || _8 === void 0 ? void 0 : _8.id) === null || _9 === void 0 ? void 0 : _9.$eq;
172
+ const objectIdEq = (_11 = (_10 = params.object) === null || _10 === void 0 ? void 0 : _10.id) === null || _11 === void 0 ? void 0 : _11.$eq;
162
173
  // tslint:disable-next-line:no-single-line-block-comment
163
174
  /* istanbul ignore else */
164
175
  if (typeof objectIdEq === 'string') {
@@ -169,7 +180,7 @@ class MongoRepository {
169
180
  }
170
181
  });
171
182
  }
172
- const objectIdIn = (_11 = (_10 = params.object) === null || _10 === void 0 ? void 0 : _10.id) === null || _11 === void 0 ? void 0 : _11.$in;
183
+ const objectIdIn = (_13 = (_12 = params.object) === null || _12 === void 0 ? void 0 : _12.id) === null || _13 === void 0 ? void 0 : _13.$in;
173
184
  if (Array.isArray(objectIdIn)) {
174
185
  andConditions.push({
175
186
  'object.id': {
@@ -178,7 +189,7 @@ class MongoRepository {
178
189
  }
179
190
  });
180
191
  }
181
- const objectOrderNumberIn = (_13 = (_12 = params.object) === null || _12 === void 0 ? void 0 : _12.orderNumber) === null || _13 === void 0 ? void 0 : _13.$in;
192
+ const objectOrderNumberIn = (_15 = (_14 = params.object) === null || _14 === void 0 ? void 0 : _14.orderNumber) === null || _15 === void 0 ? void 0 : _15.$in;
182
193
  if (Array.isArray(objectOrderNumberIn)) {
183
194
  andConditions.push({
184
195
  'object.orderNumber': {
@@ -187,7 +198,7 @@ class MongoRepository {
187
198
  }
188
199
  });
189
200
  }
190
- const objectEventIdIn = (_16 = (_15 = (_14 = params.object) === null || _14 === void 0 ? void 0 : _14.event) === null || _15 === void 0 ? void 0 : _15.id) === null || _16 === void 0 ? void 0 : _16.$in;
201
+ const objectEventIdIn = (_18 = (_17 = (_16 = params.object) === null || _16 === void 0 ? void 0 : _16.event) === null || _17 === void 0 ? void 0 : _17.id) === null || _18 === void 0 ? void 0 : _18.$in;
191
202
  if (Array.isArray(objectEventIdIn)) {
192
203
  andConditions.push({
193
204
  'object.event.id': {
@@ -196,7 +207,7 @@ class MongoRepository {
196
207
  }
197
208
  });
198
209
  }
199
- const objectAcceptedOfferSeatNumberIn = (_20 = (_19 = (_18 = (_17 = params.object) === null || _17 === void 0 ? void 0 : _17.acceptedOffer) === null || _18 === void 0 ? void 0 : _18.ticketedSeat) === null || _19 === void 0 ? void 0 : _19.seatNumber) === null || _20 === void 0 ? void 0 : _20.$in;
210
+ const objectAcceptedOfferSeatNumberIn = (_22 = (_21 = (_20 = (_19 = params.object) === null || _19 === void 0 ? void 0 : _19.acceptedOffer) === null || _20 === void 0 ? void 0 : _20.ticketedSeat) === null || _21 === void 0 ? void 0 : _21.seatNumber) === null || _22 === void 0 ? void 0 : _22.$in;
200
211
  if (Array.isArray(objectAcceptedOfferSeatNumberIn)) {
201
212
  andConditions.push({
202
213
  'object.acceptedOffer.ticketedSeat.seatNumber': {
@@ -213,7 +224,7 @@ class MongoRepository {
213
224
  });
214
225
  }
215
226
  else {
216
- const typeOfEq = (_21 = params.typeOf) === null || _21 === void 0 ? void 0 : _21.$eq;
227
+ const typeOfEq = (_23 = params.typeOf) === null || _23 === void 0 ? void 0 : _23.$eq;
217
228
  // tslint:disable-next-line:no-single-line-block-comment
218
229
  /* istanbul ignore else */
219
230
  if (typeof typeOfEq === 'string') {
@@ -222,7 +233,7 @@ class MongoRepository {
222
233
  });
223
234
  }
224
235
  }
225
- const actionStatusIn = (_22 = params.actionStatus) === null || _22 === void 0 ? void 0 : _22.$in;
236
+ const actionStatusIn = (_24 = params.actionStatus) === null || _24 === void 0 ? void 0 : _24.$in;
226
237
  // tslint:disable-next-line:no-single-line-block-comment
227
238
  /* istanbul ignore else */
228
239
  if (Array.isArray(actionStatusIn)) {
@@ -253,7 +264,7 @@ class MongoRepository {
253
264
  startDate: { $lte: startDateLte }
254
265
  });
255
266
  }
256
- const fromLocationTypeOfIn = (_24 = (_23 = params.fromLocation) === null || _23 === void 0 ? void 0 : _23.typeOf) === null || _24 === void 0 ? void 0 : _24.$in;
267
+ const fromLocationTypeOfIn = (_26 = (_25 = params.fromLocation) === null || _25 === void 0 ? void 0 : _25.typeOf) === null || _26 === void 0 ? void 0 : _26.$in;
257
268
  if (Array.isArray(fromLocationTypeOfIn)) {
258
269
  andConditions.push({
259
270
  'fromLocation.typeOf': {
@@ -262,7 +273,7 @@ class MongoRepository {
262
273
  }
263
274
  });
264
275
  }
265
- const fromLocationAccountNumberIn = (_26 = (_25 = params.fromLocation) === null || _25 === void 0 ? void 0 : _25.accountNumber) === null || _26 === void 0 ? void 0 : _26.$in;
276
+ const fromLocationAccountNumberIn = (_28 = (_27 = params.fromLocation) === null || _27 === void 0 ? void 0 : _27.accountNumber) === null || _28 === void 0 ? void 0 : _28.$in;
266
277
  if (Array.isArray(fromLocationAccountNumberIn)) {
267
278
  andConditions.push({
268
279
  'fromLocation.accountNumber': {
@@ -271,7 +282,7 @@ class MongoRepository {
271
282
  }
272
283
  });
273
284
  }
274
- const fromLocationAccountTypeIn = (_28 = (_27 = params.fromLocation) === null || _27 === void 0 ? void 0 : _27.accountType) === null || _28 === void 0 ? void 0 : _28.$in;
285
+ const fromLocationAccountTypeIn = (_30 = (_29 = params.fromLocation) === null || _29 === void 0 ? void 0 : _29.accountType) === null || _30 === void 0 ? void 0 : _30.$in;
275
286
  if (Array.isArray(fromLocationAccountTypeIn)) {
276
287
  andConditions.push({
277
288
  'fromLocation.accountType': {
@@ -280,7 +291,7 @@ class MongoRepository {
280
291
  }
281
292
  });
282
293
  }
283
- const toLocationTypeOfIn = (_30 = (_29 = params.toLocation) === null || _29 === void 0 ? void 0 : _29.typeOf) === null || _30 === void 0 ? void 0 : _30.$in;
294
+ const toLocationTypeOfIn = (_32 = (_31 = params.toLocation) === null || _31 === void 0 ? void 0 : _31.typeOf) === null || _32 === void 0 ? void 0 : _32.$in;
284
295
  if (Array.isArray(toLocationTypeOfIn)) {
285
296
  andConditions.push({
286
297
  'toLocation.typeOf': {
@@ -289,7 +300,7 @@ class MongoRepository {
289
300
  }
290
301
  });
291
302
  }
292
- const toLocationAccountNumberIn = (_32 = (_31 = params.toLocation) === null || _31 === void 0 ? void 0 : _31.accountNumber) === null || _32 === void 0 ? void 0 : _32.$in;
303
+ const toLocationAccountNumberIn = (_34 = (_33 = params.toLocation) === null || _33 === void 0 ? void 0 : _33.accountNumber) === null || _34 === void 0 ? void 0 : _34.$in;
293
304
  if (Array.isArray(toLocationAccountNumberIn)) {
294
305
  andConditions.push({
295
306
  'toLocation.accountNumber': {
@@ -298,7 +309,7 @@ class MongoRepository {
298
309
  }
299
310
  });
300
311
  }
301
- const toLocationAccountTypeIn = (_34 = (_33 = params.toLocation) === null || _33 === void 0 ? void 0 : _33.accountType) === null || _34 === void 0 ? void 0 : _34.$in;
312
+ const toLocationAccountTypeIn = (_36 = (_35 = params.toLocation) === null || _35 === void 0 ? void 0 : _35.accountType) === null || _36 === void 0 ? void 0 : _36.$in;
302
313
  if (Array.isArray(toLocationAccountTypeIn)) {
303
314
  andConditions.push({
304
315
  'toLocation.accountType': {
@@ -307,7 +318,7 @@ class MongoRepository {
307
318
  }
308
319
  });
309
320
  }
310
- const purposeTypeOfIn = (_36 = (_35 = params.purpose) === null || _35 === void 0 ? void 0 : _35.typeOf) === null || _36 === void 0 ? void 0 : _36.$in;
321
+ const purposeTypeOfIn = (_38 = (_37 = params.purpose) === null || _37 === void 0 ? void 0 : _37.typeOf) === null || _38 === void 0 ? void 0 : _38.$in;
311
322
  if (Array.isArray(purposeTypeOfIn)) {
312
323
  andConditions.push({
313
324
  'purpose.typeOf': {
@@ -316,7 +327,7 @@ class MongoRepository {
316
327
  }
317
328
  });
318
329
  }
319
- const purposeIdIn = (_38 = (_37 = params.purpose) === null || _37 === void 0 ? void 0 : _37.id) === null || _38 === void 0 ? void 0 : _38.$in;
330
+ const purposeIdIn = (_40 = (_39 = params.purpose) === null || _39 === void 0 ? void 0 : _39.id) === null || _40 === void 0 ? void 0 : _40.$in;
320
331
  if (Array.isArray(purposeIdIn)) {
321
332
  andConditions.push({
322
333
  'purpose.id': {
@@ -325,7 +336,7 @@ class MongoRepository {
325
336
  }
326
337
  });
327
338
  }
328
- const purposeOrderNumberIn = (_40 = (_39 = params.purpose) === null || _39 === void 0 ? void 0 : _39.orderNumber) === null || _40 === void 0 ? void 0 : _40.$in;
339
+ const purposeOrderNumberIn = (_42 = (_41 = params.purpose) === null || _41 === void 0 ? void 0 : _41.orderNumber) === null || _42 === void 0 ? void 0 : _42.$in;
329
340
  if (Array.isArray(purposeOrderNumberIn)) {
330
341
  andConditions.push({
331
342
  'purpose.orderNumber': {
@@ -334,7 +345,7 @@ class MongoRepository {
334
345
  }
335
346
  });
336
347
  }
337
- const resultTypeOfIn = (_42 = (_41 = params.result) === null || _41 === void 0 ? void 0 : _41.typeOf) === null || _42 === void 0 ? void 0 : _42.$in;
348
+ const resultTypeOfIn = (_44 = (_43 = params.result) === null || _43 === void 0 ? void 0 : _43.typeOf) === null || _44 === void 0 ? void 0 : _44.$in;
338
349
  if (Array.isArray(resultTypeOfIn)) {
339
350
  andConditions.push({
340
351
  'result.typeOf': {
@@ -343,7 +354,7 @@ class MongoRepository {
343
354
  }
344
355
  });
345
356
  }
346
- const resultIdIn = (_44 = (_43 = params.result) === null || _43 === void 0 ? void 0 : _43.id) === null || _44 === void 0 ? void 0 : _44.$in;
357
+ const resultIdIn = (_46 = (_45 = params.result) === null || _45 === void 0 ? void 0 : _45.id) === null || _46 === void 0 ? void 0 : _46.$in;
347
358
  if (Array.isArray(resultIdIn)) {
348
359
  andConditions.push({
349
360
  'result.id': {
@@ -352,7 +363,7 @@ class MongoRepository {
352
363
  }
353
364
  });
354
365
  }
355
- const resultOrderNumberIn = (_46 = (_45 = params.result) === null || _45 === void 0 ? void 0 : _45.orderNumber) === null || _46 === void 0 ? void 0 : _46.$in;
366
+ const resultOrderNumberIn = (_48 = (_47 = params.result) === null || _47 === void 0 ? void 0 : _47.orderNumber) === null || _48 === void 0 ? void 0 : _48.$in;
356
367
  if (Array.isArray(resultOrderNumberIn)) {
357
368
  andConditions.push({
358
369
  'result.orderNumber': {
@@ -361,7 +372,7 @@ class MongoRepository {
361
372
  }
362
373
  });
363
374
  }
364
- const resultCodeIn = (_48 = (_47 = params.result) === null || _47 === void 0 ? void 0 : _47.code) === null || _48 === void 0 ? void 0 : _48.$in;
375
+ const resultCodeIn = (_50 = (_49 = params.result) === null || _49 === void 0 ? void 0 : _49.code) === null || _50 === void 0 ? void 0 : _50.$in;
365
376
  if (Array.isArray(resultCodeIn)) {
366
377
  andConditions.push({
367
378
  'result.code': {
@@ -0,0 +1,35 @@
1
+ import { Connection } from 'mongoose';
2
+ import * as factory from '../factory';
3
+ /**
4
+ * 追加特性リポジトリ
5
+ */
6
+ export declare class MongoRepository {
7
+ private readonly additionalPropertyModel;
8
+ constructor(connection: Connection);
9
+ static CREATE_MONGO_CONDITIONS(params: factory.categoryCode.ISearchConditions): any[];
10
+ /**
11
+ * 検索
12
+ */
13
+ search(params: factory.categoryCode.ISearchConditions): Promise<factory.categoryCode.ICategoryCode[]>;
14
+ findById(params: {
15
+ id: string;
16
+ }): Promise<factory.categoryCode.ICategoryCode>;
17
+ save(params: {
18
+ id?: string;
19
+ attributes: factory.categoryCode.ICategoryCode;
20
+ }): Promise<factory.categoryCode.ICategoryCode>;
21
+ /**
22
+ * 削除する
23
+ */
24
+ deleteById(params: {
25
+ id: string;
26
+ }): Promise<void>;
27
+ /**
28
+ * プロジェクト指定で削除する
29
+ */
30
+ deleteByProject(params: {
31
+ project: {
32
+ id: string;
33
+ };
34
+ }): Promise<void>;
35
+ }
@@ -0,0 +1,211 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ var __rest = (this && this.__rest) || function (s, e) {
12
+ var t = {};
13
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
14
+ t[p] = s[p];
15
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
16
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
17
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
18
+ t[p[i]] = s[p[i]];
19
+ }
20
+ return t;
21
+ };
22
+ Object.defineProperty(exports, "__esModule", { value: true });
23
+ exports.MongoRepository = void 0;
24
+ const additionalProperty_1 = require("./mongoose/model/additionalProperty");
25
+ const factory = require("../factory");
26
+ /**
27
+ * 追加特性リポジトリ
28
+ */
29
+ class MongoRepository {
30
+ constructor(connection) {
31
+ this.additionalPropertyModel = connection.model(additionalProperty_1.modelName);
32
+ }
33
+ // tslint:disable-next-line:cyclomatic-complexity max-func-body-length
34
+ static CREATE_MONGO_CONDITIONS(params) {
35
+ var _a, _b, _c, _d;
36
+ // MongoDB検索条件
37
+ const andConditions = [];
38
+ // tslint:disable-next-line:no-single-line-block-comment
39
+ /* istanbul ignore else */
40
+ if (params.project !== undefined && params.project !== null) {
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
+ }
50
+ }
51
+ // tslint:disable-next-line:no-single-line-block-comment
52
+ /* istanbul ignore else */
53
+ if (params.id !== undefined && params.id !== null) {
54
+ if (typeof params.id.$eq === 'string') {
55
+ andConditions.push({
56
+ _id: {
57
+ $eq: params.id.$eq
58
+ }
59
+ });
60
+ }
61
+ }
62
+ // tslint:disable-next-line:no-single-line-block-comment
63
+ /* istanbul ignore else */
64
+ if (params.name !== undefined && params.name !== null) {
65
+ if (typeof params.name.$regex === 'string' && params.name.$regex.length > 0) {
66
+ andConditions.push({
67
+ $or: [
68
+ {
69
+ 'name.ja': {
70
+ $exists: true,
71
+ $regex: new RegExp(params.name.$regex)
72
+ }
73
+ },
74
+ {
75
+ 'name.en': {
76
+ $exists: true,
77
+ $regex: new RegExp(params.name.$regex)
78
+ }
79
+ }
80
+ ]
81
+ });
82
+ }
83
+ }
84
+ const codeValueEq = (_a = params.codeValue) === null || _a === void 0 ? void 0 : _a.$eq;
85
+ if (typeof codeValueEq === 'string') {
86
+ andConditions.push({
87
+ codeValue: {
88
+ $exists: true,
89
+ $eq: codeValueEq
90
+ }
91
+ });
92
+ }
93
+ const codeValueIn = (_b = params.codeValue) === null || _b === void 0 ? void 0 : _b.$in;
94
+ if (Array.isArray(codeValueIn)) {
95
+ andConditions.push({
96
+ codeValue: {
97
+ $exists: true,
98
+ $in: codeValueIn
99
+ }
100
+ });
101
+ }
102
+ // tslint:disable-next-line:no-single-line-block-comment
103
+ /* istanbul ignore else */
104
+ if (params.inCodeSet !== undefined && params.inCodeSet !== null) {
105
+ if (params.inCodeSet.identifier !== undefined && params.inCodeSet.identifier !== null) {
106
+ if (typeof params.inCodeSet.identifier.$eq === 'string') {
107
+ andConditions.push({
108
+ 'inCodeSet.identifier': {
109
+ $exists: true,
110
+ $eq: params.inCodeSet.identifier.$eq
111
+ }
112
+ });
113
+ }
114
+ }
115
+ }
116
+ const inCodeSetIdentifierIn = (_d = (_c = params.inCodeSet) === null || _c === void 0 ? void 0 : _c.identifier) === null || _d === void 0 ? void 0 : _d.$in;
117
+ if (Array.isArray(inCodeSetIdentifierIn)) {
118
+ andConditions.push({
119
+ 'inCodeSet.identifier': {
120
+ $exists: true,
121
+ $in: inCodeSetIdentifierIn
122
+ }
123
+ });
124
+ }
125
+ return andConditions;
126
+ }
127
+ // public async count(params: factory.categoryCode.ISearchConditions): Promise<number> {
128
+ // const conditions = MongoRepository.CREATE_MONGO_CONDITIONS(params);
129
+ // return this.additionalPropertyModel.countDocuments((conditions.length > 0) ? { $and: conditions } : {})
130
+ // .setOptions({ maxTimeMS: 10000 })
131
+ // .exec();
132
+ // }
133
+ /**
134
+ * 検索
135
+ */
136
+ search(params) {
137
+ return __awaiter(this, void 0, void 0, function* () {
138
+ const conditions = MongoRepository.CREATE_MONGO_CONDITIONS(params);
139
+ const query = this.additionalPropertyModel.find((conditions.length > 0) ? { $and: conditions } : {}, {
140
+ __v: 0,
141
+ createdAt: 0,
142
+ updatedAt: 0
143
+ });
144
+ if (typeof params.limit === 'number') {
145
+ const page = (typeof params.page === 'number') ? params.page : 1;
146
+ query.limit(params.limit)
147
+ .skip(params.limit * (page - 1));
148
+ }
149
+ // tslint:disable-next-line:no-single-line-block-comment
150
+ /* istanbul ignore else */
151
+ if (params.sort !== undefined) {
152
+ query.sort(params.sort);
153
+ }
154
+ return query.setOptions({ maxTimeMS: 10000 })
155
+ .exec()
156
+ .then((docs) => docs.map((doc) => doc.toObject()));
157
+ });
158
+ }
159
+ findById(params) {
160
+ return __awaiter(this, void 0, void 0, function* () {
161
+ const doc = yield this.additionalPropertyModel.findOne({ _id: params.id }, {
162
+ __v: 0,
163
+ createdAt: 0,
164
+ updatedAt: 0
165
+ })
166
+ .exec();
167
+ if (doc === null) {
168
+ throw new factory.errors.NotFound(this.additionalPropertyModel.modelName);
169
+ }
170
+ return doc.toObject();
171
+ });
172
+ }
173
+ save(params) {
174
+ return __awaiter(this, void 0, void 0, function* () {
175
+ let doc;
176
+ if (typeof params.id !== 'string') {
177
+ doc = yield this.additionalPropertyModel.create(params.attributes);
178
+ }
179
+ else {
180
+ const _a = params.attributes, { id, codeValue, inCodeSet, project, typeOf } = _a, updateFields = __rest(_a, ["id", "codeValue", "inCodeSet", "project", "typeOf"]);
181
+ doc = yield this.additionalPropertyModel.findOneAndUpdate({ _id: params.id }, updateFields, { upsert: false, new: true })
182
+ .exec();
183
+ }
184
+ if (doc === null) {
185
+ throw new factory.errors.NotFound(this.additionalPropertyModel.modelName);
186
+ }
187
+ return doc.toObject();
188
+ });
189
+ }
190
+ /**
191
+ * 削除する
192
+ */
193
+ deleteById(params) {
194
+ return __awaiter(this, void 0, void 0, function* () {
195
+ yield this.additionalPropertyModel.findOneAndRemove({ _id: params.id })
196
+ .exec();
197
+ });
198
+ }
199
+ /**
200
+ * プロジェクト指定で削除する
201
+ */
202
+ deleteByProject(params) {
203
+ return __awaiter(this, void 0, void 0, function* () {
204
+ yield this.additionalPropertyModel.deleteMany({
205
+ 'project.id': { $eq: params.project.id }
206
+ })
207
+ .exec();
208
+ });
209
+ }
210
+ }
211
+ exports.MongoRepository = MongoRepository;
@@ -29,13 +29,14 @@ export interface IUpdateAggregateUseActionsParams {
29
29
  noExistingAttributeName: 1;
30
30
  };
31
31
  }
32
+ export declare type ISearchConditions<T extends factory.eventType> = factory.event.ISearchConditions<T>;
32
33
  /**
33
34
  * イベントリポジトリ
34
35
  */
35
36
  export declare class MongoRepository {
36
37
  private readonly eventModel;
37
38
  constructor(connection: Connection);
38
- static CREATE_MONGO_CONDITIONS<T extends factory.eventType>(conditions: factory.event.ISearchConditions<T>): any[];
39
+ static CREATE_MONGO_CONDITIONS<T extends factory.eventType>(conditions: ISearchConditions<T>): any[];
39
40
  /**
40
41
  * 複数イベントを作成する
41
42
  */
@@ -71,14 +72,18 @@ export declare class MongoRepository {
71
72
  attributes: factory.event.IAttributes<factory.eventType.ScreeningEvent>;
72
73
  useOldEventId: boolean;
73
74
  }): Promise<factory.event.IEvent<factory.eventType.ScreeningEvent>>;
74
- count<T extends factory.eventType>(params: factory.event.ISearchConditions<T>): Promise<number>;
75
+ count<T extends factory.eventType>(params: ISearchConditions<T>): Promise<number>;
75
76
  /**
76
77
  * イベントを検索する
77
78
  */
78
- search<T extends factory.eventType>(params: factory.event.ISearchConditions<T>, projection?: any): Promise<factory.event.IEvent<T>[]>;
79
+ search<T extends factory.eventType>(params: ISearchConditions<T>, projection?: {
80
+ [key: string]: number;
81
+ }): Promise<factory.event.IEvent<T>[]>;
79
82
  findById<T extends factory.eventType>(params: {
80
83
  id: string;
81
- }, projection?: any): Promise<factory.event.IEvent<T>>;
84
+ }, projection?: {
85
+ [key: string]: number;
86
+ }): Promise<factory.event.IEvent<T>>;
82
87
  /**
83
88
  * イベントをキャンセルする
84
89
  */