@chevre/domain 20.2.0-alpha.4 → 20.2.0-alpha.40

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 (116) hide show
  1. package/example/src/chevre/aggregateEventReservation.ts +37 -0
  2. package/example/src/chevre/aggregation/aggregateSystem.ts +112 -0
  3. package/example/src/chevre/findScreeningRoomsByBranchCode.ts +27 -0
  4. package/example/src/chevre/importEventsFromCOA.ts +8 -1
  5. package/example/src/chevre/migrateEventOffersItemOfferedAvailableChannel.ts +2 -1
  6. package/example/src/chevre/migrateProjectSubscription.ts +51 -0
  7. package/example/src/chevre/processReserve.ts +2 -0
  8. package/example/src/chevre/searchEventIds.ts +24 -0
  9. package/example/src/chevre/searchEventTicketOffers.ts +4 -4
  10. package/example/src/chevre/searchEvents.ts +20 -41
  11. package/example/src/chevre/searchOffersByCatalog.ts +27 -0
  12. package/example/src/chevre/updateTransaction.ts +38 -0
  13. package/lib/chevre/factory/event.d.ts +2 -0
  14. package/lib/chevre/factory/event.js +2 -0
  15. package/lib/chevre/repo/action.d.ts +67 -0
  16. package/lib/chevre/repo/action.js +209 -0
  17. package/lib/chevre/repo/aggregation.d.ts +37 -0
  18. package/lib/chevre/repo/aggregation.js +67 -0
  19. package/lib/chevre/repo/assetTransaction.d.ts +32 -0
  20. package/lib/chevre/repo/assetTransaction.js +148 -0
  21. package/lib/chevre/repo/event.d.ts +62 -16
  22. package/lib/chevre/repo/event.js +458 -156
  23. package/lib/chevre/repo/mongoose/model/aggregation.d.ts +7 -0
  24. package/lib/chevre/repo/mongoose/model/aggregation.js +47 -0
  25. package/lib/chevre/repo/mongoose/model/event.js +4 -3
  26. package/lib/chevre/repo/mongoose/model/offer.js +2 -1
  27. package/lib/chevre/repo/mongoose/model/project.js +7 -1
  28. package/lib/chevre/repo/mongoose/model/telemetry.js +4 -28
  29. package/lib/chevre/repo/offer.d.ts +10 -0
  30. package/lib/chevre/repo/offer.js +47 -16
  31. package/lib/chevre/repo/order.d.ts +2 -0
  32. package/lib/chevre/repo/order.js +29 -7
  33. package/lib/chevre/repo/place.d.ts +26 -1
  34. package/lib/chevre/repo/place.js +216 -12
  35. package/lib/chevre/repo/product.d.ts +1 -0
  36. package/lib/chevre/repo/product.js +5 -0
  37. package/lib/chevre/repo/project.d.ts +4 -1
  38. package/lib/chevre/repo/project.js +9 -10
  39. package/lib/chevre/repo/reservation.d.ts +0 -6
  40. package/lib/chevre/repo/reservation.js +106 -66
  41. package/lib/chevre/repo/task.d.ts +31 -3
  42. package/lib/chevre/repo/task.js +141 -27
  43. package/lib/chevre/repo/transaction.d.ts +45 -5
  44. package/lib/chevre/repo/transaction.js +187 -29
  45. package/lib/chevre/repo/trip.js +33 -27
  46. package/lib/chevre/repository.d.ts +3 -0
  47. package/lib/chevre/repository.js +5 -1
  48. package/lib/chevre/service/aggregation/event/aggregateScreeningEvent.d.ts +1 -1
  49. package/lib/chevre/service/aggregation/event/aggregateScreeningEvent.js +86 -59
  50. package/lib/chevre/service/aggregation/event/aggregateUseActionsOnEvent.js +5 -8
  51. package/lib/chevre/service/aggregation/system.d.ts +93 -0
  52. package/lib/chevre/service/aggregation/system.js +377 -0
  53. package/lib/chevre/service/aggregation.d.ts +2 -0
  54. package/lib/chevre/service/aggregation.js +3 -1
  55. package/lib/chevre/service/assetTransaction/pay/movieTicket/validation.js +5 -1
  56. package/lib/chevre/service/assetTransaction/pay/potentialActions.js +2 -4
  57. package/lib/chevre/service/assetTransaction/pay.d.ts +19 -4
  58. package/lib/chevre/service/assetTransaction/pay.js +65 -32
  59. package/lib/chevre/service/assetTransaction/registerService.js +4 -1
  60. package/lib/chevre/service/assetTransaction/reserve/factory.d.ts +3 -0
  61. package/lib/chevre/service/assetTransaction/reserve/factory.js +33 -2
  62. package/lib/chevre/service/assetTransaction/reserve/validateStartRequest.d.ts +16 -0
  63. package/lib/chevre/service/assetTransaction/reserve/validateStartRequest.js +84 -0
  64. package/lib/chevre/service/assetTransaction/reserve.d.ts +38 -6
  65. package/lib/chevre/service/assetTransaction/reserve.js +119 -94
  66. package/lib/chevre/service/delivery/factory.d.ts +1 -1
  67. package/lib/chevre/service/delivery/factory.js +1 -0
  68. package/lib/chevre/service/event.d.ts +2 -4
  69. package/lib/chevre/service/event.js +35 -14
  70. package/lib/chevre/service/offer/event/authorize.d.ts +4 -7
  71. package/lib/chevre/service/offer/event/authorize.js +26 -87
  72. package/lib/chevre/service/offer/event/cancel.js +0 -1
  73. package/lib/chevre/service/offer/event/factory.d.ts +3 -2
  74. package/lib/chevre/service/offer/event/factory.js +25 -5
  75. package/lib/chevre/service/offer/event/searchEventTicketOffers.d.ts +13 -7
  76. package/lib/chevre/service/offer/event/searchEventTicketOffers.js +81 -45
  77. package/lib/chevre/service/offer/event/voidTransaction.js +0 -2
  78. package/lib/chevre/service/offer/eventServiceByCOA/factory.d.ts +2 -1
  79. package/lib/chevre/service/offer/eventServiceByCOA.js +10 -2
  80. package/lib/chevre/service/offer/factory.js +10 -3
  81. package/lib/chevre/service/offer/product/searchProductOffers.d.ts +1 -0
  82. package/lib/chevre/service/offer/product/searchProductOffers.js +1 -1
  83. package/lib/chevre/service/offer/product.d.ts +1 -0
  84. package/lib/chevre/service/offer/product.js +6 -2
  85. package/lib/chevre/service/offer.d.ts +5 -1
  86. package/lib/chevre/service/offer.js +67 -46
  87. package/lib/chevre/service/order/onOrderStatusChanged/factory.js +2 -1
  88. package/lib/chevre/service/order/onOrderStatusChanged.js +2 -1
  89. package/lib/chevre/service/order/placeOrder.js +16 -0
  90. package/lib/chevre/service/order/returnOrder.js +1 -1
  91. package/lib/chevre/service/order/sendOrder.js +4 -2
  92. package/lib/chevre/service/payment/any.d.ts +5 -0
  93. package/lib/chevre/service/payment/any.js +1 -1
  94. package/lib/chevre/service/payment/movieTicket.d.ts +2 -2
  95. package/lib/chevre/service/payment/movieTicket.js +8 -2
  96. package/lib/chevre/service/reserve/confirmReservation.js +7 -10
  97. package/lib/chevre/service/reserve/potentialActions/onReservationCanceled.js +2 -1
  98. package/lib/chevre/service/reserve/potentialActions/onReservationCheckedIn.js +2 -1
  99. package/lib/chevre/service/reserve/potentialActions/onReservationConfirmed.js +2 -1
  100. package/lib/chevre/service/reserve/potentialActions/onReservationUsed.js +2 -1
  101. package/lib/chevre/service/reserve/useReservation.js +7 -2
  102. package/lib/chevre/service/task/confirmPayTransaction.js +20 -1
  103. package/lib/chevre/service/task/confirmReserveTransaction.d.ts +4 -0
  104. package/lib/chevre/service/task/confirmReserveTransaction.js +5 -5
  105. package/lib/chevre/service/task/importEventsFromCOA.js +3 -1
  106. package/lib/chevre/service/task/returnPayTransaction.js +5 -1
  107. package/lib/chevre/service/task.js +6 -9
  108. package/lib/chevre/service/transaction/orderProgramMembership.js +2 -1
  109. package/lib/chevre/service/transaction/placeOrderInProgress/result/acceptedOffers.js +42 -27
  110. package/lib/chevre/service/transaction/placeOrderInProgress.js +7 -7
  111. package/lib/chevre/service/transaction/returnOrder.js +3 -3
  112. package/lib/chevre/settings.d.ts +2 -0
  113. package/lib/chevre/settings.js +7 -2
  114. package/package.json +3 -3
  115. package/example/src/chevre/aggregateReservationOnProject.ts +0 -32
  116. package/example/src/chevre/migratePlaceAdditionalProperties.ts +0 -162
