@chevre/domain 21.4.0-alpha.2 → 21.4.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 (86) hide show
  1. package/example/src/chevre/cleanActions.ts +23 -0
  2. package/example/src/chevre/cleanEventsByMovieTheater.ts +32 -0
  3. package/example/src/chevre/createDeleteTransactionTasksOfDeletedPeople.ts +126 -0
  4. package/example/src/chevre/createManyEventsIfNotExist.ts +6 -0
  5. package/example/src/chevre/migrateEventOrganizer.ts +125 -0
  6. package/example/src/chevre/migrateReservationProvider.ts +117 -0
  7. package/example/src/chevre/migrateScreeningRoomOrganizer.ts +91 -0
  8. package/example/src/chevre/processReserve.ts +0 -1
  9. package/example/src/chevre/searchEvents.ts +1 -9
  10. package/example/src/chevre/searchProductOffers.ts +6 -0
  11. package/lib/chevre/factory/event.d.ts +1 -1
  12. package/lib/chevre/repo/action.d.ts +6 -0
  13. package/lib/chevre/repo/action.js +13 -0
  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 +25 -4
  17. package/lib/chevre/repo/event.js +122 -60
  18. package/lib/chevre/repo/mongoose/schemas/event.d.ts +7 -4
  19. package/lib/chevre/repo/mongoose/schemas/event.js +15 -2
  20. package/lib/chevre/repo/mongoose/schemas/place.d.ts +6 -6
  21. package/lib/chevre/repo/mongoose/schemas/place.js +9 -2
  22. package/lib/chevre/repo/mongoose/schemas/product.d.ts +3 -3
  23. package/lib/chevre/repo/mongoose/schemas/reservation.d.ts +3 -0
  24. package/lib/chevre/repo/mongoose/schemas/reservation.js +6 -3
  25. package/lib/chevre/repo/order.d.ts +21 -0
  26. package/lib/chevre/repo/order.js +54 -62
  27. package/lib/chevre/repo/place.d.ts +57 -16
  28. package/lib/chevre/repo/place.js +112 -167
  29. package/lib/chevre/repo/product.d.ts +2 -4
  30. package/lib/chevre/repo/product.js +52 -7
  31. package/lib/chevre/repo/productOffer.d.ts +19 -4
  32. package/lib/chevre/repo/productOffer.js +37 -14
  33. package/lib/chevre/repo/reservation.d.ts +33 -21
  34. package/lib/chevre/repo/reservation.js +97 -79
  35. package/lib/chevre/repo/seller.d.ts +4 -3
  36. package/lib/chevre/repo/seller.js +40 -38
  37. package/lib/chevre/repo/task.d.ts +1 -1
  38. package/lib/chevre/service/aggregation/event/aggregateScreeningEvent.d.ts +2 -2
  39. package/lib/chevre/service/aggregation/event/aggregateScreeningEvent.js +3 -2
  40. package/lib/chevre/service/aggregation/event/aggregateUseActionsOnEvent.js +1 -1
  41. package/lib/chevre/service/assetTransaction/pay/account/validation.js +9 -1
  42. package/lib/chevre/service/assetTransaction/pay.js +9 -1
  43. package/lib/chevre/service/assetTransaction/registerService.js +2 -2
  44. package/lib/chevre/service/assetTransaction/reserve/factory.d.ts +10 -4
  45. package/lib/chevre/service/assetTransaction/reserve/factory.js +21 -40
  46. package/lib/chevre/service/assetTransaction/reserve.d.ts +0 -1
  47. package/lib/chevre/service/assetTransaction/reserve.js +7 -22
  48. package/lib/chevre/service/event/createEvent.d.ts +9 -0
  49. package/lib/chevre/service/event/createEvent.js +86 -0
  50. package/lib/chevre/service/event.d.ts +2 -0
  51. package/lib/chevre/service/event.js +26 -26
  52. package/lib/chevre/service/moneyTransfer.js +1 -1
  53. package/lib/chevre/service/offer/event/authorize.d.ts +0 -1
  54. package/lib/chevre/service/offer/event/authorize.js +6 -2
  55. package/lib/chevre/service/offer/event/searchEventTicketOffers.js +16 -2
  56. package/lib/chevre/service/offer/eventServiceByCOA/factory.d.ts +1 -1
  57. package/lib/chevre/service/offer/product/searchProductOffers.js +1 -1
  58. package/lib/chevre/service/order/returnOrder.js +8 -1
  59. package/lib/chevre/service/order/sendOrder.js +8 -1
  60. package/lib/chevre/service/payment/creditCard.js +9 -1
  61. package/lib/chevre/service/payment/movieTicket/factory.d.ts +2 -1
  62. package/lib/chevre/service/payment/movieTicket/validation.js +9 -1
  63. package/lib/chevre/service/payment/movieTicket.js +19 -2
  64. package/lib/chevre/service/payment/paymentCard.js +1 -3
  65. package/lib/chevre/service/reserve/cancelReservation.js +15 -28
  66. package/lib/chevre/service/reserve/confirmReservation.js +12 -30
  67. package/lib/chevre/service/reserve/verifyToken4reservation.d.ts +3 -0
  68. package/lib/chevre/service/reserve/verifyToken4reservation.js +3 -1
  69. package/lib/chevre/service/task/{syncScreeningRooms.d.ts → createEvent.d.ts} +1 -1
  70. package/lib/chevre/service/task/{syncScreeningRooms.js → createEvent.js} +10 -4
  71. package/lib/chevre/service/task/onAuthorizationCreated.js +1 -0
  72. package/lib/chevre/service/task/returnPayTransaction.js +1 -0
  73. package/lib/chevre/service/transaction/moneyTransfer.js +9 -1
  74. package/lib/chevre/service/transaction/orderProgramMembership/findCreditCard.js +1 -1
  75. package/lib/chevre/service/transaction/placeOrderInProgress.js +9 -6
  76. package/lib/chevre/service/transaction/returnOrder.js +9 -3
  77. package/package.json +3 -3
  78. package/example/src/chevre/findByOrderNumberAndReservationId.ts +0 -20
  79. package/example/src/chevre/findScreeningRoomsByBranchCode.ts +0 -27
  80. package/example/src/chevre/migrateEventOffersItemOfferedAvailableChannel.ts +0 -90
  81. package/example/src/chevre/migrateEventOffersItemOfferedTypeOf.ts +0 -75
  82. package/example/src/chevre/migrateSSKTEventCOAEndpoint.ts +0 -64
  83. package/example/src/chevre/migrateScreeningEventSeriesVersion.ts +0 -79
  84. package/example/src/chevre/searchScreeningRooms.ts +0 -33
  85. package/example/src/chevre/syncScreeningRooms.ts +0 -21
  86. package/example/src/chevre/syncScreeningRoomsAll.ts +0 -41
