@chevre/domain 21.2.0-alpha.1 → 21.2.0-alpha.100
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 +1 -1
- package/example/src/chevre/aggregation/aggregateSystem.ts +58 -31
- package/example/src/chevre/countDelayedTasks.ts +17 -0
- package/example/src/chevre/countDelayedTransactions.ts +60 -0
- package/example/src/chevre/countMoneyTransferTransaction.ts +36 -0
- package/example/src/chevre/createManyEventsIfNotExist.ts +4 -1
- package/example/src/chevre/deleteTasksByName.ts +10 -2
- package/example/src/chevre/importEventsFromCOA.ts +3 -4
- package/example/src/chevre/lockStockHolder.ts +48 -0
- package/example/src/chevre/migrateOrderAdditionalProperties.ts +85 -0
- package/example/src/chevre/migrateStockHolderKeys.ts +89 -0
- package/example/src/chevre/processPay.ts +5 -1
- package/example/src/chevre/processReserve.ts +6 -3
- package/example/src/chevre/saveTasks.ts +13 -10
- package/example/src/chevre/searchAbortedTasks.ts +36 -0
- package/example/src/chevre/searchActions.ts +33 -0
- package/example/src/chevre/searchEventSeats.ts +42 -0
- package/example/src/chevre/searchReservationNumbersByOrderNumbers.ts +37 -1
- package/example/src/chevre/searchSendEmailActions.ts +44 -0
- package/example/src/chevre/task/executeTasks.ts +26 -0
- package/example/src/chevre/transaction/findCreditCard.ts +1 -1
- package/example/src/chevre/transaction/orderMembershipService.ts +1 -1
- package/example/src/chevre/transaction/processReturnOrder.ts +40 -0
- package/example/src/chevre/transaction/startExportTasks.ts +20 -0
- package/example/src/chevre/updateTransaction.ts +1 -1
- package/example/src/playOnMoment.ts +24 -0
- package/lib/chevre/credentials.d.ts +1 -0
- package/lib/chevre/credentials.js +2 -1
- package/lib/chevre/eventEmitter/assetTransaction.d.ts +21 -0
- package/lib/chevre/eventEmitter/assetTransaction.js +25 -0
- package/lib/chevre/eventEmitter/task.d.ts +18 -0
- package/lib/chevre/eventEmitter/task.js +25 -0
- package/lib/chevre/eventEmitter/transaction.d.ts +21 -0
- package/lib/chevre/eventEmitter/transaction.js +25 -0
- package/lib/chevre/eventEmitter.d.ts +4 -0
- package/lib/chevre/eventEmitter.js +9 -0
- package/lib/chevre/index.d.ts +3 -2
- package/lib/chevre/index.js +5 -3
- package/lib/chevre/repo/account.js +0 -4
- package/lib/chevre/repo/accountTitle.js +0 -4
- package/lib/chevre/repo/accountTransaction.d.ts +3 -11
- package/lib/chevre/repo/accountTransaction.js +1 -58
- package/lib/chevre/repo/accountingReport.js +0 -4
- package/lib/chevre/repo/action.d.ts +29 -1
- package/lib/chevre/repo/action.js +98 -59
- package/lib/chevre/repo/additionalProperty.js +0 -4
- package/lib/chevre/repo/aggregation.js +0 -4
- package/lib/chevre/repo/assetTransaction.d.ts +25 -9
- package/lib/chevre/repo/assetTransaction.js +261 -89
- package/lib/chevre/repo/categoryCode.js +0 -4
- package/lib/chevre/repo/code.js +0 -4
- package/lib/chevre/repo/comment.d.ts +4 -1
- package/lib/chevre/repo/comment.js +20 -9
- package/lib/chevre/repo/confirmationNumber.d.ts +0 -1
- package/lib/chevre/repo/confirmationNumber.js +3 -15
- package/lib/chevre/repo/creativeWork.d.ts +1 -3
- package/lib/chevre/repo/creativeWork.js +0 -4
- package/lib/chevre/repo/customer.js +0 -4
- package/lib/chevre/repo/emailMessage.d.ts +1 -27
- package/lib/chevre/repo/emailMessage.js +0 -4
- package/lib/chevre/repo/event.d.ts +5 -1
- package/lib/chevre/repo/event.js +0 -4
- package/lib/chevre/repo/member.js +0 -4
- package/lib/chevre/repo/merchantReturnPolicy.d.ts +1 -3
- package/lib/chevre/repo/merchantReturnPolicy.js +0 -4
- package/lib/chevre/repo/mongoose/schemas/account.d.ts +5 -2
- package/lib/chevre/repo/mongoose/schemas/account.js +1 -0
- package/lib/chevre/repo/mongoose/schemas/accountTitle.d.ts +30 -3
- package/lib/chevre/repo/mongoose/schemas/accountTitle.js +1 -0
- package/lib/chevre/repo/mongoose/schemas/accountTransaction.d.ts +32 -3
- package/lib/chevre/repo/mongoose/schemas/accountTransaction.js +2 -1
- package/lib/chevre/repo/mongoose/schemas/accountingReport.d.ts +14 -3
- package/lib/chevre/repo/mongoose/schemas/accountingReport.js +1 -0
- package/lib/chevre/repo/mongoose/schemas/action.d.ts +44 -3
- package/lib/chevre/repo/mongoose/schemas/action.js +20 -1
- package/lib/chevre/repo/mongoose/schemas/additionalProperty.d.ts +18 -3
- package/lib/chevre/repo/mongoose/schemas/additionalProperty.js +1 -0
- package/lib/chevre/repo/mongoose/schemas/aggregation.d.ts +5 -2
- package/lib/chevre/repo/mongoose/schemas/aggregation.js +1 -0
- package/lib/chevre/repo/mongoose/schemas/assetTransaction.d.ts +45 -3
- package/lib/chevre/repo/mongoose/schemas/assetTransaction.js +33 -19
- package/lib/chevre/repo/mongoose/schemas/authorization.d.ts +20 -3
- package/lib/chevre/repo/mongoose/schemas/authorization.js +2 -1
- package/lib/chevre/repo/mongoose/schemas/categoryCode.d.ts +26 -3
- package/lib/chevre/repo/mongoose/schemas/categoryCode.js +1 -0
- package/lib/chevre/repo/mongoose/schemas/comments.d.ts +28 -3
- package/lib/chevre/repo/mongoose/schemas/comments.js +2 -1
- package/lib/chevre/repo/mongoose/schemas/creativeWork.d.ts +44 -3
- package/lib/chevre/repo/mongoose/schemas/creativeWork.js +1 -0
- package/lib/chevre/repo/mongoose/schemas/customer.d.ts +26 -3
- package/lib/chevre/repo/mongoose/schemas/customer.js +1 -0
- package/lib/chevre/repo/mongoose/schemas/emailMessages.d.ts +22 -3
- package/lib/chevre/repo/mongoose/schemas/emailMessages.js +1 -0
- package/lib/chevre/repo/mongoose/schemas/event.d.ts +72 -3
- package/lib/chevre/repo/mongoose/schemas/event.js +1 -0
- package/lib/chevre/repo/mongoose/schemas/member.d.ts +14 -3
- package/lib/chevre/repo/mongoose/schemas/member.js +1 -0
- package/lib/chevre/repo/mongoose/schemas/merchantReturnPolicy.d.ts +22 -3
- package/lib/chevre/repo/mongoose/schemas/merchantReturnPolicy.js +1 -0
- package/lib/chevre/repo/mongoose/schemas/offer.d.ts +66 -3
- package/lib/chevre/repo/mongoose/schemas/offer.js +1 -0
- package/lib/chevre/repo/mongoose/schemas/offerCatalog.d.ts +28 -3
- package/lib/chevre/repo/mongoose/schemas/offerCatalog.js +1 -0
- package/lib/chevre/repo/mongoose/schemas/offerItemCondition.d.ts +74 -0
- package/lib/chevre/repo/mongoose/schemas/offerItemCondition.js +45 -0
- package/lib/chevre/repo/mongoose/schemas/order.d.ts +52 -3
- package/lib/chevre/repo/mongoose/schemas/order.js +2 -1
- package/lib/chevre/repo/mongoose/schemas/ownershipInfo.d.ts +26 -3
- package/lib/chevre/repo/mongoose/schemas/ownershipInfo.js +2 -1
- package/lib/chevre/repo/mongoose/schemas/place.d.ts +50 -3
- package/lib/chevre/repo/mongoose/schemas/place.js +1 -0
- package/lib/chevre/repo/mongoose/schemas/priceSpecification.d.ts +30 -3
- package/lib/chevre/repo/mongoose/schemas/priceSpecification.js +1 -0
- package/lib/chevre/repo/mongoose/schemas/product.d.ts +32 -3
- package/lib/chevre/repo/mongoose/schemas/product.js +1 -0
- package/lib/chevre/repo/mongoose/schemas/project.d.ts +24 -3
- package/lib/chevre/repo/mongoose/schemas/project.js +1 -0
- package/lib/chevre/repo/mongoose/schemas/reservation.d.ts +64 -5
- package/lib/chevre/repo/mongoose/schemas/reservation.js +2 -1
- package/lib/chevre/repo/mongoose/schemas/role.d.ts +12 -3
- package/lib/chevre/repo/mongoose/schemas/role.js +1 -0
- package/lib/chevre/repo/mongoose/schemas/seller.d.ts +32 -3
- package/lib/chevre/repo/mongoose/schemas/seller.js +7 -0
- package/lib/chevre/repo/mongoose/schemas/serviceOutput.d.ts +12 -3
- package/lib/chevre/repo/mongoose/schemas/serviceOutput.js +2 -1
- package/lib/chevre/repo/mongoose/schemas/task.d.ts +31 -3
- package/lib/chevre/repo/mongoose/schemas/task.js +3 -1
- package/lib/chevre/repo/mongoose/schemas/telemetry.d.ts +22 -3
- package/lib/chevre/repo/mongoose/schemas/telemetry.js +1 -0
- package/lib/chevre/repo/mongoose/schemas/transaction.d.ts +41 -3
- package/lib/chevre/repo/mongoose/schemas/transaction.js +3 -1
- package/lib/chevre/repo/mongoose/schemas/trip.d.ts +12 -3
- package/lib/chevre/repo/mongoose/schemas/trip.js +1 -0
- package/lib/chevre/repo/offer.js +0 -5
- package/lib/chevre/repo/offerCatalog.js +0 -4
- package/lib/chevre/repo/offerItemCondition.d.ts +22 -0
- package/lib/chevre/repo/offerItemCondition.js +120 -0
- package/lib/chevre/repo/order.d.ts +55 -3
- package/lib/chevre/repo/order.js +56 -9
- package/lib/chevre/repo/orderNumber.d.ts +0 -1
- package/lib/chevre/repo/orderNumber.js +2 -12
- package/lib/chevre/repo/ownershipInfo.js +0 -4
- package/lib/chevre/repo/permit.js +0 -4
- package/lib/chevre/repo/place.d.ts +5 -1
- package/lib/chevre/repo/place.js +1 -10
- package/lib/chevre/repo/priceSpecification.js +0 -4
- package/lib/chevre/repo/product.js +0 -4
- package/lib/chevre/repo/project.js +0 -4
- package/lib/chevre/repo/rateLimit/offer.d.ts +3 -2
- package/lib/chevre/repo/rateLimit/offer.js +14 -14
- package/lib/chevre/repo/reservation.d.ts +12 -4
- package/lib/chevre/repo/reservation.js +16 -48
- package/lib/chevre/repo/role.js +0 -4
- package/lib/chevre/repo/seller.js +19 -23
- package/lib/chevre/repo/serviceOutput.js +0 -4
- package/lib/chevre/repo/serviceOutputIdentifier.d.ts +2 -1
- package/lib/chevre/repo/serviceOutputIdentifier.js +14 -15
- package/lib/chevre/repo/{itemAvailability/screeningEvent.d.ts → stockHolder.d.ts} +5 -8
- package/lib/chevre/repo/stockHolder.js +273 -0
- package/lib/chevre/repo/task.d.ts +45 -2
- package/lib/chevre/repo/task.js +101 -12
- package/lib/chevre/repo/telemetry.js +0 -4
- package/lib/chevre/repo/transaction.d.ts +23 -3
- package/lib/chevre/repo/transaction.js +174 -58
- package/lib/chevre/repo/transactionNumber.d.ts +2 -1
- package/lib/chevre/repo/transactionNumber.js +14 -15
- package/lib/chevre/repo/trip.js +0 -4
- package/lib/chevre/repository.d.ts +8 -7
- package/lib/chevre/repository.js +12 -11
- package/lib/chevre/service/aggregation/event/aggregateScreeningEvent.d.ts +2 -2
- package/lib/chevre/service/aggregation/event/aggregateScreeningEvent.js +4 -3
- package/lib/chevre/service/aggregation/system.d.ts +67 -22
- package/lib/chevre/service/aggregation/system.js +101 -89
- package/lib/chevre/service/assetTransaction/cancelReservation.js +1 -28
- package/lib/chevre/service/assetTransaction/moneyTransfer.js +1 -23
- package/lib/chevre/service/assetTransaction/pay/potentialActions.js +17 -1
- package/lib/chevre/service/assetTransaction/pay.d.ts +5 -1
- package/lib/chevre/service/assetTransaction/pay.js +18 -32
- package/lib/chevre/service/assetTransaction/refund.js +1 -23
- package/lib/chevre/service/assetTransaction/registerService.js +1 -25
- package/lib/chevre/service/assetTransaction/reserve/factory.d.ts +15 -5
- package/lib/chevre/service/assetTransaction/reserve/factory.js +122 -58
- package/lib/chevre/service/assetTransaction/reserve.d.ts +14 -5
- package/lib/chevre/service/assetTransaction/reserve.js +156 -74
- package/lib/chevre/service/assetTransaction.d.ts +6 -2
- package/lib/chevre/service/assetTransaction.js +9 -5
- package/lib/chevre/service/event.js +3 -1
- package/lib/chevre/service/notification/factory.js +2 -2
- package/lib/chevre/service/notification.d.ts +3 -1
- package/lib/chevre/service/notification.js +41 -7
- package/lib/chevre/service/offer/event/authorize.d.ts +5 -2
- package/lib/chevre/service/offer/event/authorize.js +8 -2
- package/lib/chevre/service/offer/event/cancel.d.ts +2 -2
- package/lib/chevre/service/offer/event/factory.d.ts +3 -0
- package/lib/chevre/service/offer/event/factory.js +16 -5
- package/lib/chevre/service/offer/event/voidTransaction.d.ts +4 -2
- package/lib/chevre/service/offer/event/voidTransaction.js +17 -1
- package/lib/chevre/service/offer.d.ts +13 -26
- package/lib/chevre/service/offer.js +22 -117
- package/lib/chevre/service/order/deleteOrder.d.ts +3 -1
- package/lib/chevre/service/order/deleteOrder.js +8 -8
- package/lib/chevre/service/order/onOrderStatusChanged/factory.d.ts +5 -2
- package/lib/chevre/service/order/onOrderStatusChanged/factory.js +41 -81
- package/lib/chevre/service/order/onOrderStatusChanged.js +1 -3
- package/lib/chevre/service/order/onOrderUpdated.d.ts +16 -0
- package/lib/chevre/service/order/onOrderUpdated.js +22 -0
- package/lib/chevre/service/order/placeOrder.d.ts +1 -0
- package/lib/chevre/service/order/placeOrder.js +41 -24
- package/lib/chevre/service/order/returnOrder.d.ts +1 -0
- package/lib/chevre/service/order/returnOrder.js +7 -12
- package/lib/chevre/service/order/sendOrder.d.ts +1 -0
- package/lib/chevre/service/order/sendOrder.js +7 -10
- package/lib/chevre/service/order.d.ts +2 -1
- package/lib/chevre/service/order.js +3 -1
- package/lib/chevre/service/payment/any/onPaid.js +1 -1
- package/lib/chevre/service/payment/any/onRefund.js +1 -1
- package/lib/chevre/service/payment/any.d.ts +9 -5
- package/lib/chevre/service/payment/any.js +80 -18
- package/lib/chevre/service/payment/creditCard.d.ts +1 -1
- package/lib/chevre/service/payment/creditCard.js +21 -15
- package/lib/chevre/service/payment/movieTicket/checkByIdentifier.d.ts +7 -6
- package/lib/chevre/service/payment/movieTicket/validation.d.ts +6 -6
- package/lib/chevre/service/payment/movieTicket/validation.js +54 -31
- package/lib/chevre/service/payment/movieTicket.d.ts +2 -2
- package/lib/chevre/service/payment/movieTicket.js +5 -4
- package/lib/chevre/service/product.js +1 -5
- package/lib/chevre/service/report/telemetry.d.ts +0 -11
- package/lib/chevre/service/report/telemetry.js +21 -24
- package/lib/chevre/service/reserve/cancelReservation.d.ts +8 -6
- package/lib/chevre/service/reserve/cancelReservation.js +153 -145
- package/lib/chevre/service/reserve/checkInReservation.d.ts +9 -4
- package/lib/chevre/service/reserve/checkInReservation.js +77 -3
- package/lib/chevre/service/reserve/confirmReservation.d.ts +7 -4
- package/lib/chevre/service/reserve/confirmReservation.js +125 -58
- package/lib/chevre/service/reserve/factory.d.ts +1 -1
- package/lib/chevre/service/reserve/potentialActions/onReservationCanceled.d.ts +17 -5
- package/lib/chevre/service/reserve/potentialActions/onReservationCanceled.js +26 -24
- package/lib/chevre/service/reserve/potentialActions/onReservationCheckedIn.js +2 -3
- package/lib/chevre/service/reserve/potentialActions/onReservationConfirmed.js +2 -31
- package/lib/chevre/service/reserve/potentialActions/onReservationUsed.js +2 -3
- package/lib/chevre/service/reserve/useReservation.d.ts +7 -3
- package/lib/chevre/service/reserve/useReservation.js +61 -71
- package/lib/chevre/service/reserve/verifyToken4reservation.d.ts +15 -0
- package/lib/chevre/service/reserve/verifyToken4reservation.js +56 -0
- package/lib/chevre/service/reserve.d.ts +3 -2
- package/lib/chevre/service/reserve.js +4 -2
- package/lib/chevre/service/task/aggregateScreeningEvent.js +2 -2
- package/lib/chevre/service/task/cancelPendingReservation.js +8 -4
- package/lib/chevre/service/task/cancelReservation.js +3 -3
- package/lib/chevre/service/task/confirmRegisterServiceTransaction.js +1 -1
- package/lib/chevre/service/task/deleteTransaction.js +10 -8
- package/lib/chevre/service/task/importOffersFromCOA.js +4 -0
- package/lib/chevre/service/task/onAuthorizationCreated.d.ts +7 -0
- package/lib/chevre/service/task/onAuthorizationCreated.js +108 -0
- package/lib/chevre/service/task/placeOrder.js +1 -1
- package/lib/chevre/service/task/reserve.js +10 -7
- package/lib/chevre/service/task/returnOrder.js +1 -1
- package/lib/chevre/service/task/returnPayTransaction.js +2 -12
- package/lib/chevre/service/task/sendOrder.js +1 -1
- package/lib/chevre/service/task/useReservation.d.ts +7 -0
- package/lib/chevre/service/task/useReservation.js +36 -0
- package/lib/chevre/service/task/voidReserveTransaction.js +6 -4
- package/lib/chevre/service/task.d.ts +9 -0
- package/lib/chevre/service/task.js +43 -4
- package/lib/chevre/service/transaction/deleteTransaction.d.ts +21 -0
- package/lib/chevre/service/transaction/deleteTransaction.js +232 -0
- package/lib/chevre/service/transaction/moneyTransfer/exportTasks/factory.js +11 -1
- package/lib/chevre/service/transaction/moneyTransfer/factory.js +3 -1
- package/lib/chevre/service/transaction/moneyTransfer/potentialActions.d.ts +1 -0
- package/lib/chevre/service/transaction/moneyTransfer/potentialActions.js +1 -1
- package/lib/chevre/service/transaction/moneyTransfer.js +9 -12
- package/lib/chevre/service/transaction/orderProgramMembership.js +6 -2
- package/lib/chevre/service/transaction/placeOrder/exportTasks/factory.js +42 -30
- package/lib/chevre/service/transaction/placeOrder.js +1 -5
- package/lib/chevre/service/transaction/placeOrderInProgress/factory.js +1 -1
- package/lib/chevre/service/transaction/placeOrderInProgress/potentialActions/moneyTransfer.d.ts +1 -0
- package/lib/chevre/service/transaction/placeOrderInProgress/potentialActions/moneyTransfer.js +1 -1
- package/lib/chevre/service/transaction/placeOrderInProgress/potentialActions/registerService.d.ts +1 -0
- package/lib/chevre/service/transaction/placeOrderInProgress/potentialActions/registerService.js +1 -1
- package/lib/chevre/service/transaction/placeOrderInProgress/potentialActions.d.ts +1 -0
- package/lib/chevre/service/transaction/placeOrderInProgress/result/acceptedOffers.d.ts +3 -0
- package/lib/chevre/service/transaction/placeOrderInProgress/result/acceptedOffers.js +7 -3
- package/lib/chevre/service/transaction/placeOrderInProgress/result.d.ts +1 -0
- package/lib/chevre/service/transaction/placeOrderInProgress/result.js +2 -2
- package/lib/chevre/service/transaction/placeOrderInProgress/validation/validateMovieTicket.d.ts +1 -1
- package/lib/chevre/service/transaction/placeOrderInProgress/validation/validateMovieTicket.js +2 -2
- package/lib/chevre/service/transaction/placeOrderInProgress/validation.d.ts +2 -1
- package/lib/chevre/service/transaction/placeOrderInProgress/validation.js +23 -17
- package/lib/chevre/service/transaction/placeOrderInProgress.d.ts +0 -3
- package/lib/chevre/service/transaction/placeOrderInProgress.js +22 -11
- package/lib/chevre/service/transaction/returnOrder/exportTasks/factory.js +10 -1
- package/lib/chevre/service/transaction/returnOrder/potentialActions/returnPaymentMethod.js +25 -17
- package/lib/chevre/service/transaction/returnOrder.d.ts +4 -0
- package/lib/chevre/service/transaction/returnOrder.js +225 -35
- package/lib/chevre/service/transaction.d.ts +8 -13
- package/lib/chevre/service/transaction.js +12 -145
- package/lib/chevre/settings.d.ts +4 -1
- package/lib/chevre/settings.js +16 -6
- package/package.json +5 -5
- package/example/src/chevre/migrateMoneyTransferPendingTransactionIdentifier.ts +0 -96
- package/example/src/chevre/migrateMovieAdditionalProperties.ts +0 -98
- package/lib/chevre/repo/itemAvailability/screeningEvent.js +0 -181
- package/lib/chevre/service/task/deleteAssetTransaction.d.ts +0 -12
- package/lib/chevre/service/task/deleteAssetTransaction.js +0 -65
- package/lib/chevre/service/task/deleteOrder.d.ts +0 -6
- package/lib/chevre/service/task/deleteOrder.js +0 -35
package/lib/chevre/repo/place.js
CHANGED
|
@@ -22,7 +22,6 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
22
22
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
23
23
|
exports.MongoRepository = void 0;
|
|
24
24
|
const mongoose_1 = require("mongoose");
|
|
25
|
-
const onIndexCreated_1 = require("./mongoose/onIndexCreated");
|
|
26
25
|
const place_1 = require("./mongoose/schemas/place");
|
|
27
26
|
const factory = require("../factory");
|
|
28
27
|
/**
|
|
@@ -31,9 +30,6 @@ const factory = require("../factory");
|
|
|
31
30
|
class MongoRepository {
|
|
32
31
|
constructor(connection) {
|
|
33
32
|
this.placeModel = connection.model(place_1.modelName, place_1.schema);
|
|
34
|
-
if (connection.get('autoIndex') === true) {
|
|
35
|
-
this.placeModel.on(onIndexCreated_1.INDEX_EVENT, onIndexCreated_1.onIndexCreated);
|
|
36
|
-
}
|
|
37
33
|
}
|
|
38
34
|
// tslint:disable-next-line:max-func-body-length
|
|
39
35
|
static CREATE_BUS_STOP_MONGO_CONDITIONS(params) {
|
|
@@ -276,12 +272,7 @@ class MongoRepository {
|
|
|
276
272
|
return __awaiter(this, void 0, void 0, function* () {
|
|
277
273
|
const conditions = MongoRepository.CREATE_MOVIE_THEATER_MONGO_CONDITIONS(params);
|
|
278
274
|
// containsPlaceを含めるとデータサイズが大きくなるので、検索結果には含めない
|
|
279
|
-
const query = this.placeModel.find((conditions.length > 0) ? { $and: conditions } : {}, {
|
|
280
|
-
__v: 0,
|
|
281
|
-
createdAt: 0,
|
|
282
|
-
updatedAt: 0,
|
|
283
|
-
containsPlace: 0
|
|
284
|
-
});
|
|
275
|
+
const query = this.placeModel.find((conditions.length > 0) ? { $and: conditions } : {}, Object.assign({ __v: 0, createdAt: 0, updatedAt: 0, containsPlace: 0 }, params.$projection));
|
|
285
276
|
if (typeof params.limit === 'number' && params.limit > 0) {
|
|
286
277
|
const page = (typeof params.page === 'number' && params.page > 0) ? params.page : 1;
|
|
287
278
|
query.limit(params.limit)
|
|
@@ -22,7 +22,6 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
22
22
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
23
23
|
exports.MongoRepository = void 0;
|
|
24
24
|
const factory = require("../factory");
|
|
25
|
-
const onIndexCreated_1 = require("./mongoose/onIndexCreated");
|
|
26
25
|
const priceSpecification_1 = require("./mongoose/schemas/priceSpecification");
|
|
27
26
|
/**
|
|
28
27
|
* 価格仕様リポジトリ
|
|
@@ -30,9 +29,6 @@ const priceSpecification_1 = require("./mongoose/schemas/priceSpecification");
|
|
|
30
29
|
class MongoRepository {
|
|
31
30
|
constructor(connection) {
|
|
32
31
|
this.priceSpecificationModel = connection.model(priceSpecification_1.modelName, priceSpecification_1.schema);
|
|
33
|
-
if (connection.get('autoIndex') === true) {
|
|
34
|
-
this.priceSpecificationModel.on(onIndexCreated_1.INDEX_EVENT, onIndexCreated_1.onIndexCreated);
|
|
35
|
-
}
|
|
36
32
|
}
|
|
37
33
|
// tslint:disable-next-line:cyclomatic-complexity max-func-body-length
|
|
38
34
|
static CREATE_MONGO_CONDITIONS(params) {
|
|
@@ -21,7 +21,6 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
21
21
|
};
|
|
22
22
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
23
23
|
exports.MongoRepository = void 0;
|
|
24
|
-
const onIndexCreated_1 = require("./mongoose/onIndexCreated");
|
|
25
24
|
const product_1 = require("./mongoose/schemas/product");
|
|
26
25
|
const factory = require("../factory");
|
|
27
26
|
/**
|
|
@@ -30,9 +29,6 @@ const factory = require("../factory");
|
|
|
30
29
|
class MongoRepository {
|
|
31
30
|
constructor(connection) {
|
|
32
31
|
this.productModel = connection.model(product_1.modelName, product_1.schema);
|
|
33
|
-
if (connection.get('autoIndex') === true) {
|
|
34
|
-
this.productModel.on(onIndexCreated_1.INDEX_EVENT, onIndexCreated_1.onIndexCreated);
|
|
35
|
-
}
|
|
36
32
|
}
|
|
37
33
|
// tslint:disable-next-line:max-func-body-length
|
|
38
34
|
static CREATE_MONGO_CONDITIONS(params) {
|
|
@@ -10,7 +10,6 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
exports.MongoRepository = void 0;
|
|
13
|
-
const onIndexCreated_1 = require("./mongoose/onIndexCreated");
|
|
14
13
|
const project_1 = require("./mongoose/schemas/project");
|
|
15
14
|
const factory = require("../factory");
|
|
16
15
|
/**
|
|
@@ -19,9 +18,6 @@ const factory = require("../factory");
|
|
|
19
18
|
class MongoRepository {
|
|
20
19
|
constructor(connection) {
|
|
21
20
|
this.projectModel = connection.model(project_1.modelName, project_1.schema);
|
|
22
|
-
if (connection.get('autoIndex') === true) {
|
|
23
|
-
this.projectModel.on(onIndexCreated_1.INDEX_EVENT, onIndexCreated_1.onIndexCreated);
|
|
24
|
-
}
|
|
25
21
|
}
|
|
26
22
|
static CREATE_MONGO_CONDITIONS(params) {
|
|
27
23
|
// MongoDB検索条件
|
|
@@ -18,10 +18,11 @@ export interface IRateLimitKey {
|
|
|
18
18
|
* オファーレート制限リポジトリ
|
|
19
19
|
*/
|
|
20
20
|
export declare class RedisRepository {
|
|
21
|
-
static
|
|
21
|
+
private static readonly KEY_PREFIX_NEW;
|
|
22
|
+
private static readonly KEY_PREFIX;
|
|
22
23
|
private readonly redisClient;
|
|
23
24
|
constructor(redisClient: RedisClientType);
|
|
24
|
-
static
|
|
25
|
+
private static createKey;
|
|
25
26
|
/**
|
|
26
27
|
* ロックする
|
|
27
28
|
*/
|
|
@@ -10,10 +10,9 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
exports.RedisRepository = void 0;
|
|
13
|
-
const createDebug = require("debug");
|
|
14
13
|
const moment = require("moment");
|
|
15
14
|
const factory = require("../../factory");
|
|
16
|
-
const
|
|
15
|
+
const settings_1 = require("../../settings");
|
|
17
16
|
/**
|
|
18
17
|
* オファーレート制限リポジトリ
|
|
19
18
|
*/
|
|
@@ -21,11 +20,17 @@ class RedisRepository {
|
|
|
21
20
|
constructor(redisClient) {
|
|
22
21
|
this.redisClient = redisClient;
|
|
23
22
|
}
|
|
24
|
-
static
|
|
23
|
+
static createKey(ratelimitKey) {
|
|
25
24
|
const dateNow = moment(ratelimitKey.reservationFor.startDate);
|
|
26
25
|
const unitInSeconds = Number(ratelimitKey.reservedTicket.ticketType.validRateLimit.unitInSeconds.toString());
|
|
27
|
-
const validFrom = dateNow.unix() - dateNow.unix() % unitInSeconds;
|
|
28
|
-
|
|
26
|
+
const validFrom = dateNow.unix() - (dateNow.unix() % unitInSeconds);
|
|
27
|
+
const useNewKey = dateNow.isSameOrAfter(settings_1.USE_NEW_EVENT_AVAILABILITY_KEY_FROM);
|
|
28
|
+
if (useNewKey) {
|
|
29
|
+
return `${RedisRepository.KEY_PREFIX_NEW}:${ratelimitKey.reservedTicket.ticketType.validRateLimit.scope}:${validFrom.toString()}`;
|
|
30
|
+
}
|
|
31
|
+
else {
|
|
32
|
+
return `${RedisRepository.KEY_PREFIX}:${ratelimitKey.reservedTicket.ticketType.validRateLimit.scope}:${validFrom.toString()}`;
|
|
33
|
+
}
|
|
29
34
|
}
|
|
30
35
|
/**
|
|
31
36
|
* ロックする
|
|
@@ -34,7 +39,7 @@ class RedisRepository {
|
|
|
34
39
|
return __awaiter(this, void 0, void 0, function* () {
|
|
35
40
|
const datasets = ratelimitKeys.map((ratelimitKey) => {
|
|
36
41
|
return {
|
|
37
|
-
key: RedisRepository.
|
|
42
|
+
key: RedisRepository.createKey(ratelimitKey),
|
|
38
43
|
value: ratelimitKey.reservationNumber,
|
|
39
44
|
ttl: moment(ratelimitKey.reservationFor.startDate)
|
|
40
45
|
.add(ratelimitKey.reservedTicket.ticketType.validRateLimit.unitInSeconds, 'seconds')
|
|
@@ -43,29 +48,24 @@ class RedisRepository {
|
|
|
43
48
|
});
|
|
44
49
|
let multi = this.redisClient.multi();
|
|
45
50
|
datasets.forEach((dataset) => {
|
|
46
|
-
debug('setting if not exist...', dataset.key);
|
|
47
51
|
multi.setNX(dataset.key, dataset.value)
|
|
48
52
|
.expire(dataset.key, dataset.ttl);
|
|
49
53
|
});
|
|
50
54
|
const results = yield multi.exec();
|
|
51
55
|
const lockedFields = [];
|
|
52
56
|
results.forEach((r, index) => {
|
|
53
|
-
debug('r, index:', r, index);
|
|
54
57
|
// tslint:disable-next-line:no-magic-numbers
|
|
55
58
|
if (index % 2 === 0 && (r === 1 || r === true)) {
|
|
56
59
|
// tslint:disable-next-line:no-magic-numbers
|
|
57
60
|
lockedFields.push(datasets[index / 2].key);
|
|
58
61
|
}
|
|
59
62
|
});
|
|
60
|
-
debug('locked fields:', lockedFields);
|
|
61
63
|
const lockedAll = lockedFields.length === ratelimitKeys.length;
|
|
62
|
-
debug('lockedAll?', lockedAll);
|
|
63
64
|
if (!lockedAll) {
|
|
64
65
|
if (lockedFields.length > 0) {
|
|
65
66
|
// 全てロックできなければロックできたものは解除
|
|
66
67
|
multi = this.redisClient.multi();
|
|
67
68
|
lockedFields.forEach((key) => {
|
|
68
|
-
debug('deleting...', key);
|
|
69
69
|
multi.del(key);
|
|
70
70
|
});
|
|
71
71
|
yield multi.exec();
|
|
@@ -78,8 +78,7 @@ class RedisRepository {
|
|
|
78
78
|
return __awaiter(this, void 0, void 0, function* () {
|
|
79
79
|
const multi = this.redisClient.multi();
|
|
80
80
|
ratelimitKeys.forEach((ratelimitKey) => {
|
|
81
|
-
const key = RedisRepository.
|
|
82
|
-
debug('deleting...', key);
|
|
81
|
+
const key = RedisRepository.createKey(ratelimitKey);
|
|
83
82
|
multi.del(key);
|
|
84
83
|
});
|
|
85
84
|
yield multi.exec();
|
|
@@ -87,10 +86,11 @@ class RedisRepository {
|
|
|
87
86
|
}
|
|
88
87
|
getHolder(ratelimitKey) {
|
|
89
88
|
return __awaiter(this, void 0, void 0, function* () {
|
|
90
|
-
const key = RedisRepository.
|
|
89
|
+
const key = RedisRepository.createKey(ratelimitKey);
|
|
91
90
|
return this.redisClient.get(key);
|
|
92
91
|
});
|
|
93
92
|
}
|
|
94
93
|
}
|
|
94
|
+
RedisRepository.KEY_PREFIX_NEW = 'rateLimit:offer';
|
|
95
95
|
RedisRepository.KEY_PREFIX = 'chevre:rateLimit:offer';
|
|
96
96
|
exports.RedisRepository = RedisRepository;
|
|
@@ -23,19 +23,27 @@ export declare class MongoRepository {
|
|
|
23
23
|
/**
|
|
24
24
|
* 予約検索
|
|
25
25
|
*/
|
|
26
|
-
search<T extends factory.reservationType>(params: factory.reservation.ISearchConditions<T>, projection?:
|
|
26
|
+
search<T extends factory.reservationType>(params: factory.reservation.ISearchConditions<T>, projection?: {
|
|
27
|
+
[key: string]: 0 | 1;
|
|
28
|
+
}): Promise<factory.reservation.IReservation<factory.reservationType.EventReservation>[]>;
|
|
27
29
|
findById<T extends factory.reservationType>(params: {
|
|
28
30
|
id: string;
|
|
29
31
|
inclusion?: string[];
|
|
30
32
|
exclusion?: string[];
|
|
31
33
|
}): Promise<factory.reservation.IReservation<T>>;
|
|
32
|
-
/**
|
|
33
|
-
* 予約確定
|
|
34
|
-
*/
|
|
35
34
|
confirmByReservationNumber(params: {
|
|
36
35
|
reservationNumber: string;
|
|
37
36
|
previousReservationStatus: factory.reservationStatusType;
|
|
38
37
|
underName?: factory.reservation.IUnderName<factory.reservationType.EventReservation>;
|
|
38
|
+
broker?: factory.reservation.IBroker<factory.reservationType>;
|
|
39
|
+
issuedThrough?: factory.assetTransaction.reserve.IIssuedThrough;
|
|
40
|
+
}): Promise<void>;
|
|
41
|
+
confirmByIdIfNotExist(params: {
|
|
42
|
+
reservation: factory.assetTransaction.reserve.IObjectSubReservation;
|
|
43
|
+
reservationFor: factory.assetTransaction.reserve.IReservationFor;
|
|
44
|
+
underName?: factory.reservation.IUnderName<factory.reservationType.EventReservation>;
|
|
45
|
+
broker?: factory.reservation.IBroker<factory.reservationType>;
|
|
46
|
+
issuedThrough?: factory.assetTransaction.reserve.IIssuedThrough;
|
|
39
47
|
}): Promise<void>;
|
|
40
48
|
/**
|
|
41
49
|
* 予約取消
|
|
@@ -10,18 +10,16 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
exports.MongoRepository = void 0;
|
|
13
|
-
const
|
|
13
|
+
const createDebug = require("debug");
|
|
14
14
|
const reservation_1 = require("./mongoose/schemas/reservation");
|
|
15
15
|
const factory = require("../factory");
|
|
16
|
+
const debug = createDebug('chevre-domain:repo');
|
|
16
17
|
/**
|
|
17
18
|
* 予約リポジトリ
|
|
18
19
|
*/
|
|
19
20
|
class MongoRepository {
|
|
20
21
|
constructor(connection) {
|
|
21
22
|
this.reservationModel = connection.model(reservation_1.modelName, reservation_1.schema);
|
|
22
|
-
if (connection.get('autoIndex') === true) {
|
|
23
|
-
this.reservationModel.on(onIndexCreated_1.INDEX_EVENT, onIndexCreated_1.onIndexCreated);
|
|
24
|
-
}
|
|
25
23
|
}
|
|
26
24
|
// tslint:disable-next-line:cyclomatic-complexity max-func-body-length
|
|
27
25
|
static CREATE_MONGO_CONDITIONS(params) {
|
|
@@ -914,61 +912,31 @@ class MongoRepository {
|
|
|
914
912
|
return doc.toObject();
|
|
915
913
|
});
|
|
916
914
|
}
|
|
917
|
-
/**
|
|
918
|
-
* 予約確定
|
|
919
|
-
*/
|
|
920
|
-
// public async confirm<T extends factory.reservationType>(params: {
|
|
921
|
-
// id: string;
|
|
922
|
-
// previousReservationStatus: factory.reservationStatusType;
|
|
923
|
-
// underName?: factory.reservation.IUnderName<T>;
|
|
924
|
-
// }): Promise<factory.reservation.IReservation<T>> {
|
|
925
|
-
// const conditions = {
|
|
926
|
-
// _id: { $eq: String(params.id) },
|
|
927
|
-
// reservationStatus: { $eq: params.previousReservationStatus }
|
|
928
|
-
// };
|
|
929
|
-
// // 更新属性をwhitelist化(2022-06-13~)
|
|
930
|
-
// const update = {
|
|
931
|
-
// // previousReservationStatusを保管(2023-01-19~)
|
|
932
|
-
// previousReservationStatus: params.previousReservationStatus,
|
|
933
|
-
// reservationStatus: factory.reservationStatusType.ReservationConfirmed,
|
|
934
|
-
// modifiedTime: new Date(),
|
|
935
|
-
// ...(params.underName !== undefined) ? { underName: params.underName } : undefined
|
|
936
|
-
// };
|
|
937
|
-
// const doc = await this.reservationModel.findOneAndUpdate(
|
|
938
|
-
// conditions,
|
|
939
|
-
// update,
|
|
940
|
-
// { new: true }
|
|
941
|
-
// )
|
|
942
|
-
// .select({ __v: 0, createdAt: 0, updatedAt: 0 })
|
|
943
|
-
// .exec();
|
|
944
|
-
// // NotFoundであれば状態確認
|
|
945
|
-
// if (doc === null) {
|
|
946
|
-
// const reservation = await this.findById<T>({ id: String(params.id) });
|
|
947
|
-
// if (reservation.reservationStatus === factory.reservationStatusType.ReservationConfirmed) {
|
|
948
|
-
// // すでに確定済の場合
|
|
949
|
-
// return reservation;
|
|
950
|
-
// } else {
|
|
951
|
-
// throw new factory.errors.Argument(
|
|
952
|
-
// 'id',
|
|
953
|
-
// `Reservation ${reservation.id} already changed -> ${reservation.reservationStatus}`
|
|
954
|
-
// );
|
|
955
|
-
// }
|
|
956
|
-
// }
|
|
957
|
-
// return doc.toObject();
|
|
958
|
-
// }
|
|
959
915
|
confirmByReservationNumber(params) {
|
|
916
|
+
var _a, _b;
|
|
960
917
|
return __awaiter(this, void 0, void 0, function* () {
|
|
961
918
|
const conditions = {
|
|
962
919
|
reservationNumber: { $eq: String(params.reservationNumber) },
|
|
963
920
|
reservationStatus: { $eq: params.previousReservationStatus }
|
|
964
921
|
};
|
|
965
|
-
const update = Object.assign({
|
|
922
|
+
const update = Object.assign(Object.assign(Object.assign({
|
|
966
923
|
// previousReservationStatusを保管(2023-01-19~)
|
|
967
|
-
previousReservationStatus: params.previousReservationStatus, reservationStatus: factory.reservationStatusType.ReservationConfirmed, modifiedTime: new Date() }, (params.underName !== undefined) ? { underName: params.underName } : undefined);
|
|
924
|
+
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);
|
|
968
925
|
yield this.reservationModel.updateMany(conditions, update)
|
|
969
926
|
.exec();
|
|
970
927
|
});
|
|
971
928
|
}
|
|
929
|
+
confirmByIdIfNotExist(params) {
|
|
930
|
+
var _a, _b;
|
|
931
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
932
|
+
const confirmedReservation = yield this.reservationModel.findOneAndUpdate({ _id: { $eq: params.reservation.id } }, {
|
|
933
|
+
$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)
|
|
934
|
+
}, { upsert: true, new: true })
|
|
935
|
+
.select({ _id: 1 })
|
|
936
|
+
.exec();
|
|
937
|
+
debug('confirmByIdIfNotExist processed.confirmedReservation:', confirmedReservation);
|
|
938
|
+
});
|
|
939
|
+
}
|
|
972
940
|
/**
|
|
973
941
|
* 予約取消
|
|
974
942
|
*/
|
package/lib/chevre/repo/role.js
CHANGED
|
@@ -11,7 +11,6 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
exports.MongoRepository = exports.RoleType = void 0;
|
|
13
13
|
const factory = require("../factory");
|
|
14
|
-
const onIndexCreated_1 = require("./mongoose/onIndexCreated");
|
|
15
14
|
const role_1 = require("./mongoose/schemas/role");
|
|
16
15
|
var RoleType;
|
|
17
16
|
(function (RoleType) {
|
|
@@ -23,9 +22,6 @@ var RoleType;
|
|
|
23
22
|
class MongoRepository {
|
|
24
23
|
constructor(connection) {
|
|
25
24
|
this.roleModel = connection.model(role_1.modelName, role_1.schema);
|
|
26
|
-
if (connection.get('autoIndex') === true) {
|
|
27
|
-
this.roleModel.on(onIndexCreated_1.INDEX_EVENT, onIndexCreated_1.onIndexCreated);
|
|
28
|
-
}
|
|
29
25
|
}
|
|
30
26
|
static CREATE_MONGO_CONDITIONS(params) {
|
|
31
27
|
var _a, _b, _c;
|
|
@@ -21,7 +21,6 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
21
21
|
};
|
|
22
22
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
23
23
|
exports.MongoRepository = void 0;
|
|
24
|
-
const onIndexCreated_1 = require("./mongoose/onIndexCreated");
|
|
25
24
|
const seller_1 = require("./mongoose/schemas/seller");
|
|
26
25
|
const factory = require("../factory");
|
|
27
26
|
/**
|
|
@@ -30,27 +29,15 @@ const factory = require("../factory");
|
|
|
30
29
|
class MongoRepository {
|
|
31
30
|
constructor(connection) {
|
|
32
31
|
this.organizationModel = connection.model(seller_1.modelName, seller_1.schema);
|
|
33
|
-
if (connection.get('autoIndex') === true) {
|
|
34
|
-
this.organizationModel.on(onIndexCreated_1.INDEX_EVENT, onIndexCreated_1.onIndexCreated);
|
|
35
|
-
}
|
|
36
32
|
}
|
|
37
33
|
// tslint:disable-next-line:max-func-body-length
|
|
38
34
|
static CREATE_MONGO_CONDITIONS(params) {
|
|
39
|
-
var _a, _b, _c, _d, _e, _f;
|
|
35
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
|
|
40
36
|
// MongoDB検索条件
|
|
41
37
|
const andConditions = [];
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
if (params.project.id !== undefined && params.project.id !== null) {
|
|
46
|
-
if (typeof params.project.id.$eq === 'string') {
|
|
47
|
-
andConditions.push({
|
|
48
|
-
'project.id': {
|
|
49
|
-
$eq: params.project.id.$eq
|
|
50
|
-
}
|
|
51
|
-
});
|
|
52
|
-
}
|
|
53
|
-
}
|
|
38
|
+
const projectIdEq = (_b = (_a = params.project) === null || _a === void 0 ? void 0 : _a.id) === null || _b === void 0 ? void 0 : _b.$eq;
|
|
39
|
+
if (typeof projectIdEq === 'string') {
|
|
40
|
+
andConditions.push({ 'project.id': { $eq: projectIdEq } });
|
|
54
41
|
}
|
|
55
42
|
const nameRegex = params.name;
|
|
56
43
|
if (typeof nameRegex === 'string' && nameRegex.length > 0) {
|
|
@@ -71,7 +58,7 @@ class MongoRepository {
|
|
|
71
58
|
]
|
|
72
59
|
});
|
|
73
60
|
}
|
|
74
|
-
const branchCodeEq = (
|
|
61
|
+
const branchCodeEq = (_c = params.branchCode) === null || _c === void 0 ? void 0 : _c.$eq;
|
|
75
62
|
if (typeof branchCodeEq === 'string') {
|
|
76
63
|
andConditions.push({
|
|
77
64
|
branchCode: {
|
|
@@ -79,7 +66,7 @@ class MongoRepository {
|
|
|
79
66
|
}
|
|
80
67
|
});
|
|
81
68
|
}
|
|
82
|
-
const branchCodeRegex = (
|
|
69
|
+
const branchCodeRegex = (_d = params.branchCode) === null || _d === void 0 ? void 0 : _d.$regex;
|
|
83
70
|
if (typeof branchCodeRegex === 'string' && branchCodeRegex.length > 0) {
|
|
84
71
|
andConditions.push({
|
|
85
72
|
branchCode: {
|
|
@@ -87,7 +74,7 @@ class MongoRepository {
|
|
|
87
74
|
}
|
|
88
75
|
});
|
|
89
76
|
}
|
|
90
|
-
const additionalPropertyAll = (
|
|
77
|
+
const additionalPropertyAll = (_e = params.additionalProperty) === null || _e === void 0 ? void 0 : _e.$all;
|
|
91
78
|
if (Array.isArray(additionalPropertyAll)) {
|
|
92
79
|
andConditions.push({
|
|
93
80
|
additionalProperty: {
|
|
@@ -96,7 +83,7 @@ class MongoRepository {
|
|
|
96
83
|
}
|
|
97
84
|
});
|
|
98
85
|
}
|
|
99
|
-
const additionalPropertyIn = (
|
|
86
|
+
const additionalPropertyIn = (_f = params.additionalProperty) === null || _f === void 0 ? void 0 : _f.$in;
|
|
100
87
|
if (Array.isArray(additionalPropertyIn)) {
|
|
101
88
|
andConditions.push({
|
|
102
89
|
additionalProperty: {
|
|
@@ -105,7 +92,7 @@ class MongoRepository {
|
|
|
105
92
|
}
|
|
106
93
|
});
|
|
107
94
|
}
|
|
108
|
-
const additionalPropertyNin = (
|
|
95
|
+
const additionalPropertyNin = (_g = params.additionalProperty) === null || _g === void 0 ? void 0 : _g.$nin;
|
|
109
96
|
if (Array.isArray(additionalPropertyNin)) {
|
|
110
97
|
andConditions.push({
|
|
111
98
|
additionalProperty: {
|
|
@@ -113,7 +100,7 @@ class MongoRepository {
|
|
|
113
100
|
}
|
|
114
101
|
});
|
|
115
102
|
}
|
|
116
|
-
const additionalPropertyElemMatch = (
|
|
103
|
+
const additionalPropertyElemMatch = (_h = params.additionalProperty) === null || _h === void 0 ? void 0 : _h.$elemMatch;
|
|
117
104
|
if (additionalPropertyElemMatch !== undefined && additionalPropertyElemMatch !== null) {
|
|
118
105
|
andConditions.push({
|
|
119
106
|
additionalProperty: {
|
|
@@ -122,6 +109,15 @@ class MongoRepository {
|
|
|
122
109
|
}
|
|
123
110
|
});
|
|
124
111
|
}
|
|
112
|
+
const hasMerchantReturnPolicyItemConditionIdEq = (_l = (_k = (_j = params.hasMerchantReturnPolicy) === null || _j === void 0 ? void 0 : _j.itemCondition) === null || _k === void 0 ? void 0 : _k.id) === null || _l === void 0 ? void 0 : _l.$eq;
|
|
113
|
+
if (typeof hasMerchantReturnPolicyItemConditionIdEq === 'string') {
|
|
114
|
+
andConditions.push({
|
|
115
|
+
'hasMerchantReturnPolicy.itemCondition.id': {
|
|
116
|
+
$exists: true,
|
|
117
|
+
$eq: hasMerchantReturnPolicyItemConditionIdEq
|
|
118
|
+
}
|
|
119
|
+
});
|
|
120
|
+
}
|
|
125
121
|
return andConditions;
|
|
126
122
|
}
|
|
127
123
|
/**
|
|
@@ -10,7 +10,6 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
exports.MongoRepository = void 0;
|
|
13
|
-
const onIndexCreated_1 = require("./mongoose/onIndexCreated");
|
|
14
13
|
const serviceOutput_1 = require("./mongoose/schemas/serviceOutput");
|
|
15
14
|
const factory = require("../factory");
|
|
16
15
|
/**
|
|
@@ -19,9 +18,6 @@ const factory = require("../factory");
|
|
|
19
18
|
class MongoRepository {
|
|
20
19
|
constructor(connection) {
|
|
21
20
|
this.serviceOutputModel = connection.model(serviceOutput_1.modelName, serviceOutput_1.schema);
|
|
22
|
-
if (connection.get('autoIndex') === true) {
|
|
23
|
-
this.serviceOutputModel.on(onIndexCreated_1.INDEX_EVENT, onIndexCreated_1.onIndexCreated);
|
|
24
|
-
}
|
|
25
21
|
}
|
|
26
22
|
// tslint:disable-next-line:max-func-body-length
|
|
27
23
|
static CREATE_MONGO_CONDITIONS(params) {
|
|
@@ -3,9 +3,10 @@ import { RedisClientType } from 'redis';
|
|
|
3
3
|
* サービスアウトプット識別子リポジトリ
|
|
4
4
|
*/
|
|
5
5
|
export declare class RedisRepository {
|
|
6
|
-
static REDIS_KEY_PREFIX
|
|
6
|
+
private static readonly REDIS_KEY_PREFIX;
|
|
7
7
|
private readonly redisClient;
|
|
8
8
|
constructor(redisClient: RedisClientType);
|
|
9
|
+
private static createKey;
|
|
9
10
|
/**
|
|
10
11
|
* タイムスタンプから発行する
|
|
11
12
|
*/
|
|
@@ -23,6 +23,9 @@ class RedisRepository {
|
|
|
23
23
|
constructor(redisClient) {
|
|
24
24
|
this.redisClient = redisClient;
|
|
25
25
|
}
|
|
26
|
+
static createKey(params) {
|
|
27
|
+
return util.format('%s:%s', RedisRepository.REDIS_KEY_PREFIX, params.timestamp);
|
|
28
|
+
}
|
|
26
29
|
/**
|
|
27
30
|
* タイムスタンプから発行する
|
|
28
31
|
*/
|
|
@@ -35,30 +38,26 @@ class RedisRepository {
|
|
|
35
38
|
const TTL = moment(params.startDate)
|
|
36
39
|
.add(1, 'minute') // ミリ秒でカウントしていくので、予約日時後1分で十分
|
|
37
40
|
.diff(now, 'seconds');
|
|
38
|
-
const key =
|
|
41
|
+
const key = RedisRepository.createKey({ startDate: params.startDate, timestamp });
|
|
39
42
|
const [incrReply] = yield this.redisClient.multi()
|
|
40
43
|
.incr(key)
|
|
41
44
|
.expire(key, TTL)
|
|
42
45
|
.exec();
|
|
43
46
|
// tslint:disable-next-line:no-single-line-block-comment
|
|
44
47
|
/* istanbul ignore else: please write tests */
|
|
45
|
-
if (typeof incrReply
|
|
46
|
-
let identifier = timestamp;
|
|
47
|
-
const no = incrReply;
|
|
48
|
-
identifier = `${identifier}${no}`;
|
|
49
|
-
// checkdigit
|
|
50
|
-
const cd = cdigit.luhn.compute(identifier);
|
|
51
|
-
const cipher = fpe({ password: cd });
|
|
52
|
-
identifier = cipher.encrypt(identifier);
|
|
53
|
-
identifier = `${cd}${identifier}`;
|
|
54
|
-
return identifier;
|
|
55
|
-
}
|
|
56
|
-
else {
|
|
48
|
+
if (typeof incrReply !== 'number') {
|
|
57
49
|
// 基本的にありえないフロー
|
|
58
|
-
throw new factory.errors.ServiceUnavailable('
|
|
50
|
+
throw new factory.errors.ServiceUnavailable('serviceOutput identifier not incremented unexpectedly');
|
|
59
51
|
}
|
|
52
|
+
let identifier = `${timestamp}${incrReply}`;
|
|
53
|
+
// checkdigit
|
|
54
|
+
const cd = cdigit.luhn.compute(identifier);
|
|
55
|
+
identifier = fpe({ password: cd })
|
|
56
|
+
.encrypt(identifier);
|
|
57
|
+
identifier = `${cd}${identifier}`;
|
|
58
|
+
return identifier;
|
|
60
59
|
});
|
|
61
60
|
}
|
|
62
61
|
}
|
|
63
|
-
RedisRepository.REDIS_KEY_PREFIX = '
|
|
62
|
+
RedisRepository.REDIS_KEY_PREFIX = 'serviceOutputIdentifier';
|
|
64
63
|
exports.RedisRepository = RedisRepository;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { RedisClientType } from 'redis';
|
|
2
|
-
import * as factory from '../../factory';
|
|
3
2
|
export interface IOffer {
|
|
4
3
|
itemOffered?: {
|
|
5
4
|
serviceOutput?: {
|
|
@@ -24,10 +23,11 @@ export interface IUnlockKey {
|
|
|
24
23
|
startDate: Date;
|
|
25
24
|
offer: IOffer;
|
|
26
25
|
}
|
|
26
|
+
export type IGetHolderResult = string | null;
|
|
27
27
|
/**
|
|
28
28
|
* イベントストックホルダーリポジトリ
|
|
29
29
|
*/
|
|
30
|
-
export declare class
|
|
30
|
+
export declare class StockHolderRepository {
|
|
31
31
|
static KEY_PREFIX_NEW: string;
|
|
32
32
|
static KEY_PREFIX: string;
|
|
33
33
|
private readonly redisClient;
|
|
@@ -70,13 +70,10 @@ export declare class RedisRepository {
|
|
|
70
70
|
* 在庫状況を検索する
|
|
71
71
|
* offers.lengthが0だと"ERR wrong number of arguments for 'hmget' command"となるので注意
|
|
72
72
|
*/
|
|
73
|
-
|
|
73
|
+
searchHolders(params: {
|
|
74
74
|
eventId: string;
|
|
75
75
|
startDate: Date;
|
|
76
76
|
offers: IOffer[];
|
|
77
|
-
}): Promise<
|
|
78
|
-
|
|
79
|
-
seatNumber: string;
|
|
80
|
-
availability: factory.itemAvailability;
|
|
81
|
-
}[]>;
|
|
77
|
+
}): Promise<IGetHolderResult[]>;
|
|
78
|
+
private checkIfConflicted;
|
|
82
79
|
}
|