@@ -251,5 +251,10 @@ class MongoRepository {
251
251
  .exec();
252
252
  });
253
253
  }
254
+ getCursor(conditions, projection) {
255
+ return this.productModel.find(conditions, projection)
256
+ .sort({ productID: factory.sortType.Ascending })
257
+ .cursor();
258
+ }
254
259
  }
255
260
  exports.MongoRepository = MongoRepository;
@@ -10,7 +10,6 @@ export declare class MongoRepository {
10
10
  findById(conditions: {
11
11
  id: string;
12
12
  }, projection?: any): Promise<factory.project.IProject>;
13
- count(params: factory.project.ISearchConditions): Promise<number>;
14
13
  /**
15
14
  * プロジェクト検索
16
15
  */
@@ -24,6 +23,9 @@ export declare class MongoRepository {
24
23
  settings?: {
25
24
  sendgridApiKey?: string;
26
25
  };
26
+ subscription?: {
27
+ useEventServiceAsProduct?: boolean;
28
+ };
27
29
  }): Promise<void>;
28
30
  updateAggregateReservation(params: {
29
31
  id: string;
@@ -32,4 +34,5 @@ export declare class MongoRepository {
32
34
  deleteById(params: {
33
35
  id: string;
34
36
  }): Promise<void>;
37
+ getCursor(conditions: any, projection: any): import("mongoose").QueryCursor<any>;
35
38
  }
@@ -61,14 +61,6 @@ class MongoRepository {
61
61
  return doc.toObject();
62
62
  });
63
63
  }