@@ -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;
@@ -34,10 +34,8 @@ export declare class MongoRepository {
34
34
  static CREATE_MONGO_CONDITIONS(params: factory.seller.ISearchConditions): any[];
35
35
  /**
36
36
  * 特定販売者検索
37
+ * searchに置き換え(2023-07-13~)
37
38
  */
38
- findById(conditions: {
39
- id: string;
40
- }, inclusion: string[], exclusion: string[]): Promise<ISeller>;
41
39
  /**
42
40
  * 販売者を保管する
43
41
  */
@@ -73,6 +71,9 @@ export declare class MongoRepository {
73
71
  * 販売者を削除する
74
72
  */
75
73
  deleteById(params: {
74
+ project: {
75
+ id: string;
76
+ };
76
77
  id: string;
77
78
  }): Promise<void>;
78
79
  /**
@@ -128,37 +128,39 @@ class MongoRepository {
128
128
  }
129
129
  /**
130
130
  * 特定販売者検索
131
+ * searchに置き換え(2023-07-13~)
131
132
  */
132
- findById(conditions,
133
- // projection?: any
134
- inclusion, exclusion) {
135
- return __awaiter(this, void 0, void 0, function* () {
136
- let projection = {};
137
- if (Array.isArray(inclusion) && inclusion.length > 0) {
138
- inclusion.forEach((field) => {
139
- projection[field] = 1;
140
- });
141
- }
142
- else {
143
- projection = {
144
- __v: 0,
145
- createdAt: 0,
146
- updatedAt: 0
147
- };
148
- if (Array.isArray(exclusion) && exclusion.length > 0) {
149
- exclusion.forEach((field) => {
150
- projection[field] = 0;
151
- });
152
- }
153
- }
154
- const doc = yield this.organizationModel.findOne({ _id: conditions.id }, projection)
155
- .exec();
156
- if (doc === null) {
157
- throw new factory.errors.NotFound(this.organizationModel.modelName);
158
- }
159
- return doc.toObject();
160
- });
161
- }
133
+ // public async findById(
134
+ // conditions: {
135
+ // id: string;
136
+ // },
137
+ // inclusion: string[],
138
+ // exclusion: string[]
139
+ // ): Promise<ISeller> {
140
+ // let projection: { [key: string]: number } = {};
141
+ // if (Array.isArray(inclusion) && inclusion.length > 0) {
142
+ // inclusion.forEach((field) => {
143
+ // projection[field] = 1;
144
+ // });
145
+ // } else {
146
+ // projection = {
147
+ // __v: 0,
148
+ // createdAt: 0,
149
+ // updatedAt: 0
150
+ // };
151
+ // if (Array.isArray(exclusion) && exclusion.length > 0) {
152
+ // exclusion.forEach((field) => {
153
+ // projection[field] = 0;
154
+ // });
155
+ // }
156
+ // }
157
+ // const doc = await this.organizationModel.findOne({ _id: conditions.id }, projection)
158
+ // .exec();
159
+ // if (doc === null) {
160
+ // throw new factory.errors.NotFound(this.organizationModel.modelName);
161
+ // }
162
+ // return doc.toObject();
163
+ // }
162
164
  /**
163
165
  * 販売者を保管する
164
166
  */
@@ -172,7 +174,10 @@ class MongoRepository {
172
174
  else {
173
175
  // 上書き禁止属性を除外(2022-08-24~)
174
176
  const _a = params.attributes, { id, branchCode, project, typeOf } = _a, updateFields = __rest(_a, ["id", "branchCode", "project", "typeOf"]);
175
- const doc = yield this.organizationModel.findOneAndUpdate({ _id: params.id }, updateFields, { upsert: false, new: true })
177
+ const doc = yield this.organizationModel.findOneAndUpdate({
178
+ _id: params.id,
179
+ 'project.id': { $eq: project.id }
180
+ }, updateFields, { upsert: false, new: true })
176
181
  .exec();
177
182
  if (doc === null) {
178
183
  throw new factory.errors.NotFound(this.organizationModel.modelName);
@@ -182,12 +187,6 @@ class MongoRepository {
182
187
  return organization;
183
188
  });
184
189
  }
185
- // public async count(params: factory.seller.ISearchConditions): Promise<number> {
186
- // const conditions = MongoRepository.CREATE_MONGO_CONDITIONS(params);
187
- // return this.organizationModel.countDocuments((conditions.length > 0) ? { $and: conditions } : {})
188
- // .setOptions({ maxTimeMS: MONGO_MAX_TIME_MS })
189
- // .exec();
190
- // }
191
190
  /**
192
191
  * 販売者検索
193
192
  */
@@ -270,7 +269,10 @@ class MongoRepository {
270
269
  */
271
270
  deleteById(params) {
272
271
  return __awaiter(this, void 0, void 0, function* () {
273
- yield this.organizationModel.findOneAndRemove({ _id: params.id })
272
+ yield this.organizationModel.findOneAndRemove({
273
+ _id: params.id,
274
+ 'project.id': { $eq: params.project.id }
275
+ })
274
276
  .exec();
275
277
  });
276
278
  }
@@ -63,7 +63,7 @@ export declare class MongoRepository {
63
63
  */
64
64
  $nin?: factory.taskName[];
65
65
  };
66
- }): Promise<Pick<import("@chevre/factory/lib/task").ITask | import("@chevre/factory/lib/task/confirmMoneyTransfer").ITask | import("@chevre/factory/lib/task/confirmRegisterService").ITask | import("@chevre/factory/lib/task/confirmPayTransaction").ITask | import("@chevre/factory/lib/task/confirmRegisterServiceTransaction").ITask | import("@chevre/factory/lib/task/confirmReserveTransaction").ITask | import("@chevre/factory/lib/task/deleteTransaction").ITask | import("@chevre/factory/lib/task/givePointAward").ITask | import("@chevre/factory/lib/task/onAuthorizationCreated").ITask | import("@chevre/factory/lib/task/onEventChanged").ITask | import("@chevre/factory/lib/task/onResourceUpdated").ITask | import("@chevre/factory/lib/task/orderProgramMembership").ITask | import("@chevre/factory/lib/task/placeOrder").ITask | import("@chevre/factory/lib/task/returnOrder").ITask | import("@chevre/factory/lib/task/returnMoneyTransfer").ITask | import("@chevre/factory/lib/task/returnPayTransaction").ITask | import("@chevre/factory/lib/task/returnPointAward").ITask | import("@chevre/factory/lib/task/returnReserveTransaction").ITask | import("@chevre/factory/lib/task/sendEmailMessage").ITask | import("@chevre/factory/lib/task/sendOrder").ITask | import("@chevre/factory/lib/task/syncScreeningRooms").ITask | import("@chevre/factory/lib/task/triggerWebhook").ITask | import("@chevre/factory/lib/task/useReservation").ITask | import("@chevre/factory/lib/task/voidMoneyTransferTransaction").ITask | import("@chevre/factory/lib/task/voidPayTransaction").ITask | import("@chevre/factory/lib/task/voidRegisterServiceTransaction").ITask | import("@chevre/factory/lib/task/voidReserveTransaction").ITask, "id" | "name" | "status">[]>;
66
+ }): Promise<Pick<import("@chevre/factory/lib/task").ITask | import("@chevre/factory/lib/task/confirmMoneyTransfer").ITask | import("@chevre/factory/lib/task/confirmRegisterService").ITask | import("@chevre/factory/lib/task/confirmPayTransaction").ITask | import("@chevre/factory/lib/task/confirmRegisterServiceTransaction").ITask | import("@chevre/factory/lib/task/confirmReserveTransaction").ITask | import("@chevre/factory/lib/task/createEvent").ITask | import("@chevre/factory/lib/task/deleteTransaction").ITask | import("@chevre/factory/lib/task/givePointAward").ITask | import("@chevre/factory/lib/task/onAuthorizationCreated").ITask | import("@chevre/factory/lib/task/onEventChanged").ITask | import("@chevre/factory/lib/task/onResourceUpdated").ITask | import("@chevre/factory/lib/task/orderProgramMembership").ITask | import("@chevre/factory/lib/task/placeOrder").ITask | import("@chevre/factory/lib/task/returnOrder").ITask | import("@chevre/factory/lib/task/returnMoneyTransfer").ITask | import("@chevre/factory/lib/task/returnPayTransaction").ITask | import("@chevre/factory/lib/task/returnPointAward").ITask | import("@chevre/factory/lib/task/returnReserveTransaction").ITask | import("@chevre/factory/lib/task/sendEmailMessage").ITask | import("@chevre/factory/lib/task/sendOrder").ITask | import("@chevre/factory/lib/task/syncScreeningRooms").ITask | import("@chevre/factory/lib/task/triggerWebhook").ITask | import("@chevre/factory/lib/task/useReservation").ITask | import("@chevre/factory/lib/task/voidMoneyTransferTransaction").ITask | import("@chevre/factory/lib/task/voidPayTransaction").ITask | import("@chevre/factory/lib/task/voidRegisterServiceTransaction").ITask | import("@chevre/factory/lib/task/voidReserveTransaction").ITask, "id" | "name" | "status">[]>;
67
67
  retry(params: {
68
68
  intervalInMinutes: number;
69
69
  }): Promise<void>;
