@chevre/domain 21.4.0-alpha.8 → 21.4.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 (96) hide show
  1. package/example/src/chevre/cleanEventsByMovieTheater.ts +32 -0
  2. package/example/src/chevre/createDeleteTransactionTasksOfDeletedPeople.ts +126 -0
  3. package/example/src/chevre/iam/searchMemberOfIdsByMemberId.ts +31 -0
  4. package/example/src/chevre/iam/searchProjectIdsByMemberId.ts +32 -0
  5. package/example/src/chevre/importEventsFromCOA.ts +5 -4
  6. package/example/src/chevre/migrateEventOrganizer.ts +18 -5
  7. package/example/src/chevre/migrateIAMMemberMemberOf.ts +59 -0
  8. package/example/src/chevre/migrateReservationProvider.ts +119 -0
  9. package/example/src/chevre/migrateScreeningRoomOrganizer.ts +91 -0
  10. package/example/src/chevre/processReserve.ts +0 -1
  11. package/example/src/chevre/searchActions.ts +1 -1
  12. package/example/src/chevre/searchPermissions.ts +7 -15
  13. package/lib/chevre/factory/event.d.ts +1 -1
  14. package/lib/chevre/repo/assetTransaction.d.ts +4 -1
  15. package/lib/chevre/repo/assetTransaction.js +6 -12
  16. package/lib/chevre/repo/event.d.ts +16 -0
  17. package/lib/chevre/repo/event.js +34 -1
  18. package/lib/chevre/repo/member.d.ts +77 -5
  19. package/lib/chevre/repo/member.js +115 -97
  20. package/lib/chevre/repo/mongoose/schemas/event.d.ts +3 -3
  21. package/lib/chevre/repo/mongoose/schemas/member.d.ts +7 -7
  22. package/lib/chevre/repo/mongoose/schemas/member.js +22 -8
  23. package/lib/chevre/repo/mongoose/schemas/place.d.ts +6 -6
  24. package/lib/chevre/repo/mongoose/schemas/place.js +9 -2
  25. package/lib/chevre/repo/mongoose/schemas/product.d.ts +3 -3
  26. package/lib/chevre/repo/mongoose/schemas/reservation.d.ts +6 -3
  27. package/lib/chevre/repo/mongoose/schemas/reservation.js +10 -4
  28. package/lib/chevre/repo/order.d.ts +21 -0
  29. package/lib/chevre/repo/order.js +54 -62
  30. package/lib/chevre/repo/place.d.ts +57 -16
  31. package/lib/chevre/repo/place.js +112 -167
  32. package/lib/chevre/repo/product.d.ts +2 -4
  33. package/lib/chevre/repo/product.js +52 -7
  34. package/lib/chevre/repo/project.d.ts +5 -3
  35. package/lib/chevre/repo/project.js +48 -8
  36. package/lib/chevre/repo/reservation.d.ts +33 -21
  37. package/lib/chevre/repo/reservation.js +97 -79
  38. package/lib/chevre/repo/role.d.ts +0 -4
  39. package/lib/chevre/repo/role.js +0 -46
  40. package/lib/chevre/repo/seller.d.ts +18 -5
  41. package/lib/chevre/repo/seller.js +53 -46
  42. package/lib/chevre/repo/stockHolder.d.ts +2 -77
  43. package/lib/chevre/repo/stockHolder.js +200 -476
  44. package/lib/chevre/repo/task.d.ts +1 -1
  45. package/lib/chevre/service/aggregation/event/aggregateScreeningEvent.js +3 -2
  46. package/lib/chevre/service/aggregation/event/aggregateUseActionsOnEvent.js +1 -1
  47. package/lib/chevre/service/aggregation/project.js +5 -1
  48. package/lib/chevre/service/assetTransaction/cancelReservation.js +10 -2
  49. package/lib/chevre/service/assetTransaction/pay/account/validation.js +9 -1
  50. package/lib/chevre/service/assetTransaction/pay.js +9 -1
  51. package/lib/chevre/service/assetTransaction/registerService.js +7 -3
  52. package/lib/chevre/service/assetTransaction/reserve/factory.d.ts +6 -1
  53. package/lib/chevre/service/assetTransaction/reserve/factory.js +15 -38
  54. package/lib/chevre/service/assetTransaction/reserve.d.ts +0 -1
  55. package/lib/chevre/service/assetTransaction/reserve.js +7 -22
  56. package/lib/chevre/service/event/createEvent.d.ts +11 -0
  57. package/lib/chevre/service/event/createEvent.js +112 -0
  58. package/lib/chevre/service/event.d.ts +2 -0
  59. package/lib/chevre/service/event.js +8 -4
  60. package/lib/chevre/service/iam.d.ts +5 -0
  61. package/lib/chevre/service/iam.js +7 -19
  62. package/lib/chevre/service/moneyTransfer.js +6 -2
  63. package/lib/chevre/service/notification.js +5 -1
  64. package/lib/chevre/service/offer/event/authorize.d.ts +0 -1
  65. package/lib/chevre/service/offer/event/authorize.js +6 -2
  66. package/lib/chevre/service/offer/event/searchEventTicketOffers.js +1 -1
  67. package/lib/chevre/service/offer/product/searchProductOffers.js +1 -1
  68. package/lib/chevre/service/order/returnOrder.js +8 -1
  69. package/lib/chevre/service/order/sendOrder.js +8 -1
  70. package/lib/chevre/service/payment/creditCard.js +14 -2
  71. package/lib/chevre/service/payment/movieTicket/validation.js +9 -1
  72. package/lib/chevre/service/payment/movieTicket.js +19 -2
  73. package/lib/chevre/service/payment/paymentCard.js +6 -4
  74. package/lib/chevre/service/reserve/cancelReservation.js +15 -28
  75. package/lib/chevre/service/reserve/confirmReservation.js +14 -30
  76. package/lib/chevre/service/reserve/verifyToken4reservation.d.ts +3 -0
  77. package/lib/chevre/service/reserve/verifyToken4reservation.js +3 -1
  78. package/lib/chevre/service/task/{syncScreeningRooms.d.ts → createEvent.d.ts} +1 -1
  79. package/lib/chevre/service/task/{syncScreeningRooms.js → createEvent.js} +11 -3
  80. package/lib/chevre/service/task/onAuthorizationCreated.js +1 -0
  81. package/lib/chevre/service/task/returnPayTransaction.js +1 -0
  82. package/lib/chevre/service/transaction/moneyTransfer.js +9 -1
  83. package/lib/chevre/service/transaction/orderProgramMembership/findCreditCard.js +6 -2
  84. package/lib/chevre/service/transaction/placeOrderInProgress.js +9 -6
  85. package/lib/chevre/service/transaction/returnOrder.js +9 -3
  86. package/lib/chevre/settings.d.ts +0 -2
  87. package/lib/chevre/settings.js +7 -7
  88. package/package.json +3 -3
  89. package/example/src/chevre/findByOrderNumberAndReservationId.ts +0 -20
  90. package/example/src/chevre/findScreeningRoomsByBranchCode.ts +0 -27
  91. package/example/src/chevre/searchHoldReservations.ts +0 -38
  92. package/example/src/chevre/searchScreeningRooms.ts +0 -33
  93. package/example/src/chevre/syncScreeningRooms.ts +0 -21
  94. package/example/src/chevre/syncScreeningRoomsAll.ts +0 -41
  95. package/lib/chevre/repo/mongoose/schemas/holdReservation.d.ts +0 -75
  96. package/lib/chevre/repo/mongoose/schemas/holdReservation.js +0 -93
