@chevre/domain 21.2.0-alpha.14 → 21.2.0-alpha.141
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 +85 -27
- package/example/src/chevre/countDelayedTasks.ts +7 -2
- package/example/src/chevre/deleteTasksByName.ts +10 -2
- package/example/src/chevre/importEventsFromCOA.ts +3 -4
- package/example/src/chevre/lockStockHolder.ts +5 -2
- package/example/src/chevre/migrateOrderAdditionalProperties.ts +85 -0
- package/example/src/chevre/migrateScreeningEventSeriesVersion.ts +79 -0
- package/example/src/chevre/processPay.ts +5 -1
- package/example/src/chevre/processRegisterMembership.ts +8 -4
- package/example/src/chevre/processRegisterPaymentCard.ts +8 -4
- package/example/src/chevre/processReserve.ts +5 -2
- package/example/src/chevre/saveTasks.ts +13 -10
- package/example/src/chevre/searchAbortedTasks.ts +34 -0
- package/example/src/chevre/searchActions.ts +33 -0
- package/example/src/chevre/searchEventSeats.ts +5 -2
- package/example/src/chevre/searchHoldReservations.ts +38 -0
- package/example/src/chevre/searchPaymentServiceProviders.ts +38 -0
- package/example/src/chevre/searchReservationNumbersByOrderNumbers.ts +37 -1
- package/example/src/chevre/searchScreeningRooms.ts +23 -0
- package/example/src/chevre/searchSendEmailActions.ts +44 -0
- package/example/src/chevre/syncScreeningRooms.ts +21 -0
- package/example/src/chevre/syncScreeningRoomsAll.ts +41 -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 +2 -1
- 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 +2 -1
- package/lib/chevre/eventEmitter/task.js +1 -4
- package/lib/chevre/eventEmitter/transaction.d.ts +1 -1
- package/lib/chevre/eventEmitter/transaction.js +1 -4
- package/lib/chevre/eventEmitter.d.ts +2 -1
- package/lib/chevre/eventEmitter.js +3 -1
- package/lib/chevre/index.d.ts +1 -1
- package/lib/chevre/index.js +2 -2
- package/lib/chevre/repo/account.js +3 -2
- package/lib/chevre/repo/accountTransaction.d.ts +3 -1
- package/lib/chevre/repo/accountTransaction.js +3 -2
- package/lib/chevre/repo/action.d.ts +42 -2
- package/lib/chevre/repo/action.js +130 -57
- package/lib/chevre/repo/additionalProperty.js +2 -1
- package/lib/chevre/repo/aggregation.d.ts +3 -0
- package/lib/chevre/repo/aggregation.js +3 -0
- package/lib/chevre/repo/assetTransaction.d.ts +23 -8
- package/lib/chevre/repo/assetTransaction.js +253 -80
- package/lib/chevre/repo/categoryCode.d.ts +1 -1
- package/lib/chevre/repo/categoryCode.js +37 -25
- package/lib/chevre/repo/code.js +3 -2
- package/lib/chevre/repo/comment.d.ts +4 -1
- package/lib/chevre/repo/comment.js +22 -6
- package/lib/chevre/repo/confirmationNumber.d.ts +0 -1
- package/lib/chevre/repo/confirmationNumber.js +3 -15
- package/lib/chevre/repo/creativeWork.d.ts +2 -4
- package/lib/chevre/repo/creativeWork.js +35 -12
- package/lib/chevre/repo/customer.js +2 -1
- package/lib/chevre/repo/emailMessage.d.ts +1 -27
- package/lib/chevre/repo/emailMessage.js +2 -1
- package/lib/chevre/repo/event.d.ts +27 -1
- package/lib/chevre/repo/event.js +67 -33
- package/lib/chevre/repo/member.js +4 -3
- package/lib/chevre/repo/merchantReturnPolicy.d.ts +1 -3
- package/lib/chevre/repo/merchantReturnPolicy.js +2 -1
- package/lib/chevre/repo/mongoose/schemas/account.d.ts +4 -2
- package/lib/chevre/repo/mongoose/schemas/accountTitle.d.ts +29 -3
- package/lib/chevre/repo/mongoose/schemas/accountTransaction.d.ts +31 -3
- package/lib/chevre/repo/mongoose/schemas/accountTransaction.js +1 -1
- package/lib/chevre/repo/mongoose/schemas/accountingReport.d.ts +13 -3
- package/lib/chevre/repo/mongoose/schemas/action.d.ts +43 -3
- package/lib/chevre/repo/mongoose/schemas/action.js +19 -1
- package/lib/chevre/repo/mongoose/schemas/additionalProperty.d.ts +17 -3
- package/lib/chevre/repo/mongoose/schemas/aggregation.d.ts +4 -2
- package/lib/chevre/repo/mongoose/schemas/assetTransaction.d.ts +44 -3
- package/lib/chevre/repo/mongoose/schemas/assetTransaction.js +32 -19
- package/lib/chevre/repo/mongoose/schemas/authorization.d.ts +19 -3
- package/lib/chevre/repo/mongoose/schemas/authorization.js +1 -1
- package/lib/chevre/repo/mongoose/schemas/categoryCode.d.ts +25 -3
- package/lib/chevre/repo/mongoose/schemas/comments.d.ts +27 -3
- package/lib/chevre/repo/mongoose/schemas/comments.js +1 -1
- package/lib/chevre/repo/mongoose/schemas/creativeWork.d.ts +43 -3
- package/lib/chevre/repo/mongoose/schemas/customer.d.ts +25 -3
- package/lib/chevre/repo/mongoose/schemas/emailMessages.d.ts +21 -3
- package/lib/chevre/repo/mongoose/schemas/event.d.ts +71 -3
- package/lib/chevre/repo/mongoose/schemas/holdReservation.d.ts +75 -0
- package/lib/chevre/repo/mongoose/schemas/holdReservation.js +93 -0
- package/lib/chevre/repo/mongoose/schemas/member.d.ts +13 -3
- package/lib/chevre/repo/mongoose/schemas/merchantReturnPolicy.d.ts +21 -3
- package/lib/chevre/repo/mongoose/schemas/offer.d.ts +65 -3
- package/lib/chevre/repo/mongoose/schemas/offerCatalog.d.ts +27 -3
- 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 +51 -3
- package/lib/chevre/repo/mongoose/schemas/order.js +1 -1
- package/lib/chevre/repo/mongoose/schemas/ownershipInfo.d.ts +25 -3
- package/lib/chevre/repo/mongoose/schemas/ownershipInfo.js +1 -1
- package/lib/chevre/repo/mongoose/schemas/place.d.ts +55 -3
- package/lib/chevre/repo/mongoose/schemas/place.js +16 -1
- package/lib/chevre/repo/mongoose/schemas/priceSpecification.d.ts +29 -3
- package/lib/chevre/repo/mongoose/schemas/product.d.ts +31 -3
- package/lib/chevre/repo/mongoose/schemas/product.js +6 -0
- package/lib/chevre/repo/mongoose/schemas/project.d.ts +23 -3
- package/lib/chevre/repo/mongoose/schemas/reservation.d.ts +63 -5
- package/lib/chevre/repo/mongoose/schemas/reservation.js +1 -1
- package/lib/chevre/repo/mongoose/schemas/role.d.ts +11 -3
- package/lib/chevre/repo/mongoose/schemas/seller.d.ts +31 -3
- package/lib/chevre/repo/mongoose/schemas/seller.js +6 -0
- package/lib/chevre/repo/mongoose/schemas/serviceOutput.d.ts +11 -3
- package/lib/chevre/repo/mongoose/schemas/serviceOutput.js +1 -1
- package/lib/chevre/repo/mongoose/schemas/task.d.ts +30 -3
- package/lib/chevre/repo/mongoose/schemas/task.js +2 -1
- package/lib/chevre/repo/mongoose/schemas/telemetry.d.ts +21 -3
- package/lib/chevre/repo/mongoose/schemas/transaction.d.ts +40 -3
- package/lib/chevre/repo/mongoose/schemas/transaction.js +2 -1
- package/lib/chevre/repo/mongoose/schemas/trip.d.ts +11 -3
- package/lib/chevre/repo/offer.js +3 -2
- package/lib/chevre/repo/offerCatalog.js +0 -27
- package/lib/chevre/repo/offerItemCondition.d.ts +22 -0
- package/lib/chevre/repo/offerItemCondition.js +121 -0
- package/lib/chevre/repo/order.d.ts +55 -3
- package/lib/chevre/repo/order.js +62 -10
- package/lib/chevre/repo/ownershipInfo.js +2 -7
- package/lib/chevre/repo/place.d.ts +97 -24
- package/lib/chevre/repo/place.js +266 -76
- package/lib/chevre/repo/priceSpecification.js +3 -2
- package/lib/chevre/repo/product.d.ts +18 -3
- package/lib/chevre/repo/product.js +139 -5
- package/lib/chevre/repo/project.js +2 -1
- package/lib/chevre/repo/reservation.d.ts +20 -4
- package/lib/chevre/repo/reservation.js +40 -59
- package/lib/chevre/repo/role.js +3 -2
- package/lib/chevre/repo/seller.d.ts +1 -1
- package/lib/chevre/repo/seller.js +44 -23
- package/lib/chevre/repo/serviceOutput.js +2 -1
- package/lib/chevre/repo/stockHolder.d.ts +143 -7
- package/lib/chevre/repo/stockHolder.js +622 -104
- package/lib/chevre/repo/task.d.ts +42 -2
- package/lib/chevre/repo/task.js +68 -20
- package/lib/chevre/repo/transaction.d.ts +21 -2
- package/lib/chevre/repo/transaction.js +160 -48
- package/lib/chevre/repo/trip.js +2 -1
- package/lib/chevre/repository.d.ts +5 -2
- package/lib/chevre/repository.js +8 -4
- package/lib/chevre/service/aggregation/event/aggregateScreeningEvent.js +6 -2
- package/lib/chevre/service/aggregation/event/aggregateUseActionsOnEvent.js +19 -8
- package/lib/chevre/service/aggregation/system.d.ts +110 -23
- package/lib/chevre/service/aggregation/system.js +213 -91
- package/lib/chevre/service/assetTransaction/cancelReservation.js +1 -28
- package/lib/chevre/service/assetTransaction/moneyTransfer.js +2 -24
- package/lib/chevre/service/assetTransaction/pay/account/validation.js +1 -1
- 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 +20 -34
- package/lib/chevre/service/assetTransaction/refund.js +2 -24
- 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 +10 -1
- package/lib/chevre/service/assetTransaction/reserve.js +92 -69
- package/lib/chevre/service/assetTransaction.d.ts +6 -0
- package/lib/chevre/service/assetTransaction.js +9 -4
- package/lib/chevre/service/event.d.ts +3 -0
- package/lib/chevre/service/event.js +54 -22
- 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 +3 -0
- package/lib/chevre/service/offer/event/authorize.js +8 -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/importFromCOA.js +2 -2
- package/lib/chevre/service/offer/event/voidTransaction.d.ts +2 -0
- package/lib/chevre/service/offer/event/voidTransaction.js +17 -1
- package/lib/chevre/service/offer/eventServiceByCOA.js +7 -9
- package/lib/chevre/service/offer/product.js +2 -2
- package/lib/chevre/service/offer.d.ts +16 -8
- package/lib/chevre/service/offer.js +71 -8
- 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 +23 -17
- package/lib/chevre/service/payment/movieTicket/checkByIdentifier.d.ts +8 -7
- package/lib/chevre/service/payment/movieTicket/factory.d.ts +1 -1
- package/lib/chevre/service/payment/movieTicket/getCredentials.d.ts +1 -1
- package/lib/chevre/service/payment/movieTicket/getCredentials.js +1 -1
- package/lib/chevre/service/payment/movieTicket/validation.d.ts +6 -6
- package/lib/chevre/service/payment/movieTicket/validation.js +65 -37
- package/lib/chevre/service/payment/movieTicket.d.ts +2 -2
- package/lib/chevre/service/payment/movieTicket.js +7 -6
- 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 +5 -3
- package/lib/chevre/service/reserve/cancelReservation.js +162 -142
- 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 +133 -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 +1 -1
- package/lib/chevre/service/task/cancelPendingReservation.js +6 -2
- package/lib/chevre/service/task/cancelReservation.js +1 -1
- 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/onEventChanged.d.ts +7 -0
- package/lib/chevre/service/task/{deleteOrder.js → onEventChanged.js} +8 -14
- package/lib/chevre/service/task/onResourceUpdated.d.ts +10 -0
- package/lib/chevre/service/task/onResourceUpdated.js +423 -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/syncScreeningRooms.d.ts +7 -0
- package/lib/chevre/service/task/syncScreeningRooms.js +23 -0
- 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 +4 -2
- package/lib/chevre/service/task.d.ts +6 -0
- package/lib/chevre/service/task.js +22 -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.d.ts +1 -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 +10 -13
- package/lib/chevre/service/transaction/orderProgramMembership/findCreditCard.js +1 -1
- package/lib/chevre/service/transaction/orderProgramMembership/findPaymentCardPermit.js +1 -1
- package/lib/chevre/service/transaction/orderProgramMembership.js +7 -3
- 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 +28 -15
- 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 +228 -36
- package/lib/chevre/service/transaction.d.ts +7 -13
- package/lib/chevre/service/transaction.js +12 -139
- package/lib/chevre/settings.d.ts +13 -2
- package/lib/chevre/settings.js +56 -7
- package/package.json +5 -5
- package/example/src/chevre/createManyEventsIfNotExist.ts +0 -205
- package/example/src/chevre/eventCatalog2eventService.ts +0 -123
- package/example/src/chevre/migrateMoneyTransferPendingTransactionIdentifier.ts +0 -96
- package/example/src/chevre/migrateMovieAdditionalProperties.ts +0 -98
- package/example/src/chevre/migrateStockHolderKeys.ts +0 -89
- 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/repo/place.js
CHANGED
|
@@ -21,9 +21,12 @@ 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 createDebug = require("debug");
|
|
24
25
|
const mongoose_1 = require("mongoose");
|
|
25
26
|
const place_1 = require("./mongoose/schemas/place");
|
|
26
27
|
const factory = require("../factory");
|
|
28
|
+
const settings_1 = require("../settings");
|
|
29
|
+
const debug = createDebug('chevre-domain:repo:place');
|
|
27
30
|
/**
|
|
28
31
|
* 施設リポジトリ
|
|
29
32
|
*/
|
|
@@ -220,7 +223,16 @@ class MongoRepository {
|
|
|
220
223
|
else {
|
|
221
224
|
// 上書き禁止属性を除外(2022-08-24~)
|
|
222
225
|
const { id, branchCode, project, typeOf } = params, updateFields = __rest(params, ["id", "branchCode", "project", "typeOf"]);
|
|
223
|
-
doc = yield this.placeModel.findOneAndUpdate({ _id: params.id }, updateFields, {
|
|
226
|
+
doc = yield this.placeModel.findOneAndUpdate({ _id: params.id }, updateFields, {
|
|
227
|
+
upsert: false,
|
|
228
|
+
new: true,
|
|
229
|
+
projection: {
|
|
230
|
+
__v: 0,
|
|
231
|
+
createdAt: 0,
|
|
232
|
+
updatedAt: 0,
|
|
233
|
+
containsPlace: 0
|
|
234
|
+
}
|
|
235
|
+
})
|
|
224
236
|
.exec();
|
|
225
237
|
}
|
|
226
238
|
if (doc === null) {
|
|
@@ -229,50 +241,109 @@ class MongoRepository {
|
|
|
229
241
|
return doc.toObject();
|
|
230
242
|
});
|
|
231
243
|
}
|
|
244
|
+
// void化(2023-06-23~)
|
|
232
245
|
saveMovieTheaterByBranchCode4coa(params) {
|
|
233
246
|
return __awaiter(this, void 0, void 0, function* () {
|
|
234
|
-
|
|
235
|
-
'project.id': { $eq: params.project.id },
|
|
236
|
-
branchCode: { $eq: params.branchCode }
|
|
237
|
-
}, params, { new: true })
|
|
238
|
-
.exec()
|
|
239
|
-
.then((doc) => {
|
|
240
|
-
if (doc === null) {
|
|
241
|
-
throw new factory.errors.NotFound(`${factory.placeType.MovieTheater} ${params.branchCode}`);
|
|
242
|
-
}
|
|
243
|
-
return doc.toObject();
|
|
244
|
-
});
|
|
245
|
-
});
|
|
246
|
-
}
|
|
247
|
-
findMovieTheaterByBranchCode(params) {
|
|
248
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
249
|
-
return this.placeModel.findOne({
|
|
247
|
+
const movieTheaterDoc = yield this.placeModel.findOneAndUpdate({
|
|
250
248
|
typeOf: { $eq: factory.placeType.MovieTheater },
|
|
251
249
|
'project.id': { $eq: params.project.id },
|
|
252
250
|
branchCode: { $eq: params.branchCode }
|
|
253
|
-
}, {
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
updatedAt: 0
|
|
251
|
+
}, params, {
|
|
252
|
+
new: true,
|
|
253
|
+
projection: { _id: 1 }
|
|
257
254
|
})
|
|
258
|
-
.exec()
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
255
|
+
.exec();
|
|
256
|
+
if (movieTheaterDoc === null) {
|
|
257
|
+
throw new factory.errors.NotFound(factory.placeType.MovieTheater);
|
|
258
|
+
}
|
|
259
|
+
const movieTheater = movieTheaterDoc.toObject();
|
|
260
|
+
// ScreeningRoomも保管する(2023-06-24~)
|
|
261
|
+
const creatingScreeningRooms = params.containsPlace.map((place) => {
|
|
262
|
+
return Object.assign(Object.assign({}, place), { containedInPlace: {
|
|
263
|
+
id: movieTheater.id,
|
|
264
|
+
typeOf: params.typeOf,
|
|
265
|
+
branchCode: params.branchCode,
|
|
266
|
+
name: params.name
|
|
267
|
+
}, containsPlace: (Array.isArray(place.containsPlace)) ? place.containsPlace : [], project: params.project });
|
|
264
268
|
});
|
|
269
|
+
yield Promise.all(creatingScreeningRooms.map((createScreeningRoom) => __awaiter(this, void 0, void 0, function* () {
|
|
270
|
+
const { typeOf, project, branchCode } = createScreeningRoom, setFields = __rest(createScreeningRoom, ["typeOf", "project", "branchCode"]);
|
|
271
|
+
yield this.placeModel.findOneAndUpdate({
|
|
272
|
+
typeOf: { $eq: factory.placeType.ScreeningRoom },
|
|
273
|
+
'project.id': { $eq: createScreeningRoom.project.id },
|
|
274
|
+
'containedInPlace.id': { $exists: true, $eq: createScreeningRoom.containedInPlace.id },
|
|
275
|
+
branchCode: { $eq: createScreeningRoom.branchCode }
|
|
276
|
+
}, {
|
|
277
|
+
$setOnInsert: {
|
|
278
|
+
typeOf: createScreeningRoom.typeOf,
|
|
279
|
+
project: createScreeningRoom.project,
|
|
280
|
+
branchCode: createScreeningRoom.branchCode
|
|
281
|
+
},
|
|
282
|
+
$set: setFields
|
|
283
|
+
}, {
|
|
284
|
+
upsert: true,
|
|
285
|
+
new: true,
|
|
286
|
+
projection: { _id: 1 }
|
|
287
|
+
})
|
|
288
|
+
.exec();
|
|
289
|
+
})));
|
|
265
290
|
});
|
|
266
291
|
}
|
|
292
|
+
// 廃止(2023-06-23~)
|
|
293
|
+
// public async findMovieTheaterByBranchCode(params: {
|
|
294
|
+
// project: { id: string };
|
|
295
|
+
// branchCode: string;
|
|
296
|
+
// }): Promise<factory.place.movieTheater.IPlace> {
|
|
297
|
+
// return this.placeModel.findOne(
|
|
298
|
+
// {
|
|
299
|
+
// typeOf: { $eq: factory.placeType.MovieTheater },
|
|
300
|
+
// 'project.id': { $eq: params.project.id },
|
|
301
|
+
// branchCode: { $eq: params.branchCode }
|
|
302
|
+
// },
|
|
303
|
+
// {
|
|
304
|
+
// __v: 0,
|
|
305
|
+
// createdAt: 0,
|
|
306
|
+
// updatedAt: 0
|
|
307
|
+
// }
|
|
308
|
+
// )
|
|
309
|
+
// .exec()
|
|
310
|
+
// .then((doc) => {
|
|
311
|
+
// if (doc === null) {
|
|
312
|
+
// throw new factory.errors.NotFound(`${factory.placeType.MovieTheater} ${params.branchCode}`);
|
|
313
|
+
// }
|
|
314
|
+
// return doc.toObject();
|
|
315
|
+
// });
|
|
316
|
+
// }
|
|
267
317
|
/**
|
|
268
318
|
* 施設検索
|
|
269
319
|
*/
|
|
270
|
-
searchMovieTheaters(params
|
|
320
|
+
searchMovieTheaters(params,
|
|
321
|
+
// projection明示指定化(2023-06-22~)
|
|
322
|
+
inclusion, exclusion) {
|
|
271
323
|
var _a;
|
|
272
324
|
return __awaiter(this, void 0, void 0, function* () {
|
|
273
325
|
const conditions = MongoRepository.CREATE_MOVIE_THEATER_MONGO_CONDITIONS(params);
|
|
274
|
-
|
|
275
|
-
|
|
326
|
+
let projection = {};
|
|
327
|
+
if (Array.isArray(inclusion) && inclusion.length > 0) {
|
|
328
|
+
inclusion.forEach((field) => {
|
|
329
|
+
projection[field] = 1;
|
|
330
|
+
});
|
|
331
|
+
}
|
|
332
|
+
else {
|
|
333
|
+
projection = {
|
|
334
|
+
__v: 0,
|
|
335
|
+
createdAt: 0,
|
|
336
|
+
updatedAt: 0,
|
|
337
|
+
// containsPlaceを含めるとデータサイズが大きくなるので、検索結果には含めない
|
|
338
|
+
containsPlace: 0
|
|
339
|
+
};
|
|
340
|
+
if (Array.isArray(exclusion) && exclusion.length > 0) {
|
|
341
|
+
exclusion.forEach((field) => {
|
|
342
|
+
projection[field] = 0;
|
|
343
|
+
});
|
|
344
|
+
}
|
|
345
|
+
}
|
|
346
|
+
const query = this.placeModel.find((conditions.length > 0) ? { $and: conditions } : {}, projection);
|
|
276
347
|
if (typeof params.limit === 'number' && params.limit > 0) {
|
|
277
348
|
const page = (typeof params.page === 'number' && params.page > 0) ? params.page : 1;
|
|
278
349
|
query.limit(params.limit)
|
|
@@ -283,33 +354,56 @@ class MongoRepository {
|
|
|
283
354
|
if (((_a = params.sort) === null || _a === void 0 ? void 0 : _a.branchCode) !== undefined) {
|
|
284
355
|
query.sort({ branchCode: params.sort.branchCode });
|
|
285
356
|
}
|
|
286
|
-
return query.setOptions({ maxTimeMS:
|
|
357
|
+
return query.setOptions({ maxTimeMS: settings_1.MONGO_MAX_TIME_MS })
|
|
287
358
|
.exec()
|
|
288
359
|
.then((docs) => docs.map((doc) => doc.toObject()));
|
|
289
360
|
});
|
|
290
361
|
}
|
|
291
362
|
/**
|
|
292
363
|
* 施設取得
|
|
364
|
+
* 廃止(2023-06-22~)
|
|
293
365
|
*/
|
|
294
|
-
findById(
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
366
|
+
// public async findById(
|
|
367
|
+
// params: { id: string },
|
|
368
|
+
// inclusion: string[],
|
|
369
|
+
// exclusion: string[]
|
|
370
|
+
// ): Promise<factory.place.movieTheater.IPlace> {
|
|
371
|
+
// let projection: { [key: string]: number } = {};
|
|
372
|
+
// if (Array.isArray(inclusion) && inclusion.length > 0) {
|
|
373
|
+
// inclusion.forEach((field) => {
|
|
374
|
+
// projection[field] = 1;
|
|
375
|
+
// });
|
|
376
|
+
// } else {
|
|
377
|
+
// projection = {
|
|
378
|
+
// __v: 0,
|
|
379
|
+
// createdAt: 0,
|
|
380
|
+
// updatedAt: 0
|
|
381
|
+
// };
|
|
382
|
+
// if (Array.isArray(exclusion) && exclusion.length > 0) {
|
|
383
|
+
// exclusion.forEach((field) => {
|
|
384
|
+
// projection[field] = 0;
|
|
385
|
+
// });
|
|
386
|
+
// }
|
|
387
|
+
// }
|
|
388
|
+
// const doc = await this.placeModel.findOne(
|
|
389
|
+
// {
|
|
390
|
+
// typeOf: { $eq: factory.placeType.MovieTheater },
|
|
391
|
+
// _id: { $eq: params.id }
|
|
392
|
+
// },
|
|
393
|
+
// projection
|
|
394
|
+
// )
|
|
395
|
+
// .exec();
|
|
396
|
+
// if (doc === null) {
|
|
397
|
+
// throw new factory.errors.NotFound(this.placeModel.modelName);
|
|
398
|
+
// }
|
|
399
|
+
// return doc.toObject();
|
|
400
|
+
// }
|
|
307
401
|
deleteMovieTheaterById(params) {
|
|
308
402
|
return __awaiter(this, void 0, void 0, function* () {
|
|
309
403
|
yield this.placeModel.findOneAndDelete({
|
|
310
404
|
typeOf: { $eq: factory.placeType.MovieTheater },
|
|
311
405
|
_id: { $eq: params.id }
|
|
312
|
-
})
|
|
406
|
+
}, { projection: { _id: 1 } })
|
|
313
407
|
.exec()
|
|
314
408
|
.then((doc) => {
|
|
315
409
|
if (doc === null) {
|
|
@@ -322,6 +416,7 @@ class MongoRepository {
|
|
|
322
416
|
return __awaiter(this, void 0, void 0, function* () {
|
|
323
417
|
// 施設存在確認
|
|
324
418
|
let doc = yield this.placeModel.findOne({
|
|
419
|
+
typeOf: { $eq: factory.placeType.MovieTheater },
|
|
325
420
|
'project.id': { $eq: screeningRoom.project.id },
|
|
326
421
|
branchCode: screeningRoom.containedInPlace.branchCode
|
|
327
422
|
}, {
|
|
@@ -333,6 +428,7 @@ class MongoRepository {
|
|
|
333
428
|
}
|
|
334
429
|
// ルームコードが存在しなければ追加する
|
|
335
430
|
doc = yield this.placeModel.findOneAndUpdate({
|
|
431
|
+
typeOf: { $eq: factory.placeType.MovieTheater },
|
|
336
432
|
'project.id': { $eq: screeningRoom.project.id },
|
|
337
433
|
branchCode: screeningRoom.containedInPlace.branchCode,
|
|
338
434
|
'containsPlace.branchCode': { $ne: screeningRoom.branchCode }
|
|
@@ -350,8 +446,9 @@ class MongoRepository {
|
|
|
350
446
|
new: true,
|
|
351
447
|
projection: {
|
|
352
448
|
_id: 1,
|
|
353
|
-
'project.id': 1,
|
|
354
|
-
branchCode: 1
|
|
449
|
+
// 'project.id': 1,
|
|
450
|
+
branchCode: 1,
|
|
451
|
+
typeOf: 1
|
|
355
452
|
}
|
|
356
453
|
})
|
|
357
454
|
.exec();
|
|
@@ -359,11 +456,13 @@ class MongoRepository {
|
|
|
359
456
|
if (doc === null) {
|
|
360
457
|
throw new factory.errors.AlreadyInUse(factory.placeType.ScreeningRoom, ['branchCode']);
|
|
361
458
|
}
|
|
459
|
+
return doc.toObject();
|
|
362
460
|
});
|
|
363
461
|
}
|
|
364
462
|
updateScreeningRoom(screeningRoom, $unset) {
|
|
365
463
|
return __awaiter(this, void 0, void 0, function* () {
|
|
366
464
|
const doc = yield this.placeModel.findOneAndUpdate({
|
|
465
|
+
typeOf: { $eq: factory.placeType.MovieTheater },
|
|
367
466
|
'project.id': { $eq: screeningRoom.project.id },
|
|
368
467
|
branchCode: screeningRoom.containedInPlace.branchCode,
|
|
369
468
|
'containsPlace.branchCode': screeningRoom.branchCode
|
|
@@ -382,19 +481,22 @@ class MongoRepository {
|
|
|
382
481
|
],
|
|
383
482
|
projection: {
|
|
384
483
|
_id: 1,
|
|
385
|
-
'project.id': 1,
|
|
386
|
-
branchCode: 1
|
|
484
|
+
// 'project.id': 1,
|
|
485
|
+
branchCode: 1,
|
|
486
|
+
typeOf: 1
|
|
387
487
|
}
|
|
388
488
|
})
|
|
389
489
|
.exec();
|
|
390
490
|
if (doc === null) {
|
|
391
491
|
throw new factory.errors.NotFound(factory.placeType.ScreeningRoom);
|
|
392
492
|
}
|
|
493
|
+
return doc.toObject();
|
|
393
494
|
});
|
|
394
495
|
}
|
|
395
496
|
deleteScreeningRoom(screeningRoom) {
|
|
396
497
|
return __awaiter(this, void 0, void 0, function* () {
|
|
397
498
|
const doc = yield this.placeModel.findOneAndUpdate({
|
|
499
|
+
typeOf: { $eq: factory.placeType.MovieTheater },
|
|
398
500
|
'project.id': { $eq: screeningRoom.project.id },
|
|
399
501
|
branchCode: screeningRoom.containedInPlace.branchCode,
|
|
400
502
|
'containsPlace.branchCode': screeningRoom.branchCode
|
|
@@ -402,11 +504,17 @@ class MongoRepository {
|
|
|
402
504
|
$pull: {
|
|
403
505
|
containsPlace: { branchCode: screeningRoom.branchCode }
|
|
404
506
|
}
|
|
507
|
+
}, {
|
|
508
|
+
projection: {
|
|
509
|
+
_id: 1,
|
|
510
|
+
typeOf: 1
|
|
511
|
+
}
|
|
405
512
|
})
|
|
406
513
|
.exec();
|
|
407
514
|
if (doc === null) {
|
|
408
515
|
throw new factory.errors.NotFound(factory.placeType.ScreeningRoom);
|
|
409
516
|
}
|
|
517
|
+
return doc.toObject();
|
|
410
518
|
});
|
|
411
519
|
}
|
|
412
520
|
createScreeningRoomSection(screeningRoomSection) {
|
|
@@ -421,6 +529,7 @@ class MongoRepository {
|
|
|
421
529
|
}
|
|
422
530
|
// 施設存在確認
|
|
423
531
|
let doc = yield this.placeModel.findOne({
|
|
532
|
+
typeOf: { $eq: factory.placeType.MovieTheater },
|
|
424
533
|
'project.id': { $eq: screeningRoomSection.project.id },
|
|
425
534
|
branchCode: movieTheater.branchCode,
|
|
426
535
|
'containsPlace.branchCode': screeningRoom.branchCode
|
|
@@ -430,6 +539,7 @@ class MongoRepository {
|
|
|
430
539
|
throw new factory.errors.NotFound(factory.placeType.MovieTheater);
|
|
431
540
|
}
|
|
432
541
|
doc = yield this.placeModel.findOneAndUpdate({
|
|
542
|
+
typeOf: { $eq: factory.placeType.MovieTheater },
|
|
433
543
|
'project.id': { $eq: screeningRoomSection.project.id },
|
|
434
544
|
branchCode: movieTheater.branchCode,
|
|
435
545
|
'containsPlace.branchCode': screeningRoom.branchCode
|
|
@@ -449,7 +559,8 @@ class MongoRepository {
|
|
|
449
559
|
}
|
|
450
560
|
],
|
|
451
561
|
projection: {
|
|
452
|
-
_id: 1
|
|
562
|
+
_id: 1,
|
|
563
|
+
typeOf: 1
|
|
453
564
|
}
|
|
454
565
|
})
|
|
455
566
|
.exec();
|
|
@@ -457,6 +568,7 @@ class MongoRepository {
|
|
|
457
568
|
if (doc === null) {
|
|
458
569
|
throw new factory.errors.AlreadyInUse(factory.placeType.ScreeningRoomSection, ['branchCode']);
|
|
459
570
|
}
|
|
571
|
+
return doc.toObject();
|
|
460
572
|
});
|
|
461
573
|
}
|
|
462
574
|
updateScreeningRoomSection(screeningRoomSection, $unset) {
|
|
@@ -470,6 +582,7 @@ class MongoRepository {
|
|
|
470
582
|
throw new factory.errors.ArgumentNull('containedInPlace.containedInPlace.branchCode');
|
|
471
583
|
}
|
|
472
584
|
const doc = yield this.placeModel.findOneAndUpdate({
|
|
585
|
+
typeOf: { $eq: factory.placeType.MovieTheater },
|
|
473
586
|
'project.id': { $eq: screeningRoomSection.project.id },
|
|
474
587
|
branchCode: movieTheater.branchCode,
|
|
475
588
|
'containsPlace.branchCode': screeningRoom.branchCode,
|
|
@@ -495,13 +608,15 @@ class MongoRepository {
|
|
|
495
608
|
{ 'screeningRoomSection.branchCode': screeningRoomSection.branchCode }
|
|
496
609
|
],
|
|
497
610
|
projection: {
|
|
498
|
-
_id: 1
|
|
611
|
+
_id: 1,
|
|
612
|
+
typeOf: 1
|
|
499
613
|
}
|
|
500
614
|
})
|
|
501
615
|
.exec();
|
|
502
616
|
if (doc === null) {
|
|
503
617
|
throw new factory.errors.NotFound(factory.placeType.ScreeningRoomSection);
|
|
504
618
|
}
|
|
619
|
+
return doc.toObject();
|
|
505
620
|
});
|
|
506
621
|
}
|
|
507
622
|
// tslint:disable-next-line:max-func-body-length
|
|
@@ -635,6 +750,7 @@ class MongoRepository {
|
|
|
635
750
|
deleteScreeningRoomSection(screeningRoomSection) {
|
|
636
751
|
return __awaiter(this, void 0, void 0, function* () {
|
|
637
752
|
const doc = yield this.placeModel.findOneAndUpdate({
|
|
753
|
+
typeOf: { $eq: factory.placeType.MovieTheater },
|
|
638
754
|
'project.id': { $eq: screeningRoomSection.project.id },
|
|
639
755
|
branchCode: screeningRoomSection.containedInPlace.containedInPlace.branchCode,
|
|
640
756
|
'containsPlace.branchCode': screeningRoomSection.containedInPlace.branchCode,
|
|
@@ -649,17 +765,22 @@ class MongoRepository {
|
|
|
649
765
|
new: true,
|
|
650
766
|
arrayFilters: [
|
|
651
767
|
{ 'screeningRoom.branchCode': screeningRoomSection.containedInPlace.branchCode }
|
|
652
|
-
]
|
|
768
|
+
],
|
|
769
|
+
projection: {
|
|
770
|
+
_id: 1,
|
|
771
|
+
typeOf: 1
|
|
772
|
+
}
|
|
653
773
|
})
|
|
654
774
|
.exec();
|
|
655
775
|
if (doc === null) {
|
|
656
776
|
throw new factory.errors.NotFound(factory.placeType.ScreeningRoomSection);
|
|
657
777
|
}
|
|
778
|
+
return doc.toObject();
|
|
658
779
|
});
|
|
659
780
|
}
|
|
660
781
|
// tslint:disable-next-line:max-func-body-length
|
|
661
782
|
searchScreeningRooms(searchConditions) {
|
|
662
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
783
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
|
|
663
784
|
return __awaiter(this, void 0, void 0, function* () {
|
|
664
785
|
const matchStages = [{ $match: { typeOf: { $eq: factory.placeType.MovieTheater } } }];
|
|
665
786
|
const projectIdEq = (_b = (_a = searchConditions.project) === null || _a === void 0 ? void 0 : _a.id) === null || _b === void 0 ? void 0 : _b.$eq;
|
|
@@ -692,20 +813,23 @@ class MongoRepository {
|
|
|
692
813
|
}
|
|
693
814
|
}
|
|
694
815
|
}
|
|
695
|
-
|
|
696
|
-
if (
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
$
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
$eq: searchConditions.branchCode.$eq
|
|
703
|
-
}
|
|
704
|
-
}
|
|
705
|
-
});
|
|
706
|
-
}
|
|
816
|
+
const branchCodeEq = (_e = searchConditions.branchCode) === null || _e === void 0 ? void 0 : _e.$eq;
|
|
817
|
+
if (typeof branchCodeEq === 'string') {
|
|
818
|
+
matchStages.push({
|
|
819
|
+
$match: {
|
|
820
|
+
'containsPlace.branchCode': { $exists: true, $eq: branchCodeEq }
|
|
821
|
+
}
|
|
822
|
+
});
|
|
707
823
|
}
|
|
708
|
-
const
|
|
824
|
+
const branchCodeIn = (_f = searchConditions.branchCode) === null || _f === void 0 ? void 0 : _f.$in;
|
|
825
|
+
if (Array.isArray(branchCodeIn)) {
|
|
826
|
+
matchStages.push({
|
|
827
|
+
$match: {
|
|
828
|
+
'containsPlace.branchCode': { $exists: true, $in: branchCodeIn }
|
|
829
|
+
}
|
|
830
|
+
});
|
|
831
|
+
}
|
|
832
|
+
const branchCodeRegex = (_g = searchConditions.branchCode) === null || _g === void 0 ? void 0 : _g.$regex;
|
|
709
833
|
if (typeof branchCodeRegex === 'string') {
|
|
710
834
|
matchStages.push({
|
|
711
835
|
$match: {
|
|
@@ -716,7 +840,7 @@ class MongoRepository {
|
|
|
716
840
|
}
|
|
717
841
|
});
|
|
718
842
|
}
|
|
719
|
-
const nameCodeRegex = (
|
|
843
|
+
const nameCodeRegex = (_h = searchConditions.name) === null || _h === void 0 ? void 0 : _h.$regex;
|
|
720
844
|
if (typeof nameCodeRegex === 'string') {
|
|
721
845
|
matchStages.push({
|
|
722
846
|
$match: {
|
|
@@ -748,7 +872,7 @@ class MongoRepository {
|
|
|
748
872
|
}
|
|
749
873
|
});
|
|
750
874
|
}
|
|
751
|
-
const additionalPropertyElemMatch = (
|
|
875
|
+
const additionalPropertyElemMatch = (_j = searchConditions.additionalProperty) === null || _j === void 0 ? void 0 : _j.$elemMatch;
|
|
752
876
|
if (additionalPropertyElemMatch !== undefined && additionalPropertyElemMatch !== null) {
|
|
753
877
|
matchStages.push({
|
|
754
878
|
$match: {
|
|
@@ -768,7 +892,7 @@ class MongoRepository {
|
|
|
768
892
|
typeOf: '$typeOf',
|
|
769
893
|
branchCode: '$branchCode',
|
|
770
894
|
name: '$name'
|
|
771
|
-
}, openSeatingAllowed: '$containsPlace.openSeatingAllowed', additionalProperty: '$containsPlace.additionalProperty' }, (((
|
|
895
|
+
}, openSeatingAllowed: '$containsPlace.openSeatingAllowed', additionalProperty: '$containsPlace.additionalProperty', maximumAttendeeCapacity: '$containsPlace.maximumAttendeeCapacity' }, (((_k = searchConditions.$projection) === null || _k === void 0 ? void 0 : _k.sectionCount) === 1)
|
|
772
896
|
? {
|
|
773
897
|
sectionCount: {
|
|
774
898
|
$cond: {
|
|
@@ -778,7 +902,7 @@ class MongoRepository {
|
|
|
778
902
|
}
|
|
779
903
|
}
|
|
780
904
|
}
|
|
781
|
-
: undefined), (((
|
|
905
|
+
: undefined), (((_l = searchConditions.$projection) === null || _l === void 0 ? void 0 : _l.seatCount) === 1)
|
|
782
906
|
? {
|
|
783
907
|
seatCount: {
|
|
784
908
|
$sum: {
|
|
@@ -866,6 +990,7 @@ class MongoRepository {
|
|
|
866
990
|
}
|
|
867
991
|
// 施設存在確認
|
|
868
992
|
let doc = yield this.placeModel.findOne({
|
|
993
|
+
typeOf: { $eq: factory.placeType.MovieTheater },
|
|
869
994
|
'project.id': { $eq: seat.project.id },
|
|
870
995
|
branchCode: movieTheater.branchCode,
|
|
871
996
|
'containsPlace.branchCode': screeningRoom.branchCode,
|
|
@@ -878,6 +1003,7 @@ class MongoRepository {
|
|
|
878
1003
|
throw new factory.errors.NotFound(factory.placeType.MovieTheater);
|
|
879
1004
|
}
|
|
880
1005
|
doc = yield this.placeModel.findOneAndUpdate({
|
|
1006
|
+
typeOf: { $eq: factory.placeType.MovieTheater },
|
|
881
1007
|
'project.id': { $eq: seat.project.id },
|
|
882
1008
|
branchCode: movieTheater.branchCode,
|
|
883
1009
|
'containsPlace.branchCode': screeningRoom.branchCode,
|
|
@@ -897,8 +1023,9 @@ class MongoRepository {
|
|
|
897
1023
|
],
|
|
898
1024
|
projection: {
|
|
899
1025
|
_id: 1,
|
|
900
|
-
'project.id': 1,
|
|
901
|
-
branchCode: 1
|
|
1026
|
+
// 'project.id': 1,
|
|
1027
|
+
branchCode: 1,
|
|
1028
|
+
typeOf: 1
|
|
902
1029
|
}
|
|
903
1030
|
})
|
|
904
1031
|
.exec();
|
|
@@ -906,6 +1033,7 @@ class MongoRepository {
|
|
|
906
1033
|
if (doc === null) {
|
|
907
1034
|
throw new factory.errors.AlreadyInUse(factory.placeType.Seat, ['branchCode']);
|
|
908
1035
|
}
|
|
1036
|
+
return doc.toObject();
|
|
909
1037
|
});
|
|
910
1038
|
}
|
|
911
1039
|
updateSeat(seat, $unset) {
|
|
@@ -924,6 +1052,7 @@ class MongoRepository {
|
|
|
924
1052
|
throw new factory.errors.ArgumentNull('containedInPlace.containedInPlace.containedInPlace.branchCode');
|
|
925
1053
|
}
|
|
926
1054
|
const doc = yield this.placeModel.findOneAndUpdate({
|
|
1055
|
+
typeOf: { $eq: factory.placeType.MovieTheater },
|
|
927
1056
|
'project.id': { $eq: seat.project.id },
|
|
928
1057
|
branchCode: movieTheater.branchCode,
|
|
929
1058
|
'containsPlace.branchCode': screeningRoom.branchCode,
|
|
@@ -950,14 +1079,16 @@ class MongoRepository {
|
|
|
950
1079
|
],
|
|
951
1080
|
projection: {
|
|
952
1081
|
_id: 1,
|
|
953
|
-
'project.id': 1,
|
|
954
|
-
branchCode: 1
|
|
1082
|
+
// 'project.id': 1,
|
|
1083
|
+
branchCode: 1,
|
|
1084
|
+
typeOf: 1
|
|
955
1085
|
}
|
|
956
1086
|
})
|
|
957
1087
|
.exec();
|
|
958
1088
|
if (doc === null) {
|
|
959
1089
|
throw new factory.errors.NotFound(factory.placeType.Seat);
|
|
960
1090
|
}
|
|
1091
|
+
return doc.toObject();
|
|
961
1092
|
});
|
|
962
1093
|
}
|
|
963
1094
|
// tslint:disable-next-line:cyclomatic-complexity max-func-body-length
|
|
@@ -1148,6 +1279,7 @@ class MongoRepository {
|
|
|
1148
1279
|
deleteSeat(seat) {
|
|
1149
1280
|
return __awaiter(this, void 0, void 0, function* () {
|
|
1150
1281
|
const doc = yield this.placeModel.findOneAndUpdate({
|
|
1282
|
+
typeOf: { $eq: factory.placeType.MovieTheater },
|
|
1151
1283
|
'project.id': { $eq: seat.project.id },
|
|
1152
1284
|
branchCode: seat.containedInPlace.containedInPlace.containedInPlace.branchCode,
|
|
1153
1285
|
'containsPlace.branchCode': seat.containedInPlace.containedInPlace.branchCode,
|
|
@@ -1164,12 +1296,70 @@ class MongoRepository {
|
|
|
1164
1296
|
arrayFilters: [
|
|
1165
1297
|
{ 'screeningRoom.branchCode': seat.containedInPlace.containedInPlace.branchCode },
|
|
1166
1298
|
{ 'screeningRoomSection.branchCode': seat.containedInPlace.branchCode }
|
|
1167
|
-
]
|
|
1299
|
+
],
|
|
1300
|
+
projection: {
|
|
1301
|
+
_id: 1,
|
|
1302
|
+
typeOf: 1
|
|
1303
|
+
}
|
|
1168
1304
|
})
|
|
1169
1305
|
.exec();
|
|
1170
1306
|
if (doc === null) {
|
|
1171
1307
|
throw new factory.errors.NotFound(factory.placeType.Seat);
|
|
1172
1308
|
}
|
|
1309
|
+
return doc.toObject();
|
|
1310
|
+
});
|
|
1311
|
+
}
|
|
1312
|
+
syncScreeningRooms(params) {
|
|
1313
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
1314
|
+
const movieTheater = yield this.placeModel.findOne({
|
|
1315
|
+
_id: { $eq: params.id },
|
|
1316
|
+
typeOf: { $eq: factory.placeType.MovieTheater }
|
|
1317
|
+
})
|
|
1318
|
+
.select({
|
|
1319
|
+
_id: 1, branchCode: 1, name: 1, project: 1, typeOf: 1, containsPlace: 1
|
|
1320
|
+
})
|
|
1321
|
+
.exec()
|
|
1322
|
+
.then((doc) => {
|
|
1323
|
+
if (doc === null) {
|
|
1324
|
+
throw new factory.errors.NotFound(factory.placeType.MovieTheater);
|
|
1325
|
+
}
|
|
1326
|
+
return doc.toObject();
|
|
1327
|
+
});
|
|
1328
|
+
let screeningRoomsFromMovieTheater = movieTheater.containsPlace;
|
|
1329
|
+
if (typeof params.screeningRoomBranchCode === 'string' && params.screeningRoomBranchCode.length > 0) {
|
|
1330
|
+
screeningRoomsFromMovieTheater = screeningRoomsFromMovieTheater.filter((place) => place.branchCode === params.screeningRoomBranchCode);
|
|
1331
|
+
}
|
|
1332
|
+
const creatingScreeningRooms = screeningRoomsFromMovieTheater.map((place) => {
|
|
1333
|
+
return Object.assign(Object.assign({}, place), { containedInPlace: {
|
|
1334
|
+
id: movieTheater.id,
|
|
1335
|
+
typeOf: movieTheater.typeOf,
|
|
1336
|
+
branchCode: movieTheater.branchCode,
|
|
1337
|
+
name: movieTheater.name
|
|
1338
|
+
}, containsPlace: (Array.isArray(place.containsPlace)) ? place.containsPlace : [], project: movieTheater.project });
|
|
1339
|
+
});
|
|
1340
|
+
debug('sync processing', creatingScreeningRooms.length, 'screeningRooms...', creatingScreeningRooms);
|
|
1341
|
+
yield Promise.all(creatingScreeningRooms.map((createScreeningRoom) => __awaiter(this, void 0, void 0, function* () {
|
|
1342
|
+
const { typeOf, project, branchCode } = createScreeningRoom, setFields = __rest(createScreeningRoom, ["typeOf", "project", "branchCode"]);
|
|
1343
|
+
const upsertScreeningRoomResult = yield this.placeModel.findOneAndUpdate({
|
|
1344
|
+
typeOf: { $eq: factory.placeType.ScreeningRoom },
|
|
1345
|
+
'project.id': { $eq: createScreeningRoom.project.id },
|
|
1346
|
+
'containedInPlace.id': { $exists: true, $eq: createScreeningRoom.containedInPlace.id },
|
|
1347
|
+
branchCode: { $eq: createScreeningRoom.branchCode }
|
|
1348
|
+
}, {
|
|
1349
|
+
$setOnInsert: {
|
|
1350
|
+
typeOf: createScreeningRoom.typeOf,
|
|
1351
|
+
project: createScreeningRoom.project,
|
|
1352
|
+
branchCode: createScreeningRoom.branchCode
|
|
1353
|
+
},
|
|
1354
|
+
$set: setFields
|
|
1355
|
+
}, {
|
|
1356
|
+
upsert: true,
|
|
1357
|
+
new: true,
|
|
1358
|
+
projection: { _id: 1 }
|
|
1359
|
+
})
|
|
1360
|
+
.exec();
|
|
1361
|
+
debug('screeningRoom upserted. upsertScreeningRoomResult:', upsertScreeningRoomResult);
|
|
1362
|
+
})));
|
|
1173
1363
|
});
|
|
1174
1364
|
}
|
|
1175
1365
|
deleteByProject(params) {
|
|
@@ -1235,7 +1425,7 @@ class MongoRepository {
|
|
|
1235
1425
|
if (((_a = params.sort) === null || _a === void 0 ? void 0 : _a.branchCode) !== undefined) {
|
|
1236
1426
|
query.sort({ branchCode: params.sort.branchCode });
|
|
1237
1427
|
}
|
|
1238
|
-
return query.setOptions({ maxTimeMS:
|
|
1428
|
+
return query.setOptions({ maxTimeMS: settings_1.MONGO_MAX_TIME_MS })
|
|
1239
1429
|
.exec()
|
|
1240
1430
|
.then((docs) => docs.map((doc) => doc.toObject()));
|
|
1241
1431
|
});
|
|
@@ -23,6 +23,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
23
23
|
exports.MongoRepository = void 0;
|
|
24
24
|
const factory = require("../factory");
|
|
25
25
|
const priceSpecification_1 = require("./mongoose/schemas/priceSpecification");
|
|
26
|
+
const settings_1 = require("../settings");
|
|
26
27
|
/**
|
|
27
28
|
* 価格仕様リポジトリ
|
|
28
29
|
*/
|
|
@@ -156,7 +157,7 @@ class MongoRepository {
|
|
|
156
157
|
return __awaiter(this, void 0, void 0, function* () {
|
|
157
158
|
const conditions = MongoRepository.CREATE_MONGO_CONDITIONS(params);
|
|
158
159
|
return this.priceSpecificationModel.countDocuments((conditions.length > 0) ? { $and: conditions } : {})
|
|
159
|
-
.setOptions({ maxTimeMS:
|
|
160
|
+
.setOptions({ maxTimeMS: settings_1.MONGO_MAX_TIME_MS })
|
|
160
161
|
.exec();
|
|
161
162
|
});
|
|
162
163
|
}
|
|
@@ -182,7 +183,7 @@ class MongoRepository {
|
|
|
182
183
|
// const explainResult = await (<any>query).explain();
|
|
183
184
|
// console.log(explainResult[0].executionStats.allPlansExecution.map((e: any) => e.executionStages.inputStage));
|
|
184
185
|
// return;
|
|
185
|
-
return query.setOptions({ maxTimeMS:
|
|
186
|
+
return query.setOptions({ maxTimeMS: settings_1.MONGO_MAX_TIME_MS })
|
|
186
187
|
.exec()
|
|
187
188
|
.then((docs) => docs.map((doc) => doc.toObject()));
|
|
188
189
|
});
|