64
- count(params) {
65
- return __awaiter(this, void 0, void 0, function* () {
66
- const conditions = MongoRepository.CREATE_MONGO_CONDITIONS(params);
67
- return this.projectModel.countDocuments((conditions.length > 0) ? { $and: conditions } : {})
68
- .setOptions({ maxTimeMS: 10000 })
69
- .exec();
70
- });
71
- }
72
64
  /**
73
65
  * プロジェクト検索
74
66
  */
@@ -98,12 +90,14 @@ class MongoRepository {
98
90
  });
99
91
  }
100
92
  findByIdAndIUpdate(params) {
101
- var _a;
93
+ var _a, _b;
102
94
  return __awaiter(this, void 0, void 0, function* () {
103
- yield this.projectModel.findOneAndUpdate({ _id: params.id }, Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({ updatedAt: new Date() }, (typeof params.alternateName === 'string' && params.alternateName.length > 0)
95
+ yield this.projectModel.findOneAndUpdate({ _id: params.id }, Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({ updatedAt: new Date() }, (typeof params.alternateName === 'string' && params.alternateName.length > 0)
104
96
  ? { alternateName: params.alternateName }
105
97
  : undefined), (typeof params.name === 'string' && params.name.length > 0) ? { name: params.name } : undefined), (typeof params.logo === 'string' && params.logo.length > 0) ? { logo: params.logo } : undefined), (typeof ((_a = params.settings) === null || _a === void 0 ? void 0 : _a.sendgridApiKey) === 'string')
106
98
  ? { 'settings.sendgridApiKey': params.settings.sendgridApiKey }
99
+ : undefined), (typeof ((_b = params.subscription) === null || _b === void 0 ? void 0 : _b.useEventServiceAsProduct) === 'boolean')
100
+ ? { 'subscription.useEventServiceAsProduct': params.subscription.useEventServiceAsProduct }
107
101
  : undefined), {
108
102
  // ↓customerUserPoolは廃止
109
103
  $unset: {
@@ -131,5 +125,10 @@ class MongoRepository {
131
125
  .exec();
132
126
  });
133
127
  }
128
+ getCursor(conditions, projection) {
129
+ return this.projectModel.find(conditions, projection)
130
+ .sort({ _id: factory.sortType.Ascending })
131
+ .cursor();
132
+ }
134
133
  }
135
134
  exports.MongoRepository = MongoRepository;
@@ -30,12 +30,6 @@ export declare class MongoRepository {
30
30
  /**
31
31
  * 予約確定
32
32
  */
33
- confirm<T extends factory.reservationType>(params: {
34
- id: string;
35
- previousReservationStatus: factory.reservationStatusType;
36
- underName?: factory.reservation.IUnderName<T>;
37
- reservedTicket?: factory.reservation.ITicket;
38
- }): Promise<factory.reservation.IReservation<T>>;
39
33
  confirmByReservationNumber(params: {
40
34
  reservationNumber: string;
41
35
  previousReservationStatus: factory.reservationStatusType;
@@ -21,7 +21,7 @@ class MongoRepository {
21
21
  }
22
22
  // tslint:disable-next-line:cyclomatic-complexity max-func-body-length
23
23
  static CREATE_MONGO_CONDITIONS(params) {
24
- 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;
24
+ 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
25
  // MongoDB検索条件
26
26
  const andConditions = [
27
27
  { typeOf: params.typeOf }
@@ -233,9 +233,54 @@ class MongoRepository {
233
233
  }
234
234
  switch (params.typeOf) {
235
235
  case factory.reservationType.BusReservation:
236
- // no op
236
+ const reservationForTypeOfEq = (_h = params.reservationFor) === null || _h === void 0 ? void 0 : _h.typeOf;
237
+ if (typeof reservationForTypeOfEq === 'string') {
238
+ andConditions.push({
239
+ 'reservationFor.typeOf': {
240
+ $exists: true,
241
+ $eq: reservationForTypeOfEq
242
+ }
243
+ });
244
+ }
245
+ const reservationForIdEq = (_k = (_j = params.reservationFor) === null || _j === void 0 ? void 0 : _j.id) === null || _k === void 0 ? void 0 : _k.$eq;
246
+ if (typeof reservationForIdEq === 'string') {
247
+ andConditions.push({
248
+ 'reservationFor.id': {
249
+ $exists: true,
250
+ $eq: reservationForIdEq
251
+ }
252
+ });
253
+ }
254
+ const reservationForIdIn = (_m = (_l = params.reservationFor) === null || _l === void 0 ? void 0 : _l.id) === null || _m === void 0 ? void 0 : _m.$in;
255
+ if (Array.isArray(reservationForIdIn)) {
256
+ andConditions.push({
257
+ 'reservationFor.id': {
258
+ $exists: true,
259
+ $in: reservationForIdIn
260
+ }
261
+ });
262
+ }
237
263
  break;
238
264
  case factory.reservationType.EventReservation:
265
+ if (typeof ((_o = params.reservationFor) === null || _o === void 0 ? void 0 : _o.id) === 'string') {
266
+ andConditions.push({
267
+ 'reservationFor.id': {
268
+ $exists: true,
269
+ $eq: params.reservationFor.id
270
+ }
271
+ });
272
+ }
273
+ else {
274
+ const reservationForIdEq4eventReservation = (_q = (_p = params.reservationFor) === null || _p === void 0 ? void 0 : _p.id) === null || _q === void 0 ? void 0 : _q.$eq;
275
+ if (typeof reservationForIdEq4eventReservation === 'string') {
276
+ andConditions.push({
277
+ 'reservationFor.id': {
278
+ $exists: true,
279
+ $eq: reservationForIdEq4eventReservation
280
+ }
281
+ });
282
+ }
283
+ }
239
284
  // tslint:disable-next-line:no-single-line-block-comment
240
285
  /* istanbul ignore else */
241
286
  if (params.reservationFor !== undefined) {
@@ -251,16 +296,6 @@ class MongoRepository {
251
296
  }
252
297
  // tslint:disable-next-line:no-single-line-block-comment
253
298
  /* istanbul ignore else */
254
- if (params.reservationFor.id !== undefined) {
255
- andConditions.push({
256
- 'reservationFor.id': {
257
- $exists: true,
258
- $eq: params.reservationFor.id
259
- }
260
- });
261
- }
262
- // tslint:disable-next-line:no-single-line-block-comment
263
- /* istanbul ignore else */
264
299
  if (Array.isArray(params.reservationFor.ids)) {
265
300
  andConditions.push({
266
301
  'reservationFor.id': {
@@ -490,7 +525,7 @@ class MongoRepository {
490
525
  }
491
526
  // tslint:disable-next-line:no-single-line-block-comment
492
527
  /* istanbul ignore else */
493
- const ticketedSeatSeatingTypeIn = (_j = (_h = params.reservedTicket.ticketedSeat) === null || _h === void 0 ? void 0 : _h.seatingType) === null || _j === void 0 ? void 0 : _j.$in;
528
+ const ticketedSeatSeatingTypeIn = (_s = (_r = params.reservedTicket.ticketedSeat) === null || _r === void 0 ? void 0 : _r.seatingType) === null || _s === void 0 ? void 0 : _s.$in;
494
529
  if (Array.isArray(ticketedSeatSeatingTypeIn)) {
495
530
  andConditions.push({
496
531
  'reservedTicket.ticketedSeat.seatingType': {
@@ -501,7 +536,7 @@ class MongoRepository {
501
536
  }
502
537
  }
503
538
  }
504
- const brokerIdRegex = (_k = params.broker) === null || _k === void 0 ? void 0 : _k.id;
539
+ const brokerIdRegex = (_t = params.broker) === null || _t === void 0 ? void 0 : _t.id;
505
540
  if (typeof brokerIdRegex === 'string' && brokerIdRegex.length > 0) {
506
541
  andConditions.push({
507
542
  'broker.id': {
@@ -510,7 +545,7 @@ class MongoRepository {
510
545
  }
511
546
  });
512
547
  }
513
- const brokerIdentifierAll = (_m = (_l = params.broker) === null || _l === void 0 ? void 0 : _l.identifier) === null || _m === void 0 ? void 0 : _m.$all;
548
+ const brokerIdentifierAll = (_v = (_u = params.broker) === null || _u === void 0 ? void 0 : _u.identifier) === null || _v === void 0 ? void 0 : _v.$all;
514
549
  if (Array.isArray(brokerIdentifierAll)) {
515
550
  andConditions.push({
516
551
  'broker.identifier': {
@@ -519,7 +554,7 @@ class MongoRepository {
519
554
  }
520
555
  });
521
556
  }
522
- const brokerIdentifierIn = (_p = (_o = params.broker) === null || _o === void 0 ? void 0 : _o.identifier) === null || _p === void 0 ? void 0 : _p.$in;
557
+ const brokerIdentifierIn = (_x = (_w = params.broker) === null || _w === void 0 ? void 0 : _w.identifier) === null || _x === void 0 ? void 0 : _x.$in;
523
558
  if (Array.isArray(brokerIdentifierIn)) {
524
559
  andConditions.push({
525
560
  'broker.identifier': {
@@ -528,7 +563,7 @@ class MongoRepository {
528
563
  }
529
564
  });
530
565
  }
531
- const brokerIdentifierNin = (_r = (_q = params.broker) === null || _q === void 0 ? void 0 : _q.identifier) === null || _r === void 0 ? void 0 : _r.$nin;
566
+ const brokerIdentifierNin = (_z = (_y = params.broker) === null || _y === void 0 ? void 0 : _y.identifier) === null || _z === void 0 ? void 0 : _z.$nin;
532
567
  if (Array.isArray(brokerIdentifierNin)) {
533
568
  andConditions.push({
534
569
  'broker.identifier': {
@@ -536,7 +571,7 @@ class MongoRepository {
536
571
  }
537
572
  });
538
573
  }
539
- const brokerIdentifierElemMatch = (_t = (_s = params.broker) === null || _s === void 0 ? void 0 : _s.identifier) === null || _t === void 0 ? void 0 : _t.$elemMatch;
574
+ const brokerIdentifierElemMatch = (_1 = (_0 = params.broker) === null || _0 === void 0 ? void 0 : _0.identifier) === null || _1 === void 0 ? void 0 : _1.$elemMatch;
540
575
  if (brokerIdentifierElemMatch !== undefined && brokerIdentifierElemMatch !== null) {
541
576
  andConditions.push({
542
577
  'broker.identifier': {
@@ -571,9 +606,9 @@ class MongoRepository {
571
606
  }
572
607
  }
573
608
  else {
574
- const emailRegex = (_u = params.underName.email) === null || _u === void 0 ? void 0 : _u.$regex;
609
+ const emailRegex = (_2 = params.underName.email) === null || _2 === void 0 ? void 0 : _2.$regex;
575
610
  if (typeof emailRegex === 'string' && emailRegex.length > 0) {
576
- const emailOptions = (_v = params.underName.email) === null || _v === void 0 ? void 0 : _v.$options;
611
+ const emailOptions = (_3 = params.underName.email) === null || _3 === void 0 ? void 0 : _3.$options;
577
612
  andConditions.push({
578
613
  'underName.email': Object.assign({ $exists: true, $regex: new RegExp(emailRegex) }, (typeof emailOptions === 'string') ? { $options: emailOptions } : undefined)
579
614
  });
@@ -592,9 +627,9 @@ class MongoRepository {
592
627
  }
593
628
  }
594
629
  else {
595
- const underNameNameRegex = (_w = params.underName.name) === null || _w === void 0 ? void 0 : _w.$regex;
630
+ const underNameNameRegex = (_4 = params.underName.name) === null || _4 === void 0 ? void 0 : _4.$regex;
596
631
  if (typeof underNameNameRegex === 'string' && underNameNameRegex.length > 0) {
597
- const underNameNameOptions = (_x = params.underName.name) === null || _x === void 0 ? void 0 : _x.$options;
632
+ const underNameNameOptions = (_5 = params.underName.name) === null || _5 === void 0 ? void 0 : _5.$options;
598
633
  andConditions.push({
599
634
  'underName.name': Object.assign({ $exists: true, $regex: new RegExp(underNameNameRegex) }, (typeof underNameNameOptions === 'string') ? { $options: underNameNameOptions } : undefined)
600
635
  });
@@ -623,9 +658,9 @@ class MongoRepository {
623
658
  }
624
659
  }
625
660
  else {
626
- const givenNameRegex = (_y = params.underName.givenName) === null || _y === void 0 ? void 0 : _y.$regex;
661
+ const givenNameRegex = (_6 = params.underName.givenName) === null || _6 === void 0 ? void 0 : _6.$regex;
627
662
  if (typeof givenNameRegex === 'string' && givenNameRegex.length > 0) {
628
- const givenNameOptions = (_z = params.underName.givenName) === null || _z === void 0 ? void 0 : _z.$options;
663
+ const givenNameOptions = (_7 = params.underName.givenName) === null || _7 === void 0 ? void 0 : _7.$options;
629
664
  andConditions.push({
630
665
  'underName.givenName': Object.assign({ $exists: true, $regex: new RegExp(givenNameRegex) }, (typeof givenNameOptions === 'string') ? { $options: givenNameOptions } : undefined)
631
666
  });
@@ -644,9 +679,9 @@ class MongoRepository {
644
679
  }
645
680
  }
646
681
  else {
647
- const familyNameRegex = (_0 = params.underName.familyName) === null || _0 === void 0 ? void 0 : _0.$regex;
682
+ const familyNameRegex = (_8 = params.underName.familyName) === null || _8 === void 0 ? void 0 : _8.$regex;
648
683
  if (typeof familyNameRegex === 'string' && familyNameRegex.length > 0) {
649
- const familyNameOptions = (_1 = params.underName.familyName) === null || _1 === void 0 ? void 0 : _1.$options;
684
+ const familyNameOptions = (_9 = params.underName.familyName) === null || _9 === void 0 ? void 0 : _9.$options;
650
685
  andConditions.push({
651
686
  'underName.familyName': Object.assign({ $exists: true, $regex: new RegExp(familyNameRegex) }, (typeof familyNameOptions === 'string') ? { $options: familyNameOptions } : undefined)
652
687
  });
@@ -747,7 +782,7 @@ class MongoRepository {
747
782
  });
748
783
  }
749
784
  }
750
- const programMembershipUsedIdentifierEq = (_3 = (_2 = params.programMembershipUsed) === null || _2 === void 0 ? void 0 : _2.identifier) === null || _3 === void 0 ? void 0 : _3.$eq;
785
+ const programMembershipUsedIdentifierEq = (_11 = (_10 = params.programMembershipUsed) === null || _10 === void 0 ? void 0 : _10.identifier) === null || _11 === void 0 ? void 0 : _11.$eq;
751
786
  if (typeof programMembershipUsedIdentifierEq === 'string') {
752
787
  andConditions.push({
753
788
  'programMembershipUsed.identifier': {
@@ -756,7 +791,7 @@ class MongoRepository {
756
791
  }
757
792
  });
758
793
  }
759
- const programMembershipUsedIssuedThroughServiceTypeCodeValueEq = (_7 = (_6 = (_5 = (_4 = params.programMembershipUsed) === null || _4 === void 0 ? void 0 : _4.issuedThrough) === null || _5 === void 0 ? void 0 : _5.serviceType) === null || _6 === void 0 ? void 0 : _6.codeValue) === null || _7 === void 0 ? void 0 : _7.$eq;
794
+ 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;
760
795
  if (typeof programMembershipUsedIssuedThroughServiceTypeCodeValueEq === 'string') {
761
796
  andConditions.push({
762
797
  'programMembershipUsed.issuedThrough.serviceType.codeValue': {
@@ -765,7 +800,7 @@ class MongoRepository {
765
800
  }
766
801
  });
767
802
  }
768
- const appliesToMovieTicketIdentifierEq = (_11 = (_10 = (_9 = (_8 = params.price) === null || _8 === void 0 ? void 0 : _8.priceComponent) === null || _9 === void 0 ? void 0 : _9.appliesToMovieTicket) === null || _10 === void 0 ? void 0 : _10.identifier) === null || _11 === void 0 ? void 0 : _11.$eq;
803
+ 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;
769
804
  if (typeof appliesToMovieTicketIdentifierEq === 'string') {
770
805
  andConditions.push({
771
806
  'price.priceComponent.appliesToMovieTicket.identifier': {
@@ -880,49 +915,54 @@ class MongoRepository {
880
915
  /**
881
916
  * 予約確定
882
917
  */
883
- confirm(params) {
884
- return __awaiter(this, void 0, void 0, function* () {
885
- const conditions = {
886
- _id: { $eq: String(params.id) },
887
- reservationStatus: { $eq: params.previousReservationStatus }
888
- };
889
- // 更新属性をwhitelist化(2022-06-13~)
890
- const update = Object.assign(Object.assign({
891
- // ...params,
892
- reservationStatus: factory.reservationStatusType.ReservationConfirmed, modifiedTime: new Date() }, (params.underName !== undefined) ? { underName: params.underName } : undefined), (params.reservedTicket !== undefined) ? { reservedTicket: params.reservedTicket } : undefined);
893
- // 以下値は更新しない(他処理で更新される可能性あり)
894
- // if (typeof update.checkedIn === 'boolean') {
895
- // delete update.checkedIn;
896
- // }
897
- // if (typeof update.attended === 'boolean') {
898
- // delete update.attended;
899
- // }
900
- const doc = yield this.reservationModel.findOneAndUpdate(conditions, update, { new: true })
901
- .select({ __v: 0, createdAt: 0, updatedAt: 0 })
902
- .exec();
903
- // NotFoundであれば状態確認
904
- if (doc === null) {
905
- const reservation = yield this.findById({ id: String(params.id) });
906
- if (reservation.reservationStatus === factory.reservationStatusType.ReservationConfirmed) {
907
- // すでに確定済の場合
908
- return reservation;
909
- }
910
- else {
911
- throw new factory.errors.Argument('id', `Reservation ${reservation.id} already changed -> ${reservation.reservationStatus}`);
912
- }
913
- }
914
- return doc.toObject();
915
- });
916
- }
918
+ // public async confirm<T extends factory.reservationType>(params: {
919
+ // id: string;
920
+ // previousReservationStatus: factory.reservationStatusType;
921
+ // underName?: factory.reservation.IUnderName<T>;
922
+ // }): Promise<factory.reservation.IReservation<T>> {
923
+ // const conditions = {
924
+ // _id: { $eq: String(params.id) },
925
+ // reservationStatus: { $eq: params.previousReservationStatus }
926
+ // };
927
+ // // 更新属性をwhitelist化(2022-06-13~)
928
+ // const update = {
929
+ // // previousReservationStatusを保管(2023-01-19~)
930
+ // previousReservationStatus: params.previousReservationStatus,
931
+ // reservationStatus: factory.reservationStatusType.ReservationConfirmed,
932
+ // modifiedTime: new Date(),
933
+ // ...(params.underName !== undefined) ? { underName: params.underName } : undefined
934
+ // };
935
+ // const doc = await this.reservationModel.findOneAndUpdate(
936
+ // conditions,
937
+ // update,
938
+ // { new: true }
939
+ // )
940
+ // .select({ __v: 0, createdAt: 0, updatedAt: 0 })
941
+ // .exec();
942
+ // // NotFoundであれば状態確認
943
+ // if (doc === null) {
944
+ // const reservation = await this.findById<T>({ id: String(params.id) });
945
+ // if (reservation.reservationStatus === factory.reservationStatusType.ReservationConfirmed) {
946
+ // // すでに確定済の場合
947
+ // return reservation;
948
+ // } else {
949
+ // throw new factory.errors.Argument(
950
+ // 'id',
951
+ // `Reservation ${reservation.id} already changed -> ${reservation.reservationStatus}`
952
+ // );
953
+ // }
954
+ // }
955
+ // return doc.toObject();
956
+ // }
917
957
  confirmByReservationNumber(params) {
918
958
  return __awaiter(this, void 0, void 0, function* () {
919
959
  const conditions = {
920
960
  reservationNumber: { $eq: String(params.reservationNumber) },
921
961
  reservationStatus: { $eq: params.previousReservationStatus }
922
962
  };
923
- const update = Object.assign({ reservationStatus: factory.reservationStatusType.ReservationConfirmed, modifiedTime: new Date() }, (params.underName !== undefined) ? { underName: params.underName } : undefined
924
- // ...(params.reservedTicket !== undefined) ? { reservedTicket: params.reservedTicket } : undefined
925
- );
963
+ const update = Object.assign({
964
+ // previousReservationStatusを保管(2023-01-19~)
965
+ previousReservationStatus: params.previousReservationStatus, reservationStatus: factory.reservationStatusType.ReservationConfirmed, modifiedTime: new Date() }, (params.underName !== undefined) ? { underName: params.underName } : undefined);
926
966
  yield this.reservationModel.updateMany(conditions, update)
927
967
  .exec();
928
968
  });
@@ -1,12 +1,29 @@
1
1
  import { Connection, Model } from 'mongoose';
2
2
  import * as factory from '../factory';
3
+ interface IAggregationByStatus {
4
+ taskCount: number;
5
+ avgLatency: number;
6
+ maxLatency: number;
7
+ minLatency: number;
8
+ percentilesLatency: {
9
+ name: string;
10
+ value: number;
11
+ }[];
12
+ }
13
+ interface IStatus {
14
+ status: factory.taskStatus;
15
+ aggregation: IAggregationByStatus;
16
+ }
17
+ export interface IAggregateTask {
18
+ statuses: IStatus[];
19
+ }
3
20
  /**
4
21
  * タスクリポジトリ
5
22
  */
6
23
  export declare class MongoRepository {
7
24
  readonly taskModel: typeof Model;
8
25
  constructor(connection: Connection);
9
- static CREATE_MONGO_CONDITIONS<T extends factory.taskName>(params: factory.task.ISearchConditions<T>): any[];
26
+ static CREATE_MONGO_CONDITIONS(params: factory.task.ISearchConditions): any[];
10
27
  save(taskAttributes: factory.task.IAttributes<factory.taskName>): Promise<factory.task.ITask<factory.taskName>>;
11
28
  saveMany(taskAttributes: factory.task.IAttributes<factory.taskName>[]): Promise<any[]>;
12
29
  executeOneByName<T extends factory.taskName>(params: {
@@ -29,14 +46,25 @@ export declare class MongoRepository {
29
46
  name: T;
30
47
  id: string;
31
48
  }): Promise<factory.task.ITask<T>>;
32
- count<T extends factory.taskName>(params: factory.task.ISearchConditions<T>): Promise<number>;
49
+ count(params: factory.task.ISearchConditions): Promise<number>;
33
50
  /**
34
51
  * 検索する
35
52
  */
36
- search<T extends factory.taskName>(params: factory.task.ISearchConditions<T>, projection?: any): Promise<factory.task.ITask<T>[]>;
53
+ search(params: factory.task.ISearchConditions, projection?: any): Promise<factory.task.ITask<factory.taskName>[]>;
37
54
  deleteByProject(params: {
38
55
  project: {
39
56
  id: string;
40
57
  };
41
58
  }): Promise<void>;
59
+ aggregateTask(params: {
60
+ project?: {
61
+ id?: {
62
+ $ne?: string;
63
+ };
64
+ };
65
+ runsFrom: Date;
66
+ runsThrough: Date;
67
+ }): Promise<IAggregateTask>;
68
+ private agggregateByStatus;
42
69
  }
70
+ export {};