@@ -22,18 +22,18 @@ 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;
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;
26
26
  // MongoDB検索条件
27
27
  const andConditions = [
28
28
  { typeOf: params.typeOf }
29
29
  ];
30
30
  const projectIdEq = (_b = (_a = params.project) === null || _a === void 0 ? void 0 : _a.id) === null || _b === void 0 ? void 0 : _b.$eq;
31
31
  if (typeof projectIdEq === 'string') {
32
- andConditions.push({
33
- 'project.id': {
34
- $eq: projectIdEq
35
- }
36
- });
32
+ andConditions.push({ 'project.id': { $eq: projectIdEq } });
33
+ }
34
+ const providerIdEq = (_d = (_c = params.provider) === null || _c === void 0 ? void 0 : _c.id) === null || _d === void 0 ? void 0 : _d.$eq;
35
+ if (typeof providerIdEq === 'string') {
36
+ andConditions.push({ 'provider.id': { $eq: providerIdEq } });
37
37
  }
38
38
  // tslint:disable-next-line:no-single-line-block-comment
39
39
  /* istanbul ignore else */
@@ -172,24 +172,24 @@ class MongoRepository {
172
172
  }
173
173
  });
174
174
  }
175
- const additionalTicketTextRegex = (_c = params.additionalTicketText) === null || _c === void 0 ? void 0 : _c.$regex;
175
+ const additionalTicketTextRegex = (_e = params.additionalTicketText) === null || _e === void 0 ? void 0 : _e.$regex;
176
176
  if (typeof additionalTicketTextRegex === 'string' && additionalTicketTextRegex.length > 0) {
177
- const additionalTicketTextOptions = (_d = params.additionalTicketText) === null || _d === void 0 ? void 0 : _d.$options;
177
+ const additionalTicketTextOptions = (_f = params.additionalTicketText) === null || _f === void 0 ? void 0 : _f.$options;
178
178
  andConditions.push({
179
179
  additionalTicketText: Object.assign({ $exists: true, $regex: new RegExp(additionalTicketTextRegex) }, (typeof additionalTicketTextOptions === 'string') ? { $options: additionalTicketTextOptions } : undefined)
180
180
  });
181
181
  }
182
182
  }
183
183
  }
184
- const reservationStatusEq = (_e = params.reservationStatus) === null || _e === void 0 ? void 0 : _e.$eq;
184
+ const reservationStatusEq = (_g = params.reservationStatus) === null || _g === void 0 ? void 0 : _g.$eq;
185
185
  if (typeof reservationStatusEq === 'string') {
186
186
  andConditions.push({ reservationStatus: { $eq: reservationStatusEq } });
187
187
  }