@@ -1,4 +1,4 @@
1
- import { MongoRepository as EventRepo } from '../../../repo/event';
1
+ import { IMinimizedIndividualEvent, MongoRepository as EventRepo } from '../../../repo/event';
2
2
  import { MongoRepository as OfferRepo } from '../../../repo/offer';
3
3
  import { MongoRepository as OfferCatalogRepo } from '../../../repo/offerCatalog';
4
4
  import { MongoRepository as PlaceRepo } from '../../../repo/place';
@@ -28,5 +28,5 @@ export declare function aggregateScreeningEvent(params: {
28
28
  id: string;
29
29
  }): IAggregateScreeningEventOperation<void>;
30
30
  export declare function aggregateByEvent(params: {
31
- event: factory.event.screeningEvent.IEvent | factory.event.event.IEvent;
31
+ event: IMinimizedIndividualEvent<factory.eventType.ScreeningEvent> | IMinimizedIndividualEvent<factory.eventType.Event>;
32
32
  }): IAggregateScreeningEventOperation<void>;
@@ -80,6 +80,7 @@ function aggregateByEvent(params) {
80
80
  movieTheaterId = String((_a = params.event.offers) === null || _a === void 0 ? void 0 : _a.itemOffered.availableChannel.serviceLocation.containedInPlace.id);
81
81
  }
