@chevre/domain 20.2.0-alpha.9 → 20.2.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.
- package/example/src/chevre/aggregateEventReservation.ts +37 -0
- package/example/src/chevre/aggregation/aggregateSystem.ts +116 -0
- package/example/src/chevre/attendIfNotAttended.ts +22 -0
- package/example/src/chevre/createManyEventsIfNotExist.ts +209 -0
- package/example/src/chevre/findByOrderNumberAndReservationId.ts +20 -0
- package/example/src/chevre/findScreeningRoomsByBranchCode.ts +27 -0
- package/example/src/chevre/importEventsFromCOA.ts +8 -1
- package/example/src/chevre/migrateEventOffersItemOfferedAvailableChannel.ts +2 -1
- package/example/src/chevre/migrateOwnershipInfos2newUserPool.ts +1 -1
- package/example/src/chevre/migrateProjectSubscription.ts +51 -0
- package/example/src/chevre/ownershipInfosCsv2peopleJson.ts +2 -2
- package/example/src/chevre/processReserve.ts +2 -0
- package/example/src/chevre/searchEventIds.ts +24 -0
- package/example/src/chevre/searchEventTicketOffers.ts +5 -4
- package/example/src/chevre/searchEvents.ts +20 -41
- package/example/src/chevre/searchOffersByCatalog.ts +27 -0
- package/example/src/chevre/updateTransaction.ts +38 -0
- package/lib/chevre/factory/event.d.ts +2 -0
- package/lib/chevre/factory/event.js +2 -0
- package/lib/chevre/repo/action.d.ts +77 -1
- package/lib/chevre/repo/action.js +249 -6
- package/lib/chevre/repo/aggregation.d.ts +38 -0
- package/lib/chevre/repo/aggregation.js +68 -0
- package/lib/chevre/repo/assetTransaction.d.ts +32 -0
- package/lib/chevre/repo/assetTransaction.js +148 -0
- package/lib/chevre/repo/code.d.ts +13 -16
- package/lib/chevre/repo/code.js +33 -19
- package/lib/chevre/repo/creativeWork.js +13 -12
- package/lib/chevre/repo/event.d.ts +64 -17
- package/lib/chevre/repo/event.js +456 -156
- package/lib/chevre/repo/mongoose/model/aggregation.d.ts +7 -0
- package/lib/chevre/repo/mongoose/model/aggregation.js +47 -0
- package/lib/chevre/repo/mongoose/model/event.js +4 -3
- package/lib/chevre/repo/mongoose/model/offer.js +2 -1
- package/lib/chevre/repo/mongoose/model/project.js +7 -1
- package/lib/chevre/repo/mongoose/model/telemetry.js +4 -28
- package/lib/chevre/repo/offer.d.ts +10 -0
- package/lib/chevre/repo/offer.js +47 -16
- package/lib/chevre/repo/order.d.ts +6 -0
- package/lib/chevre/repo/order.js +53 -7
- package/lib/chevre/repo/place.d.ts +26 -1
- package/lib/chevre/repo/place.js +216 -12
- package/lib/chevre/repo/product.d.ts +1 -0
- package/lib/chevre/repo/product.js +5 -0
- package/lib/chevre/repo/project.d.ts +7 -1
- package/lib/chevre/repo/project.js +15 -6
- package/lib/chevre/repo/reservation.d.ts +7 -8
- package/lib/chevre/repo/reservation.js +181 -76
- package/lib/chevre/repo/task.d.ts +31 -4
- package/lib/chevre/repo/task.js +146 -33
- package/lib/chevre/repo/transaction.d.ts +57 -5
- package/lib/chevre/repo/transaction.js +228 -34
- package/lib/chevre/repo/trip.js +33 -27
- package/lib/chevre/repository.d.ts +3 -0
- package/lib/chevre/repository.js +5 -1
- package/lib/chevre/service/aggregation/event/aggregateScreeningEvent.js +72 -60
- package/lib/chevre/service/aggregation/event/aggregateUseActionsOnEvent.js +5 -8
- package/lib/chevre/service/aggregation/system.d.ts +100 -0
- package/lib/chevre/service/aggregation/system.js +409 -0
- package/lib/chevre/service/aggregation.d.ts +2 -0
- package/lib/chevre/service/aggregation.js +3 -1
- package/lib/chevre/service/assetTransaction/pay/movieTicket/validation.js +5 -1
- package/lib/chevre/service/assetTransaction/pay/potentialActions.js +0 -3
- package/lib/chevre/service/assetTransaction/pay.d.ts +19 -4
- package/lib/chevre/service/assetTransaction/pay.js +65 -32
- package/lib/chevre/service/assetTransaction/registerService.js +4 -1
- package/lib/chevre/service/assetTransaction/reserve/factory.d.ts +3 -0
- package/lib/chevre/service/assetTransaction/reserve/factory.js +33 -2
- package/lib/chevre/service/assetTransaction/reserve/validateStartRequest.d.ts +16 -0
- package/lib/chevre/service/assetTransaction/reserve/validateStartRequest.js +84 -0
- package/lib/chevre/service/assetTransaction/reserve.d.ts +38 -6
- package/lib/chevre/service/assetTransaction/reserve.js +120 -94
- package/lib/chevre/service/assetTransaction.d.ts +1 -1
- package/lib/chevre/service/code.d.ts +2 -3
- package/lib/chevre/service/delivery/factory.d.ts +1 -1
- package/lib/chevre/service/delivery/product/factory.js +9 -3
- package/lib/chevre/service/event.d.ts +2 -4
- package/lib/chevre/service/event.js +35 -14
- package/lib/chevre/service/offer/event/authorize.d.ts +4 -7
- package/lib/chevre/service/offer/event/authorize.js +33 -87
- package/lib/chevre/service/offer/event/cancel.js +0 -1
- package/lib/chevre/service/offer/event/factory.d.ts +3 -2
- package/lib/chevre/service/offer/event/searchEventTicketOffers.d.ts +14 -7
- package/lib/chevre/service/offer/event/searchEventTicketOffers.js +95 -53
- package/lib/chevre/service/offer/event/voidTransaction.js +0 -2
- package/lib/chevre/service/offer/eventServiceByCOA/factory.d.ts +2 -1
- package/lib/chevre/service/offer/eventServiceByCOA.js +10 -2
- package/lib/chevre/service/offer/factory.js +10 -3
- package/lib/chevre/service/offer/product/searchProductOffers.d.ts +1 -0
- package/lib/chevre/service/offer/product/searchProductOffers.js +1 -1
- package/lib/chevre/service/offer/product.d.ts +1 -0
- package/lib/chevre/service/offer/product.js +7 -2
- package/lib/chevre/service/offer.d.ts +13 -2
- package/lib/chevre/service/offer.js +68 -46
- package/lib/chevre/service/order/onOrderStatusChanged/factory.js +23 -26
- package/lib/chevre/service/order/returnOrder.js +6 -4
- package/lib/chevre/service/order/sendOrder.js +4 -2
- package/lib/chevre/service/payment/any.d.ts +9 -0
- package/lib/chevre/service/payment/any.js +16 -1
- package/lib/chevre/service/payment/movieTicket.d.ts +2 -2
- package/lib/chevre/service/payment/movieTicket.js +8 -2
- package/lib/chevre/service/product.js +5 -3
- package/lib/chevre/service/report/telemetry.js +1 -1
- package/lib/chevre/service/reserve/checkInReservation.js +2 -2
- package/lib/chevre/service/reserve/confirmReservation.js +7 -10
- package/lib/chevre/service/reserve/potentialActions/onReservationCanceled.js +2 -1
- package/lib/chevre/service/reserve/potentialActions/onReservationCheckedIn.js +2 -1
- package/lib/chevre/service/reserve/potentialActions/onReservationConfirmed.js +2 -1
- package/lib/chevre/service/reserve/potentialActions/onReservationUsed.js +32 -35
- package/lib/chevre/service/reserve/useReservation.d.ts +0 -3
- package/lib/chevre/service/reserve/useReservation.js +58 -33
- package/lib/chevre/service/task/confirmPayTransaction.js +20 -1
- package/lib/chevre/service/task/confirmReserveTransaction.d.ts +4 -0
- package/lib/chevre/service/task/confirmReserveTransaction.js +5 -5
- package/lib/chevre/service/task/importEventsFromCOA.js +3 -1
- package/lib/chevre/service/task/returnPayTransaction.js +10 -4
- package/lib/chevre/service/task.js +6 -9
- package/lib/chevre/service/transaction/moneyTransfer.js +9 -1
- package/lib/chevre/service/transaction/orderProgramMembership/findPaymentCardPermit.d.ts +1 -1
- package/lib/chevre/service/transaction/orderProgramMembership.js +6 -6
- package/lib/chevre/service/transaction/placeOrder.js +5 -3
- package/lib/chevre/service/transaction/placeOrderInProgress/factory.d.ts +1 -1
- package/lib/chevre/service/transaction/placeOrderInProgress/potentialActions.d.ts +0 -2
- package/lib/chevre/service/transaction/placeOrderInProgress/potentialActions.js +2 -11
- package/lib/chevre/service/transaction/placeOrderInProgress/validation/validateSeller.d.ts +1 -1
- package/lib/chevre/service/transaction/placeOrderInProgress.d.ts +3 -8
- package/lib/chevre/service/transaction/placeOrderInProgress.js +92 -107
- package/lib/chevre/service/transaction/returnOrder.js +8 -6
- package/lib/chevre/settings.d.ts +2 -0
- package/lib/chevre/settings.js +20 -12
- package/package.json +3 -3
- package/example/src/chevre/aggregateReservationOnProject.ts +0 -32
- package/example/src/chevre/migratePlaceAdditionalProperties.ts +0 -162
- package/lib/chevre/service/transaction/placeOrderInProgress/potentialActions/confirmPay.d.ts +0 -6
- package/lib/chevre/service/transaction/placeOrderInProgress/potentialActions/confirmPay.js +0 -65
|
@@ -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
|
-
|
|
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 = (
|
|
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 = (
|
|
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 = (
|
|
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 = (
|
|
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 = (
|
|
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 = (
|
|
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 = (
|
|
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 = (
|
|
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 = (
|
|
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 = (
|
|
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 = (
|
|
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 = (
|
|
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 = (
|
|
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 = (
|
|
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 = (
|
|
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 = (
|
|
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 = (
|
|
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': {
|
|
@@ -865,11 +900,25 @@ class MongoRepository {
|
|
|
865
900
|
// }
|
|
866
901
|
findById(params) {
|
|
867
902
|
return __awaiter(this, void 0, void 0, function* () {
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
903
|
+
let projection = {};
|
|
904
|
+
if (Array.isArray(params.inclusion) && params.inclusion.length > 0) {
|
|
905
|
+
params.inclusion.forEach((field) => {
|
|
906
|
+
projection[field] = 1;
|
|
907
|
+
});
|
|
908
|
+
}
|
|
909
|
+
else {
|
|
910
|
+
projection = {
|
|
911
|
+
__v: 0,
|
|
912
|
+
createdAt: 0,
|
|
913
|
+
updatedAt: 0
|
|
914
|
+
};
|
|
915
|
+
if (Array.isArray(params.exclusion) && params.exclusion.length > 0) {
|
|
916
|
+
params.exclusion.forEach((field) => {
|
|
917
|
+
projection[field] = 0;
|
|
918
|
+
});
|
|
919
|
+
}
|
|
920
|
+
}
|
|
921
|
+
const doc = yield this.reservationModel.findById(params.id, projection)
|
|
873
922
|
.exec();
|
|
874
923
|
if (doc === null) {
|
|
875
924
|
throw new factory.errors.NotFound(this.reservationModel.modelName);
|
|
@@ -880,49 +929,54 @@ class MongoRepository {
|
|
|
880
929
|
/**
|
|
881
930
|
* 予約確定
|
|
882
931
|
*/
|
|
883
|
-
confirm(params
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
}
|
|
932
|
+
// public async confirm<T extends factory.reservationType>(params: {
|
|
933
|
+
// id: string;
|
|
934
|
+
// previousReservationStatus: factory.reservationStatusType;
|
|
935
|
+
// underName?: factory.reservation.IUnderName<T>;
|
|
936
|
+
// }): Promise<factory.reservation.IReservation<T>> {
|
|
937
|
+
// const conditions = {
|
|
938
|
+
// _id: { $eq: String(params.id) },
|
|
939
|
+
// reservationStatus: { $eq: params.previousReservationStatus }
|
|
940
|
+
// };
|
|
941
|
+
// // 更新属性をwhitelist化(2022-06-13~)
|
|
942
|
+
// const update = {
|
|
943
|
+
// // previousReservationStatusを保管(2023-01-19~)
|
|
944
|
+
// previousReservationStatus: params.previousReservationStatus,
|
|
945
|
+
// reservationStatus: factory.reservationStatusType.ReservationConfirmed,
|
|
946
|
+
// modifiedTime: new Date(),
|
|
947
|
+
// ...(params.underName !== undefined) ? { underName: params.underName } : undefined
|
|
948
|
+
// };
|
|
949
|
+
// const doc = await this.reservationModel.findOneAndUpdate(
|
|
950
|
+
// conditions,
|
|
951
|
+
// update,
|
|
952
|
+
// { new: true }
|
|
953
|
+
// )
|
|
954
|
+
// .select({ __v: 0, createdAt: 0, updatedAt: 0 })
|
|
955
|
+
// .exec();
|
|
956
|
+
// // NotFoundであれば状態確認
|
|
957
|
+
// if (doc === null) {
|
|
958
|
+
// const reservation = await this.findById<T>({ id: String(params.id) });
|
|
959
|
+
// if (reservation.reservationStatus === factory.reservationStatusType.ReservationConfirmed) {
|
|
960
|
+
// // すでに確定済の場合
|
|
961
|
+
// return reservation;
|
|
962
|
+
// } else {
|
|
963
|
+
// throw new factory.errors.Argument(
|
|
964
|
+
// 'id',
|
|
965
|
+
// `Reservation ${reservation.id} already changed -> ${reservation.reservationStatus}`
|
|
966
|
+
// );
|
|
967
|
+
// }
|
|
968
|
+
// }
|
|
969
|
+
// return doc.toObject();
|
|
970
|
+
// }
|
|
917
971
|
confirmByReservationNumber(params) {
|
|
918
972
|
return __awaiter(this, void 0, void 0, function* () {
|
|
919
973
|
const conditions = {
|
|
920
974
|
reservationNumber: { $eq: String(params.reservationNumber) },
|
|
921
975
|
reservationStatus: { $eq: params.previousReservationStatus }
|
|
922
976
|
};
|
|
923
|
-
const update = Object.assign({
|
|
924
|
-
|
|
925
|
-
|
|
977
|
+
const update = Object.assign({
|
|
978
|
+
// previousReservationStatusを保管(2023-01-19~)
|
|
979
|
+
previousReservationStatus: params.previousReservationStatus, reservationStatus: factory.reservationStatusType.ReservationConfirmed, modifiedTime: new Date() }, (params.underName !== undefined) ? { underName: params.underName } : undefined);
|
|
926
980
|
yield this.reservationModel.updateMany(conditions, update)
|
|
927
981
|
.exec();
|
|
928
982
|
});
|
|
@@ -973,7 +1027,7 @@ class MongoRepository {
|
|
|
973
1027
|
/**
|
|
974
1028
|
* 発券する
|
|
975
1029
|
*/
|
|
976
|
-
|
|
1030
|
+
checkInIfNot(params) {
|
|
977
1031
|
var _a, _b;
|
|
978
1032
|
return __awaiter(this, void 0, void 0, function* () {
|
|
979
1033
|
const conditions = [];
|
|
@@ -1001,6 +1055,8 @@ class MongoRepository {
|
|
|
1001
1055
|
}
|
|
1002
1056
|
// 無条件で実行されないように
|
|
1003
1057
|
if (conditions.length > 0) {
|
|
1058
|
+
// false->trueのみ(2023-01-31~)
|
|
1059
|
+
conditions.push({ checkedIn: { $eq: false } });
|
|
1004
1060
|
yield this.reservationModel.updateMany({ $and: conditions }, {
|
|
1005
1061
|
checkedIn: true,
|
|
1006
1062
|
modifiedTime: params.now
|
|
@@ -1009,19 +1065,68 @@ class MongoRepository {
|
|
|
1009
1065
|
}
|
|
1010
1066
|
});
|
|
1011
1067
|
}
|
|
1068
|
+
/**
|
|
1069
|
+
* 発券する
|
|
1070
|
+
*/
|
|
1071
|
+
// public async checkIn(params: {
|
|
1072
|
+
// id?: string | { $in?: string[] };
|
|
1073
|
+
// reservationNumber?: string | { $in?: string[] };
|
|
1074
|
+
// /**
|
|
1075
|
+
// * modifiedTime
|
|
1076
|
+
// */
|
|
1077
|
+
// now: Date;
|
|
1078
|
+
// }): Promise<void> {
|
|
1079
|
+
// const conditions: any[] = [];
|
|
1080
|
+
// if (typeof params.id === 'string') {
|
|
1081
|
+
// if (params.id.length > 0) {
|
|
1082
|
+
// conditions.push({ _id: { $eq: params.id } });
|
|
1083
|
+
// }
|
|
1084
|
+
// } else {
|
|
1085
|
+
// const idIn = params.id?.$in;
|
|
1086
|
+
// if (Array.isArray(idIn)) {
|
|
1087
|
+
// conditions.push({ _id: { $in: idIn } });
|
|
1088
|
+
// }
|
|
1089
|
+
// }
|
|
1090
|
+
// if (typeof params.reservationNumber === 'string') {
|
|
1091
|
+
// if (params.reservationNumber.length > 0) {
|
|
1092
|
+
// conditions.push({ reservationNumber: { $eq: params.reservationNumber } });
|
|
1093
|
+
// }
|
|
1094
|
+
// } else {
|
|
1095
|
+
// const reservationNumberIn = params.reservationNumber?.$in;
|
|
1096
|
+
// if (Array.isArray(reservationNumberIn)) {
|
|
1097
|
+
// conditions.push({ reservationNumber: { $in: reservationNumberIn } });
|
|
1098
|
+
// }
|
|
1099
|
+
// }
|
|
1100
|
+
// // 無条件で実行されないように
|
|
1101
|
+
// if (conditions.length > 0) {
|
|
1102
|
+
// await this.reservationModel.updateMany(
|
|
1103
|
+
// { $and: conditions },
|
|
1104
|
+
// {
|
|
1105
|
+
// checkedIn: true,
|
|
1106
|
+
// modifiedTime: params.now
|
|
1107
|
+
// }
|
|
1108
|
+
// )
|
|
1109
|
+
// .exec();
|
|
1110
|
+
// }
|
|
1111
|
+
// }
|
|
1012
1112
|
/**
|
|
1013
1113
|
* 入場する
|
|
1014
1114
|
*/
|
|
1015
|
-
|
|
1115
|
+
attendIfNotAttended(params) {
|
|
1016
1116
|
return __awaiter(this, void 0, void 0, function* () {
|
|
1017
|
-
const doc = yield this.reservationModel.
|
|
1117
|
+
const doc = yield this.reservationModel.findOneAndUpdate({
|
|
1118
|
+
_id: { $eq: params.id },
|
|
1119
|
+
attended: { $eq: false }
|
|
1120
|
+
}, {
|
|
1018
1121
|
attended: true,
|
|
1019
|
-
modifiedTime: params.now
|
|
1122
|
+
modifiedTime: params.now,
|
|
1123
|
+
'reservedTicket.dateUsed': params.now
|
|
1020
1124
|
}, { new: true })
|
|
1021
1125
|
.select({ __v: 0, createdAt: 0, updatedAt: 0 })
|
|
1022
1126
|
.exec();
|
|
1023
1127
|
if (doc === null) {
|
|
1024
|
-
|
|
1128
|
+
return this.findById({ id: params.id });
|
|
1129
|
+
// throw new factory.errors.NotFound(this.reservationModel.modelName);
|
|
1025
1130
|
}
|
|
1026
1131
|
return doc.toObject();
|
|
1027
1132
|
});
|
|
@@ -1,13 +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
|
|
10
|
-
save(taskAttributes: factory.task.IAttributes<factory.taskName>): Promise<factory.task.ITask<factory.taskName>>;
|
|
26
|
+
static CREATE_MONGO_CONDITIONS(params: factory.task.ISearchConditions): any[];
|
|
11
27
|
saveMany(taskAttributes: factory.task.IAttributes<factory.taskName>[]): Promise<any[]>;
|
|
12
28
|
executeOneByName<T extends factory.taskName>(params: {
|
|
13
29
|
name: T;
|
|
@@ -29,14 +45,25 @@ export declare class MongoRepository {
|
|
|
29
45
|
name: T;
|
|
30
46
|
id: string;
|
|
31
47
|
}): Promise<factory.task.ITask<T>>;
|
|
32
|
-
count
|
|
48
|
+
count(params: factory.task.ISearchConditions): Promise<number>;
|
|
33
49
|
/**
|
|
34
50
|
* 検索する
|
|
35
51
|
*/
|
|
36
|
-
search
|
|
52
|
+
search(params: factory.task.ISearchConditions, projection?: any): Promise<factory.task.ITask<factory.taskName>[]>;
|
|
37
53
|
deleteByProject(params: {
|
|
38
54
|
project: {
|
|
39
55
|
id: string;
|
|
40
56
|
};
|
|
41
57
|
}): Promise<void>;
|
|
58
|
+
aggregateTask(params: {
|
|
59
|
+
project?: {
|
|
60
|
+
id?: {
|
|
61
|
+
$ne?: string;
|
|
62
|
+
};
|
|
63
|
+
};
|
|
64
|
+
runsFrom: Date;
|
|
65
|
+
runsThrough: Date;
|
|
66
|
+
}): Promise<IAggregateTask>;
|
|
67
|
+
private agggregateByStatus;
|
|
42
68
|
}
|
|
69
|
+
export {};
|