188
- const reservationStatusNe = (_f = params.reservationStatus) === null || _f === void 0 ? void 0 : _f.$ne;
188
+ const reservationStatusNe = (_h = params.reservationStatus) === null || _h === void 0 ? void 0 : _h.$ne;
189
189
  if (typeof reservationStatusNe === 'string') {
190
190
  andConditions.push({ reservationStatus: { $ne: reservationStatusNe } });
191
191
  }
192
- const reservationStatusIn = (_g = params.reservationStatus) === null || _g === void 0 ? void 0 : _g.$in;
192
+ const reservationStatusIn = (_j = params.reservationStatus) === null || _j === void 0 ? void 0 : _j.$in;
193
193
  if (Array.isArray(reservationStatusIn)) {
194
194
  andConditions.push({ reservationStatus: { $in: reservationStatusIn } });
195
195
  }
@@ -234,7 +234,7 @@ class MongoRepository {
234
234
  }
235
235
  switch (params.typeOf) {
236
236
  case factory.reservationType.BusReservation:
237
- const reservationForTypeOfEq = (_h = params.reservationFor) === null || _h === void 0 ? void 0 : _h.typeOf;
237
+ const reservationForTypeOfEq = (_k = params.reservationFor) === null || _k === void 0 ? void 0 : _k.typeOf;
238
238
  if (typeof reservationForTypeOfEq === 'string') {
239
239
  andConditions.push({
240
240
  'reservationFor.typeOf': {
@@ -243,7 +243,7 @@ class MongoRepository {
243
243
  }
244
244
  });
245
245
  }
246
- const reservationForIdEq = (_k = (_j = params.reservationFor) === null || _j === void 0 ? void 0 : _j.id) === null || _k === void 0 ? void 0 : _k.$eq;
246
+ const reservationForIdEq = (_m = (_l = params.reservationFor) === null || _l === void 0 ? void 0 : _l.id) === null || _m === void 0 ? void 0 : _m.$eq;
247
247
  if (typeof reservationForIdEq === 'string') {
248
248
  andConditions.push({
249
249
  'reservationFor.id': {
@@ -252,7 +252,7 @@ class MongoRepository {
252
252
  }
253
253
  });
254
254
  }
255
- const reservationForIdIn = (_m = (_l = params.reservationFor) === null || _l === void 0 ? void 0 : _l.id) === null || _m === void 0 ? void 0 : _m.$in;
255
+ const reservationForIdIn = (_p = (_o = params.reservationFor) === null || _o === void 0 ? void 0 : _o.id) === null || _p === void 0 ? void 0 : _p.$in;
256
256
  if (Array.isArray(reservationForIdIn)) {
257
257
  andConditions.push({
258
258
  'reservationFor.id': {
@@ -263,7 +263,7 @@ class MongoRepository {
263
263
  }
264
264
  break;
265
265
  case factory.reservationType.EventReservation:
266
- if (typeof ((_o = params.reservationFor) === null || _o === void 0 ? void 0 : _o.id) === 'string') {
266
+ if (typeof ((_q = params.reservationFor) === null || _q === void 0 ? void 0 : _q.id) === 'string') {
267
267
  andConditions.push({
268
268
  'reservationFor.id': {
269
269
  $exists: true,
@@ -272,7 +272,7 @@ class MongoRepository {
272
272
  });
273
273
  }
274
274
  else {
275
- const reservationForIdEq4eventReservation = (_q = (_p = params.reservationFor) === null || _p === void 0 ? void 0 : _p.id) === null || _q === void 0 ? void 0 : _q.$eq;
275
+ const reservationForIdEq4eventReservation = (_s = (_r = params.reservationFor) === null || _r === void 0 ? void 0 : _r.id) === null || _s === void 0 ? void 0 : _s.$eq;
276
276
  if (typeof reservationForIdEq4eventReservation === 'string') {
277
277
  andConditions.push({
278
278
  'reservationFor.id': {
@@ -526,7 +526,7 @@ class MongoRepository {
526
526
  }
527
527
  // tslint:disable-next-line:no-single-line-block-comment
528
528
  /* istanbul ignore else */
529
- const ticketedSeatSeatingTypeIn = (_s = (_r = params.reservedTicket.ticketedSeat) === null || _r === void 0 ? void 0 : _r.seatingType) === null || _s === void 0 ? void 0 : _s.$in;
529
+ const ticketedSeatSeatingTypeIn = (_u = (_t = params.reservedTicket.ticketedSeat) === null || _t === void 0 ? void 0 : _t.seatingType) === null || _u === void 0 ? void 0 : _u.$in;
530
530
  if (Array.isArray(ticketedSeatSeatingTypeIn)) {
531
531
  andConditions.push({
532
532
  'reservedTicket.ticketedSeat.seatingType': {
@@ -537,7 +537,7 @@ class MongoRepository {
537
537
  }
538
538
  }
539
539
  }
540
- const brokerIdRegex = (_t = params.broker) === null || _t === void 0 ? void 0 : _t.id;
540
+ const brokerIdRegex = (_v = params.broker) === null || _v === void 0 ? void 0 : _v.id;
541
541
  if (typeof brokerIdRegex === 'string' && brokerIdRegex.length > 0) {
542
542
  andConditions.push({
543
543
  'broker.id': {
@@ -546,7 +546,7 @@ class MongoRepository {
546
546
  }
547
547
  });
548
548
  }
549
- const brokerIdentifierAll = (_v = (_u = params.broker) === null || _u === void 0 ? void 0 : _u.identifier) === null || _v === void 0 ? void 0 : _v.$all;
549
+ const brokerIdentifierAll = (_x = (_w = params.broker) === null || _w === void 0 ? void 0 : _w.identifier) === null || _x === void 0 ? void 0 : _x.$all;
550
550
  if (Array.isArray(brokerIdentifierAll)) {
551
551
  andConditions.push({
552
552
  'broker.identifier': {
@@ -555,7 +555,7 @@ class MongoRepository {
555
555
  }
556
556
  });
557
557
  }
558
- const brokerIdentifierIn = (_x = (_w = params.broker) === null || _w === void 0 ? void 0 : _w.identifier) === null || _x === void 0 ? void 0 : _x.$in;
558
+ const brokerIdentifierIn = (_z = (_y = params.broker) === null || _y === void 0 ? void 0 : _y.identifier) === null || _z === void 0 ? void 0 : _z.$in;
559
559
  if (Array.isArray(brokerIdentifierIn)) {
560
560
  andConditions.push({
561
561
  'broker.identifier': {
@@ -564,7 +564,7 @@ class MongoRepository {
564
564
  }
565
565
  });
566
566
  }
567
- const brokerIdentifierNin = (_z = (_y = params.broker) === null || _y === void 0 ? void 0 : _y.identifier) === null || _z === void 0 ? void 0 : _z.$nin;
567
+ const brokerIdentifierNin = (_1 = (_0 = params.broker) === null || _0 === void 0 ? void 0 : _0.identifier) === null || _1 === void 0 ? void 0 : _1.$nin;
568
568
  if (Array.isArray(brokerIdentifierNin)) {
569
569
  andConditions.push({
570
570
  'broker.identifier': {
@@ -572,7 +572,7 @@ class MongoRepository {
572
572
  }
573
573
  });
574
574
  }
575
- const brokerIdentifierElemMatch = (_1 = (_0 = params.broker) === null || _0 === void 0 ? void 0 : _0.identifier) === null || _1 === void 0 ? void 0 : _1.$elemMatch;
575
+ const brokerIdentifierElemMatch = (_3 = (_2 = params.broker) === null || _2 === void 0 ? void 0 : _2.identifier) === null || _3 === void 0 ? void 0 : _3.$elemMatch;
576
576
  if (brokerIdentifierElemMatch !== undefined && brokerIdentifierElemMatch !== null) {
577
577
  andConditions.push({
578
578
  'broker.identifier': {
@@ -607,9 +607,9 @@ class MongoRepository {
607
607
  }
608
608
  }
609
609
  else {
610
- const emailRegex = (_2 = params.underName.email) === null || _2 === void 0 ? void 0 : _2.$regex;
610
+ const emailRegex = (_4 = params.underName.email) === null || _4 === void 0 ? void 0 : _4.$regex;
611
611
  if (typeof emailRegex === 'string' && emailRegex.length > 0) {
612
- const emailOptions = (_3 = params.underName.email) === null || _3 === void 0 ? void 0 : _3.$options;
612
+ const emailOptions = (_5 = params.underName.email) === null || _5 === void 0 ? void 0 : _5.$options;
613
613
  andConditions.push({
614
614
  'underName.email': Object.assign({ $exists: true, $regex: new RegExp(emailRegex) }, (typeof emailOptions === 'string') ? { $options: emailOptions } : undefined)
615
615
  });
@@ -628,9 +628,9 @@ class MongoRepository {
628
628
  }
629
629
  }
630
630
  else {
631
- const underNameNameRegex = (_4 = params.underName.name) === null || _4 === void 0 ? void 0 : _4.$regex;
631
+ const underNameNameRegex = (_6 = params.underName.name) === null || _6 === void 0 ? void 0 : _6.$regex;
632
632
  if (typeof underNameNameRegex === 'string' && underNameNameRegex.length > 0) {
633
- const underNameNameOptions = (_5 = params.underName.name) === null || _5 === void 0 ? void 0 : _5.$options;
633
+ const underNameNameOptions = (_7 = params.underName.name) === null || _7 === void 0 ? void 0 : _7.$options;
634
634
  andConditions.push({
635
635
  'underName.name': Object.assign({ $exists: true, $regex: new RegExp(underNameNameRegex) }, (typeof underNameNameOptions === 'string') ? { $options: underNameNameOptions } : undefined)
636
636
  });
@@ -659,9 +659,9 @@ class MongoRepository {
659
659
  }
660
660
  }
661
661
  else {
662
- const givenNameRegex = (_6 = params.underName.givenName) === null || _6 === void 0 ? void 0 : _6.$regex;
662
+ const givenNameRegex = (_8 = params.underName.givenName) === null || _8 === void 0 ? void 0 : _8.$regex;
663
663
  if (typeof givenNameRegex === 'string' && givenNameRegex.length > 0) {
664
- const givenNameOptions = (_7 = params.underName.givenName) === null || _7 === void 0 ? void 0 : _7.$options;
664
+ const givenNameOptions = (_9 = params.underName.givenName) === null || _9 === void 0 ? void 0 : _9.$options;
665
665
  andConditions.push({
666
666
  'underName.givenName': Object.assign({ $exists: true, $regex: new RegExp(givenNameRegex) }, (typeof givenNameOptions === 'string') ? { $options: givenNameOptions } : undefined)
667
667
  });
@@ -680,9 +680,9 @@ class MongoRepository {
680
680
  }
681
681
  }
682
682
  else {
683
- const familyNameRegex = (_8 = params.underName.familyName) === null || _8 === void 0 ? void 0 : _8.$regex;
683
+ const familyNameRegex = (_10 = params.underName.familyName) === null || _10 === void 0 ? void 0 : _10.$regex;
684
684
  if (typeof familyNameRegex === 'string' && familyNameRegex.length > 0) {
685
- const familyNameOptions = (_9 = params.underName.familyName) === null || _9 === void 0 ? void 0 : _9.$options;
685
+ const familyNameOptions = (_11 = params.underName.familyName) === null || _11 === void 0 ? void 0 : _11.$options;
686
686
  andConditions.push({
687
687
  'underName.familyName': Object.assign({ $exists: true, $regex: new RegExp(familyNameRegex) }, (typeof familyNameOptions === 'string') ? { $options: familyNameOptions } : undefined)
688
688
  });
@@ -783,7 +783,7 @@ class MongoRepository {
783
783
  });
784
784
  }
785
785
  }
786
- const programMembershipUsedIdentifierEq = (_11 = (_10 = params.programMembershipUsed) === null || _10 === void 0 ? void 0 : _10.identifier) === null || _11 === void 0 ? void 0 : _11.$eq;
786
+ const programMembershipUsedIdentifierEq = (_13 = (_12 = params.programMembershipUsed) === null || _12 === void 0 ? void 0 : _12.identifier) === null || _13 === void 0 ? void 0 : _13.$eq;
787
787
  if (typeof programMembershipUsedIdentifierEq === 'string') {
788
788
  andConditions.push({
789
789
  'programMembershipUsed.identifier': {
@@ -792,7 +792,7 @@ class MongoRepository {
792
792
  }
793
793
  });
794
794
  }
795
- const programMembershipUsedIssuedThroughServiceTypeCodeValueEq = (_15 = (_14 = (_13 = (_12 = params.programMembershipUsed) === null || _12 === void 0 ? void 0 : _12.issuedThrough) === null || _13 === void 0 ? void 0 : _13.serviceType) === null || _14 === void 0 ? void 0 : _14.codeValue) === null || _15 === void 0 ? void 0 : _15.$eq;
795
+ const programMembershipUsedIssuedThroughServiceTypeCodeValueEq = (_17 = (_16 = (_15 = (_14 = params.programMembershipUsed) === null || _14 === void 0 ? void 0 : _14.issuedThrough) === null || _15 === void 0 ? void 0 : _15.serviceType) === null || _16 === void 0 ? void 0 : _16.codeValue) === null || _17 === void 0 ? void 0 : _17.$eq;
796
796
  if (typeof programMembershipUsedIssuedThroughServiceTypeCodeValueEq === 'string') {
797
797
  andConditions.push({
798
798
  'programMembershipUsed.issuedThrough.serviceType.codeValue': {
@@ -801,7 +801,7 @@ class MongoRepository {
801
801
  }
802
802
  });
803
803
  }
804
- const appliesToMovieTicketIdentifierEq = (_19 = (_18 = (_17 = (_16 = params.price) === null || _16 === void 0 ? void 0 : _16.priceComponent) === null || _17 === void 0 ? void 0 : _17.appliesToMovieTicket) === null || _18 === void 0 ? void 0 : _18.identifier) === null || _19 === void 0 ? void 0 : _19.$eq;
804
+ const appliesToMovieTicketIdentifierEq = (_21 = (_20 = (_19 = (_18 = params.price) === null || _18 === void 0 ? void 0 : _18.priceComponent) === null || _19 === void 0 ? void 0 : _19.appliesToMovieTicket) === null || _20 === void 0 ? void 0 : _20.identifier) === null || _21 === void 0 ? void 0 : _21.$eq;
805
805
  if (typeof appliesToMovieTicketIdentifierEq === 'string') {
806
806
  andConditions.push({
807
807
  'price.priceComponent.appliesToMovieTicket.identifier': {
@@ -812,25 +812,24 @@ class MongoRepository {
812
812
  }
813
813
  return andConditions;
814
814
  }
815
- createMany(params) {
816
- return __awaiter(this, void 0, void 0, function* () {
817
- if (params.reservations.length > 0) {
818
- const result = yield this.reservationModel.insertMany(params.reservations.map((r) => {
819
- return Object.assign(Object.assign({}, r), { _id: r.id, reservationFor: params.reservationFor });
820
- }), { ordered: false, rawResult: true });
821
- // console.log('repos.reservation.reservationModel.insertMany result:', result);
822
- // if (result.result?.ok !== 1) {
823
- // throw new factory.errors.ServiceUnavailable('creating reservations not executed correctly');
824
- // }
825
- if (result.insertedCount !== params.reservations.length) {
826
- throw new factory.errors.ServiceUnavailable('all reservations not saved');
827
- }
828
- }
829
- else {
830
- // no op
831
- }
832
- });
833
- }
815
+ // public async createMany(params: {
816
+ // reservations: factory.assetTransaction.reserve.IObjectSubReservation[];
817
+ // reservationFor: factory.assetTransaction.reserve.IReservationFor;
818
+ // }): Promise<void> {
819
+ // if (params.reservations.length > 0) {
820
+ // const result = await this.reservationModel.insertMany(
821
+ // params.reservations.map((r) => {
822
+ // return { ...r, _id: r.id, reservationFor: params.reservationFor };
823
+ // }),
824
+ // { ordered: false, rawResult: true }
825
+ // );
826
+ // if (result.insertedCount !== params.reservations.length) {
827
+ // throw new factory.errors.ServiceUnavailable('all reservations not saved');
828
+ // }
829
+ // } else {
830
+ // // no op
831
+ // }
832
+ // }
834
833
  /**
835
834
  * 汎用予約カウント
836
835
  */
@@ -899,30 +898,29 @@ class MongoRepository {
899
898
  return doc.toObject();
900
899
  });
901
900
  }
902
- confirmByReservationNumber(params) {
903
- var _a, _b;
904
- return __awaiter(this, void 0, void 0, function* () {
905
- const conditions = {
906
- reservationNumber: { $eq: String(params.reservationNumber) },
907
- reservationStatus: { $eq: params.previousReservationStatus }
908
- };
909
- const update = Object.assign(Object.assign(Object.assign({
910
- // previousReservationStatusを保管(2023-01-19~)
911
- previousReservationStatus: params.previousReservationStatus, reservationStatus: factory.reservationStatusType.ReservationConfirmed, modifiedTime: new Date() }, (params.underName !== undefined) ? { underName: params.underName } : undefined), (typeof ((_a = params.broker) === null || _a === void 0 ? void 0 : _a.typeOf) === 'string') ? { broker: params.broker } : undefined), (typeof ((_b = params.issuedThrough) === null || _b === void 0 ? void 0 : _b.typeOf) === 'string') ? { issuedThrough: params.issuedThrough } : undefined);
912
- yield this.reservationModel.updateMany(conditions, update)
913
- .exec();
914
- });
915
- }
916
- confirmByIdIfNotExist__(params) {
917
- var _a, _b;
918
- return __awaiter(this, void 0, void 0, function* () {
919
- yield this.reservationModel.findOneAndUpdate({ _id: { $eq: params.reservation.id } }, {
920
- $setOnInsert: Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, params.reservation), { _id: params.reservation.id, reservationFor: params.reservationFor, reservationStatus: factory.reservationStatusType.ReservationConfirmed, modifiedTime: new Date() }), (params.underName !== undefined) ? { underName: params.underName } : undefined), (typeof ((_a = params.broker) === null || _a === void 0 ? void 0 : _a.typeOf) === 'string') ? { broker: params.broker } : undefined), (typeof ((_b = params.issuedThrough) === null || _b === void 0 ? void 0 : _b.typeOf) === 'string') ? { issuedThrough: params.issuedThrough } : undefined)
921
- }, { upsert: true, new: true })
922
- .select({ _id: 1 })
923
- .exec();
924
- });
925
- }
901
+ // public async confirmByReservationNumber(params: {
902
+ // reservationNumber: string;
903
+ // previousReservationStatus: factory.reservationStatusType;
904
+ // underName?: factory.reservation.IUnderName<factory.reservationType.EventReservation>;
905
+ // broker?: factory.reservation.IBroker<factory.reservationType>;
906
+ // issuedThrough?: factory.assetTransaction.reserve.IIssuedThrough;
907
+ // }): Promise<void> {
908
+ // const conditions = {
909
+ // reservationNumber: { $eq: String(params.reservationNumber) },
910
+ // reservationStatus: { $eq: params.previousReservationStatus }
911
+ // };
912
+ // const update = {
913
+ // // previousReservationStatusを保管(2023-01-19~)
914
+ // previousReservationStatus: params.previousReservationStatus,
915
+ // reservationStatus: factory.reservationStatusType.ReservationConfirmed,
916
+ // modifiedTime: new Date(),
917
+ // ...(params.underName !== undefined) ? { underName: params.underName } : undefined,
918
+ // ...(typeof params.broker?.typeOf === 'string') ? { broker: params.broker } : undefined,
919
+ // ...(typeof params.issuedThrough?.typeOf === 'string') ? { issuedThrough: params.issuedThrough } : undefined
920
+ // };
921
+ // await this.reservationModel.updateMany(conditions, update)
922
+ // .exec();
923
+ // }
926
924
  confirmManyIfNotExist(params) {
927
925
  return __awaiter(this, void 0, void 0, function* () {
928
926
  const modifiedTime = new Date();
@@ -930,11 +928,26 @@ class MongoRepository {
930
928
  if (Array.isArray(params.subReservation)) {
931
929
  params.subReservation.forEach((subReservation) => {
932
930
  var _a, _b;
931
+ let setOnInsert;
932
+ switch (subReservation.typeOf) {
933
+ case factory.reservationType.BusReservation:
934
+ setOnInsert = Object.assign(Object.assign(Object.assign(Object.assign({}, subReservation), { _id: subReservation.id, issuedThrough: params.issuedThrough, reservationFor: params.reservationFor, reservationStatus: factory.reservationStatusType.ReservationConfirmed, modifiedTime,
935
+ // providerを追加(2023-07-19~)
936
+ provider: params.provider }), (params.underName !== undefined) ? { underName: params.underName } : undefined), (typeof ((_a = params.broker) === null || _a === void 0 ? void 0 : _a.typeOf) === 'string') ? { broker: params.broker } : undefined);
937
+ break;
938
+ case factory.reservationType.EventReservation:
939
+ setOnInsert = Object.assign(Object.assign(Object.assign(Object.assign({}, subReservation), { _id: subReservation.id, issuedThrough: params.issuedThrough, reservationFor: params.reservationFor, reservationStatus: factory.reservationStatusType.ReservationConfirmed, modifiedTime,
940
+ // providerを追加(2023-07-19~)
941
+ provider: params.provider }), (params.underName !== undefined) ? { underName: params.underName } : undefined), (typeof ((_b = params.broker) === null || _b === void 0 ? void 0 : _b.typeOf) === 'string') ? { broker: params.broker } : undefined);
942
+ break;
943
+ default:
944
+ throw new factory.errors.NotImplemented(`${subReservation.typeOf} not implemented`);
945
+ }
933
946
  bulkWriteOps.push({
934
947
  updateOne: {
935
- filter: { _id: { $eq: subReservation.id } },
948
+ filter: { _id: { $eq: setOnInsert.id } },
936
949
  update: {
937
- $setOnInsert: Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, subReservation), { _id: subReservation.id, reservationFor: params.reservationFor, reservationStatus: factory.reservationStatusType.ReservationConfirmed, modifiedTime }), (params.underName !== undefined) ? { underName: params.underName } : undefined), (typeof ((_a = params.broker) === null || _a === void 0 ? void 0 : _a.typeOf) === 'string') ? { broker: params.broker } : undefined), (typeof ((_b = params.issuedThrough) === null || _b === void 0 ? void 0 : _b.typeOf) === 'string') ? { issuedThrough: params.issuedThrough } : undefined)
950
+ $setOnInsert: setOnInsert
938
951
  },
939
952
  upsert: true
940
953
  }
@@ -1099,10 +1112,10 @@ class MongoRepository {
1099
1112
  /**
1100
1113
  * 予約部分更新
1101
1114
  */
1102
- // public async findByIdAndUpdate(params: {
1103
1115
  updatePartiallyById(params) {
1104
1116
  return __awaiter(this, void 0, void 0, function* () {
1105
1117
  return this.reservationModel.findOneAndUpdate({ _id: { $eq: params.id } }, params.update, { new: true })
1118
+ .select({ _id: 1 })
1106
1119
  .exec()
1107
1120
  .then((doc) => {
1108
1121
  if (doc === null) {
@@ -1172,5 +1185,10 @@ class MongoRepository {
1172
1185
  .exec();
1173
1186
  });
1174
1187
  }
1188
+ getCursor(conditions, projection) {
1189
+ return this.reservationModel.find(conditions, projection)
1190
+ .sort({ bookingTime: factory.sortType.Descending })
1191
+ .cursor();
1192
+ }
1175
1193
  }
1176
1194
  exports.MongoRepository = MongoRepository;
@@ -15,7 +15,6 @@ export declare class MongoRepository {
15
15
  private readonly roleModel;
16
16
  constructor(connection: Connection);
17
17
  static CREATE_MONGO_CONDITIONS(params: factory.iam.IRoleSearchConditions): any[];
18
- count(params: factory.iam.IRoleSearchConditions): Promise<number>;
19
18
  search(params: factory.iam.IRoleSearchConditions): Promise<IRole[]>;
20
19
  aggregatePermissions(params: {
21
20
  roleName: {
@@ -24,7 +23,4 @@ export declare class MongoRepository {
24
23
  }): Promise<{
25
24
  _id: string;
26
25
  }[]>;
27
- findById(params: {
28
- id: string;
29
- }): Promise<IRole>;
30
26
  }
@@ -10,7 +10,6 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
10
10
  };
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
12
  exports.MongoRepository = exports.RoleType = void 0;
13
- const factory = require("../factory");
14
13
  const role_1 = require("./mongoose/schemas/role");
15
14
  const settings_1 = require("../settings");
16
15
  var RoleType;
@@ -27,30 +26,6 @@ class MongoRepository {
27
26
  static CREATE_MONGO_CONDITIONS(params) {
28
27
  var _a, _b, _c;
29
28
  const andConditions = [];
30
- // tslint:disable-next-line:no-single-line-block-comment
31
- /* istanbul ignore else */
32
- // if (params.id !== undefined && params.id !== null) {
33
- // if (typeof params.id.$eq === 'string') {
34
- // andConditions.push({
35
- // _id: {
36
- // $eq: params.id.$eq
37
- // }
38
- // });
39
- // }
40
- // }
41
- // tslint:disable-next-line:no-single-line-block-comment
42
- /* istanbul ignore else */
43
- // if (params.project !== undefined && params.project !== null) {
44
- // if (params.project.id !== undefined && params.project.id !== null) {
45
- // if (typeof params.project.id.$eq === 'string') {
46
- // andConditions.push({
47
- // 'project.id': {
48
- // $eq: params.project.id.$eq
49
- // }
50
- // });
51
- // }
52
- // }
53
- // }
54
29
  if (typeof ((_a = params.roleName) === null || _a === void 0 ? void 0 : _a.$eq) === 'string') {
55
30
  andConditions.push({ roleName: { $eq: params.roleName.$eq } });
56
31
  }
@@ -64,14 +39,6 @@ class MongoRepository {
64
39
  }
65
40
  return andConditions;
66
41
  }
67
- count(params) {
68
- return __awaiter(this, void 0, void 0, function* () {
69
- const conditions = MongoRepository.CREATE_MONGO_CONDITIONS(params);
70
- return this.roleModel.countDocuments((conditions.length > 0) ? { $and: conditions } : {})
71
- .setOptions({ maxTimeMS: settings_1.MONGO_MAX_TIME_MS })
72
- .exec();
73
- });
74
- }
75
42
  search(params) {
76
43
  return __awaiter(this, void 0, void 0, function* () {
77
44
  const conditions = MongoRepository.CREATE_MONGO_CONDITIONS(params);
@@ -133,18 +100,5 @@ class MongoRepository {
133
100
  .exec();
134
101
  });
135
102
  }
136
- findById(params) {
137
- return __awaiter(this, void 0, void 0, function* () {
138
- const doc = yield this.roleModel.findOne({
139
- _id: params.id
140
- })
141
- .select({ __v: 0, createdAt: 0, updatedAt: 0 })
142
- .exec();
143
- if (doc === null) {
144
- throw new factory.errors.NotFound(this.roleModel.modelName);
145
- }
146
- return doc.toObject();
147
- });
148
- }
149
103
  }
150
104
  exports.MongoRepository = MongoRepository;
@@ -25,19 +25,29 @@
25
25
  import { Connection } from 'mongoose';
26
26
  import * as factory from '../factory';
27
27
  export type ISeller = factory.seller.ISeller;
28
+ export interface IMemberSearchConditions {
29
+ /**
30
+ * 販売者メンバーで絞る場合
31
+ */
32
+ member?: {
33
+ memberOf?: {
34
+ id?: {
35
+ $in?: string[];
36
+ };
37
+ };
38
+ };
39
+ }
28
40
  /**
29
41
  * 販売者リポジトリ
30
42
  */
31
43
  export declare class MongoRepository {
32
44
  private readonly organizationModel;
33
45
  constructor(connection: Connection);
34
- static CREATE_MONGO_CONDITIONS(params: factory.seller.ISearchConditions): any[];
46
+ static CREATE_MONGO_CONDITIONS(params: factory.seller.ISearchConditions & IMemberSearchConditions): any[];
35
47
  /**
36
48
  * 特定販売者検索
49
+ * searchに置き換え(2023-07-13~)
37
50
  */
38
- findById(conditions: {
39
- id: string;
40
- }, inclusion: string[], exclusion: string[]): Promise<ISeller>;
41
51
  /**
42
52
  * 販売者を保管する
43
53
  */
@@ -48,7 +58,7 @@ export declare class MongoRepository {
48
58
  /**
49
59
  * 販売者検索
50
60
  */
51
- search(conditions: factory.seller.ISearchConditions, inclusion: string[], exclusion: string[]): Promise<ISeller[]>;
61
+ search(conditions: factory.seller.ISearchConditions & IMemberSearchConditions, inclusion: string[], exclusion: string[]): Promise<ISeller[]>;
52
62
  /**
53
63
  * 対応決済方法を検索する
54
64
  */
@@ -73,6 +83,9 @@ export declare class MongoRepository {
73
83
  * 販売者を削除する
74
84
  */
75
85
  deleteById(params: {
86
+ project: {
87
+ id: string;
88
+ };
76
89
  id: string;
77
90
  }): Promise<void>;
78
91
  /**