82
82
  const screeningRoom = yield repos.place.findScreeningRoomsByBranchCode({
83
+ project: { id: event.project.id },
83
84
  branchCode: { $eq: event.location.branchCode },
84
85
  containedInPlace: { id: { $eq: movieTheaterId } }
85
86
  });
@@ -174,7 +175,7 @@ function findOffers(params) {
174
175
  // 興行設定があれば興行のカタログを参照する(2022-08-31~)
175
176
  const eventOffers = params.event.offers;
176
177
  if (typeof ((_a = eventOffers === null || eventOffers === void 0 ? void 0 : eventOffers.itemOffered) === null || _a === void 0 ? void 0 : _a.id) === 'string') {
177
- const eventService = yield repos.product.findById({ id: eventOffers.itemOffered.id });
178
+ const eventService = yield repos.product.findById({ id: eventOffers.itemOffered.id }, ['hasOfferCatalog'], []);
178
179
  if (typeof ((_b = eventService.hasOfferCatalog) === null || _b === void 0 ? void 0 : _b.id) === 'string') {
179
180
  const findOffersByOfferCatalogIdResult = yield repos.offer.findOffersByOfferCatalogId({
180
181
  offerCatalog: { id: eventService.hasOfferCatalog.id },
@@ -208,7 +209,7 @@ function calculateOfferCount(params) {
208
209
  try {
209
210
  const eventOffers = params.event.offers;
210
211
  if (typeof ((_a = eventOffers === null || eventOffers === void 0 ? void 0 : eventOffers.itemOffered) === null || _a === void 0 ? void 0 : _a.id) === 'string') {
211
- const eventService = yield repos.product.findById({ id: eventOffers.itemOffered.id });
212
+ const eventService = yield repos.product.findById({ id: eventOffers.itemOffered.id }, ['hasOfferCatalog'], []);
212
213
  if (typeof ((_b = eventService.hasOfferCatalog) === null || _b === void 0 ? void 0 : _b.id) === 'string') {
213
214
  const catalogs = yield repos.offerCatalog.search({
214
215
  limit: 1,
@@ -100,7 +100,7 @@ function findOffers(params) {
100
100
  // 興行設定があれば興行のカタログを参照する(2022-08-31~)
101
101
  const eventOffers = params.event.offers;
102
102
  if (typeof ((_a = eventOffers === null || eventOffers === void 0 ? void 0 : eventOffers.itemOffered) === null || _a === void 0 ? void 0 : _a.id) === 'string') {
103
- const eventService = yield repos.product.findById({ id: eventOffers.itemOffered.id });
103
+ const eventService = yield repos.product.findById({ id: eventOffers.itemOffered.id }, ['hasOfferCatalog'], []);
104
104
  if (typeof ((_b = eventService.hasOfferCatalog) === null || _b === void 0 ? void 0 : _b.id) === 'string') {
105
105
  const findOffersByOfferCatalogIdResult = yield repos.offer.findOffersByOfferCatalogId({
106
106
  offerCatalog: { id: eventService.hasOfferCatalog.id },
@@ -28,7 +28,15 @@ function validateAccount(params) {
28
28
  if (typeof sellerId !== 'string') {
29
29
  throw new factory.errors.ArgumentNull('recipient.id');
30
30
  }
31
- const seller = yield repos.seller.findById({ id: sellerId }, ['paymentAccepted'], []);
31
+ const sellers = yield repos.seller.search({
32
+ limit: 1,
33
+ page: 1,
34
+ id: { $eq: sellerId }
35
+ }, ['paymentAccepted'], []);
36
+ const seller = sellers.shift();
37
+ if (seller === undefined) {
38
+ throw new factory.errors.NotFound(factory.organizationType.Corporation);
39
+ }
32
40
  const paymentAccepted = (_d = seller.paymentAccepted) === null || _d === void 0 ? void 0 : _d.some((a) => a.paymentMethodType === paymentMethodType);
33
41
  if (paymentAccepted !== true) {
34
42
  throw new factory.errors.Argument('recipient', `payment not accepted`);
@@ -210,7 +210,15 @@ function validateSeller(params) {
210
210
  if (typeof sellerId !== 'string') {
211
211
  throw new factory.errors.ArgumentNull('recipient.id');
212
212
  }
213
- const seller = yield repos.seller.findById({ id: sellerId }, ['paymentAccepted'], []);
213
+ const sellers = yield repos.seller.search({
214
+ limit: 1,
215
+ page: 1,
216
+ id: { $eq: sellerId }
217
+ }, ['paymentAccepted'], []);
218
+ const seller = sellers.shift();
219
+ if (seller === undefined) {
220
+ throw new factory.errors.NotFound(factory.organizationType.Corporation);
221
+ }
214
222
  const paymentMethodType = (_b = params.object.paymentMethod) === null || _b === void 0 ? void 0 : _b.typeOf;
215
223
  if (typeof paymentMethodType !== 'string') {
216
224
  throw new factory.errors.ArgumentNull('object.paymentMethod.typeOf');