@chevre/domain 21.4.0-alpha.2 → 21.4.0-alpha.21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/example/src/chevre/cleanActions.ts +23 -0
- package/example/src/chevre/cleanEventsByMovieTheater.ts +32 -0
- package/example/src/chevre/createDeleteTransactionTasksOfDeletedPeople.ts +126 -0
- package/example/src/chevre/createManyEventsIfNotExist.ts +6 -0
- package/example/src/chevre/migrateEventOrganizer.ts +125 -0
- package/example/src/chevre/migrateReservationProvider.ts +117 -0
- package/example/src/chevre/migrateScreeningRoomOrganizer.ts +91 -0
- package/example/src/chevre/processReserve.ts +0 -1
- package/example/src/chevre/searchEvents.ts +1 -9
- package/example/src/chevre/searchProductOffers.ts +6 -0
- package/lib/chevre/factory/event.d.ts +1 -1
- package/lib/chevre/repo/action.d.ts +6 -0
- package/lib/chevre/repo/action.js +13 -0
- package/lib/chevre/repo/assetTransaction.d.ts +4 -1
- package/lib/chevre/repo/assetTransaction.js +6 -12
- package/lib/chevre/repo/event.d.ts +25 -4
- package/lib/chevre/repo/event.js +122 -60
- package/lib/chevre/repo/mongoose/schemas/event.d.ts +7 -4
- package/lib/chevre/repo/mongoose/schemas/event.js +15 -2
- package/lib/chevre/repo/mongoose/schemas/place.d.ts +6 -6
- package/lib/chevre/repo/mongoose/schemas/place.js +9 -2
- package/lib/chevre/repo/mongoose/schemas/product.d.ts +3 -3
- package/lib/chevre/repo/mongoose/schemas/reservation.d.ts +3 -0
- package/lib/chevre/repo/mongoose/schemas/reservation.js +6 -3
- package/lib/chevre/repo/order.d.ts +21 -0
- package/lib/chevre/repo/order.js +54 -62
- package/lib/chevre/repo/place.d.ts +57 -16
- package/lib/chevre/repo/place.js +112 -167
- package/lib/chevre/repo/product.d.ts +2 -4
- package/lib/chevre/repo/product.js +52 -7
- package/lib/chevre/repo/productOffer.d.ts +19 -4
- package/lib/chevre/repo/productOffer.js +37 -14
- package/lib/chevre/repo/reservation.d.ts +33 -21
- package/lib/chevre/repo/reservation.js +97 -79
- package/lib/chevre/repo/seller.d.ts +4 -3
- package/lib/chevre/repo/seller.js +40 -38
- package/lib/chevre/repo/task.d.ts +1 -1
- package/lib/chevre/service/aggregation/event/aggregateScreeningEvent.d.ts +2 -2
- package/lib/chevre/service/aggregation/event/aggregateScreeningEvent.js +3 -2
- package/lib/chevre/service/aggregation/event/aggregateUseActionsOnEvent.js +1 -1
- package/lib/chevre/service/assetTransaction/pay/account/validation.js +9 -1
- package/lib/chevre/service/assetTransaction/pay.js +9 -1
- package/lib/chevre/service/assetTransaction/registerService.js +2 -2
- package/lib/chevre/service/assetTransaction/reserve/factory.d.ts +10 -4
- package/lib/chevre/service/assetTransaction/reserve/factory.js +21 -40
- package/lib/chevre/service/assetTransaction/reserve.d.ts +0 -1
- package/lib/chevre/service/assetTransaction/reserve.js +7 -22
- package/lib/chevre/service/event/createEvent.d.ts +9 -0
- package/lib/chevre/service/event/createEvent.js +86 -0
- package/lib/chevre/service/event.d.ts +2 -0
- package/lib/chevre/service/event.js +26 -26
- package/lib/chevre/service/moneyTransfer.js +1 -1
- package/lib/chevre/service/offer/event/authorize.d.ts +0 -1
- package/lib/chevre/service/offer/event/authorize.js +6 -2
- package/lib/chevre/service/offer/event/searchEventTicketOffers.js +16 -2
- package/lib/chevre/service/offer/eventServiceByCOA/factory.d.ts +1 -1
- package/lib/chevre/service/offer/product/searchProductOffers.js +1 -1
- package/lib/chevre/service/order/returnOrder.js +8 -1
- package/lib/chevre/service/order/sendOrder.js +8 -1
- package/lib/chevre/service/payment/creditCard.js +9 -1
- package/lib/chevre/service/payment/movieTicket/factory.d.ts +2 -1
- package/lib/chevre/service/payment/movieTicket/validation.js +9 -1
- package/lib/chevre/service/payment/movieTicket.js +19 -2
- package/lib/chevre/service/payment/paymentCard.js +1 -3
- package/lib/chevre/service/reserve/cancelReservation.js +15 -28
- package/lib/chevre/service/reserve/confirmReservation.js +12 -30
- package/lib/chevre/service/reserve/verifyToken4reservation.d.ts +3 -0
- package/lib/chevre/service/reserve/verifyToken4reservation.js +3 -1
- package/lib/chevre/service/task/{syncScreeningRooms.d.ts → createEvent.d.ts} +1 -1
- package/lib/chevre/service/task/{syncScreeningRooms.js → createEvent.js} +10 -4
- package/lib/chevre/service/task/onAuthorizationCreated.js +1 -0
- package/lib/chevre/service/task/returnPayTransaction.js +1 -0
- package/lib/chevre/service/transaction/moneyTransfer.js +9 -1
- package/lib/chevre/service/transaction/orderProgramMembership/findCreditCard.js +1 -1
- package/lib/chevre/service/transaction/placeOrderInProgress.js +9 -6
- package/lib/chevre/service/transaction/returnOrder.js +9 -3
- package/package.json +3 -3
- package/example/src/chevre/findByOrderNumberAndReservationId.ts +0 -20
- package/example/src/chevre/findScreeningRoomsByBranchCode.ts +0 -27
- package/example/src/chevre/migrateEventOffersItemOfferedAvailableChannel.ts +0 -90
- package/example/src/chevre/migrateEventOffersItemOfferedTypeOf.ts +0 -75
- package/example/src/chevre/migrateSSKTEventCOAEndpoint.ts +0 -64
- package/example/src/chevre/migrateScreeningEventSeriesVersion.ts +0 -79
- package/example/src/chevre/searchScreeningRooms.ts +0 -33
- package/example/src/chevre/syncScreeningRooms.ts +0 -21
- package/example/src/chevre/syncScreeningRoomsAll.ts +0 -41
package/lib/chevre/repo/place.js
CHANGED
|
@@ -342,7 +342,8 @@ class MongoRepository {
|
|
|
342
342
|
return __awaiter(this, void 0, void 0, function* () {
|
|
343
343
|
yield this.placeModel.findOneAndDelete({
|
|
344
344
|
typeOf: { $eq: factory.placeType.MovieTheater },
|
|
345
|
-
_id: { $eq: params.id }
|
|
345
|
+
_id: { $eq: params.id },
|
|
346
|
+
'project.id': { $eq: params.project.id }
|
|
346
347
|
}, { projection: { _id: 1 } })
|
|
347
348
|
.exec()
|
|
348
349
|
.then((doc) => {
|
|
@@ -353,13 +354,12 @@ class MongoRepository {
|
|
|
353
354
|
});
|
|
354
355
|
}
|
|
355
356
|
createScreeningRoom(screeningRoom) {
|
|
357
|
+
var _a;
|
|
356
358
|
return __awaiter(this, void 0, void 0, function* () {
|
|
357
359
|
// 施設存在確認
|
|
358
|
-
const movieTheaterDoc = yield this.placeModel.findOne({
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
branchCode: { $eq: screeningRoom.containedInPlace.branchCode }
|
|
362
|
-
}, { _id: 1, typeOf: 1, branchCode: 1, name: 1 })
|
|
360
|
+
const movieTheaterDoc = yield this.placeModel.findOne(Object.assign({ typeOf: { $eq: factory.placeType.MovieTheater }, 'project.id': { $eq: screeningRoom.project.id }, branchCode: { $eq: screeningRoom.containedInPlace.branchCode } }, (typeof ((_a = screeningRoom.parentOrganization) === null || _a === void 0 ? void 0 : _a.id) === 'string')
|
|
361
|
+
? { 'parentOrganization.id': { $exists: true, $eq: screeningRoom.parentOrganization.id } }
|
|
362
|
+
: undefined), { _id: 1, typeOf: 1, branchCode: 1, name: 1, parentOrganization: 1 })
|
|
363
363
|
.exec();
|
|
364
364
|
if (movieTheaterDoc === null) {
|
|
365
365
|
throw new factory.errors.NotFound(factory.placeType.MovieTheater);
|
|
@@ -370,7 +370,9 @@ class MongoRepository {
|
|
|
370
370
|
typeOf: movieTheater.typeOf,
|
|
371
371
|
branchCode: movieTheater.branchCode,
|
|
372
372
|
name: movieTheater.name
|
|
373
|
-
}, containsPlace: [], project: screeningRoom.project
|
|
373
|
+
}, containsPlace: [], project: screeningRoom.project,
|
|
374
|
+
// 必須化(2023-07-14~)
|
|
375
|
+
parentOrganization: movieTheater.parentOrganization }, (typeof screeningRoom.openSeatingAllowed === 'boolean')
|
|
374
376
|
? { openSeatingAllowed: screeningRoom.openSeatingAllowed }
|
|
375
377
|
: undefined);
|
|
376
378
|
const upsertScreeningRoomResult = yield this.placeModel.updateOne({
|
|
@@ -393,13 +395,11 @@ class MongoRepository {
|
|
|
393
395
|
});
|
|
394
396
|
}
|
|
395
397
|
updateScreeningRoom(screeningRoom, $unset) {
|
|
398
|
+
var _a;
|
|
396
399
|
return __awaiter(this, void 0, void 0, function* () {
|
|
397
|
-
const doc = yield this.placeModel.findOneAndUpdate({
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
'containedInPlace.branchCode': { $exists: true, $eq: screeningRoom.containedInPlace.branchCode },
|
|
401
|
-
branchCode: screeningRoom.branchCode
|
|
402
|
-
}, Object.assign(Object.assign(Object.assign(Object.assign({ name: screeningRoom.name }, (screeningRoom.address !== undefined && screeningRoom.address !== null)
|
|
400
|
+
const doc = yield this.placeModel.findOneAndUpdate(Object.assign({ typeOf: { $eq: factory.placeType.ScreeningRoom }, 'project.id': { $eq: screeningRoom.project.id }, 'containedInPlace.branchCode': { $exists: true, $eq: screeningRoom.containedInPlace.branchCode }, branchCode: screeningRoom.branchCode }, (typeof ((_a = screeningRoom.parentOrganization) === null || _a === void 0 ? void 0 : _a.id) === 'string')
|
|
401
|
+
? { 'parentOrganization.id': { $exists: true, $eq: screeningRoom.parentOrganization.id } }
|
|
402
|
+
: undefined), Object.assign(Object.assign(Object.assign(Object.assign({ name: screeningRoom.name }, (screeningRoom.address !== undefined && screeningRoom.address !== null)
|
|
403
403
|
? { address: screeningRoom.address }
|
|
404
404
|
: undefined), (typeof screeningRoom.openSeatingAllowed === 'boolean')
|
|
405
405
|
? { openSeatingAllowed: screeningRoom.openSeatingAllowed }
|
|
@@ -423,6 +423,26 @@ class MongoRepository {
|
|
|
423
423
|
return doc.toObject();
|
|
424
424
|
});
|
|
425
425
|
}
|
|
426
|
+
addParentOrganization2ScreeningRoom(screeningRoom) {
|
|
427
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
428
|
+
const doc = yield this.placeModel.findOneAndUpdate({
|
|
429
|
+
typeOf: { $eq: factory.placeType.ScreeningRoom },
|
|
430
|
+
'project.id': { $eq: screeningRoom.project.id },
|
|
431
|
+
'containedInPlace.branchCode': { $exists: true, $eq: screeningRoom.containedInPlace.branchCode },
|
|
432
|
+
branchCode: screeningRoom.branchCode
|
|
433
|
+
}, {
|
|
434
|
+
parentOrganization: screeningRoom.parentOrganization
|
|
435
|
+
}, {
|
|
436
|
+
new: true,
|
|
437
|
+
projection: { 'containedInPlace.id': 1, typeOf: 1 }
|
|
438
|
+
})
|
|
439
|
+
.exec();
|
|
440
|
+
if (doc === null) {
|
|
441
|
+
throw new factory.errors.NotFound(factory.placeType.ScreeningRoom);
|
|
442
|
+
}
|
|
443
|
+
return doc.toObject();
|
|
444
|
+
});
|
|
445
|
+
}
|
|
426
446
|
updateScreeningRoomsByContainedInPlaceId(screeningRoom) {
|
|
427
447
|
var _a;
|
|
428
448
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -439,13 +459,11 @@ class MongoRepository {
|
|
|
439
459
|
});
|
|
440
460
|
}
|
|
441
461
|
deleteScreeningRoom(screeningRoom) {
|
|
462
|
+
var _a;
|
|
442
463
|
return __awaiter(this, void 0, void 0, function* () {
|
|
443
|
-
const doc = yield this.placeModel.findOneAndDelete({
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
'containedInPlace.branchCode': { $exists: true, $eq: screeningRoom.containedInPlace.branchCode },
|
|
447
|
-
branchCode: screeningRoom.branchCode
|
|
448
|
-
}, {
|
|
464
|
+
const doc = yield this.placeModel.findOneAndDelete(Object.assign({ typeOf: { $eq: factory.placeType.ScreeningRoom }, 'project.id': { $eq: screeningRoom.project.id }, 'containedInPlace.branchCode': { $exists: true, $eq: screeningRoom.containedInPlace.branchCode }, branchCode: screeningRoom.branchCode }, (typeof ((_a = screeningRoom.parentOrganization) === null || _a === void 0 ? void 0 : _a.id) === 'string')
|
|
465
|
+
? { 'parentOrganization.id': { $exists: true, $eq: screeningRoom.parentOrganization.id } }
|
|
466
|
+
: undefined), {
|
|
449
467
|
projection: { 'containedInPlace.id': 1, typeOf: 1 }
|
|
450
468
|
})
|
|
451
469
|
.exec();
|
|
@@ -467,6 +485,7 @@ class MongoRepository {
|
|
|
467
485
|
}
|
|
468
486
|
// tslint:disable-next-line:max-func-body-length
|
|
469
487
|
createScreeningRoomSection(screeningRoomSection) {
|
|
488
|
+
var _a;
|
|
470
489
|
return __awaiter(this, void 0, void 0, function* () {
|
|
471
490
|
const screeningRoom = screeningRoomSection.containedInPlace;
|
|
472
491
|
if (typeof (screeningRoom === null || screeningRoom === void 0 ? void 0 : screeningRoom.branchCode) !== 'string') {
|
|
@@ -477,11 +496,9 @@ class MongoRepository {
|
|
|
477
496
|
throw new factory.errors.ArgumentNull('containedInPlace.containedInPlace.branchCode');
|
|
478
497
|
}
|
|
479
498
|
// 施設存在確認
|
|
480
|
-
let doc = yield this.placeModel.findOne({
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
branchCode: { $eq: movieTheater.branchCode }
|
|
484
|
-
}, { _id: 1 })
|
|
499
|
+
let doc = yield this.placeModel.findOne(Object.assign({ typeOf: { $eq: factory.placeType.MovieTheater }, 'project.id': { $eq: screeningRoomSection.project.id }, branchCode: { $eq: movieTheater.branchCode } }, (typeof ((_a = screeningRoomSection.parentOrganization) === null || _a === void 0 ? void 0 : _a.id) === 'string')
|
|
500
|
+
? { 'parentOrganization.id': { $exists: true, $eq: screeningRoomSection.parentOrganization.id } }
|
|
501
|
+
: undefined), { _id: 1 })
|
|
485
502
|
.exec();
|
|
486
503
|
if (doc === null) {
|
|
487
504
|
throw new factory.errors.NotFound(factory.placeType.MovieTheater);
|
|
@@ -513,6 +530,7 @@ class MongoRepository {
|
|
|
513
530
|
}
|
|
514
531
|
// tslint:disable-next-line:max-func-body-length
|
|
515
532
|
updateScreeningRoomSection(screeningRoomSection, $unset) {
|
|
533
|
+
var _a;
|
|
516
534
|
return __awaiter(this, void 0, void 0, function* () {
|
|
517
535
|
const screeningRoom = screeningRoomSection.containedInPlace;
|
|
518
536
|
if (typeof (screeningRoom === null || screeningRoom === void 0 ? void 0 : screeningRoom.branchCode) !== 'string') {
|
|
@@ -522,13 +540,9 @@ class MongoRepository {
|
|
|
522
540
|
if (typeof (movieTheater === null || movieTheater === void 0 ? void 0 : movieTheater.branchCode) !== 'string') {
|
|
523
541
|
throw new factory.errors.ArgumentNull('containedInPlace.containedInPlace.branchCode');
|
|
524
542
|
}
|
|
525
|
-
const doc = yield this.placeModel.findOneAndUpdate({
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
'containedInPlace.branchCode': { $exists: true, $eq: movieTheater.branchCode },
|
|
529
|
-
branchCode: { $eq: screeningRoom.branchCode },
|
|
530
|
-
'containsPlace.branchCode': { $eq: screeningRoomSection.branchCode }
|
|
531
|
-
}, Object.assign(Object.assign(Object.assign(Object.assign({ 'containsPlace.$[screeningRoomSection].branchCode': screeningRoomSection.branchCode }, (screeningRoomSection.name !== undefined && screeningRoomSection !== null)
|
|
543
|
+
const doc = yield this.placeModel.findOneAndUpdate(Object.assign({ typeOf: { $eq: factory.placeType.ScreeningRoom }, 'project.id': { $eq: screeningRoomSection.project.id }, 'containedInPlace.branchCode': { $exists: true, $eq: movieTheater.branchCode }, branchCode: { $eq: screeningRoom.branchCode }, 'containsPlace.branchCode': { $eq: screeningRoomSection.branchCode } }, (typeof ((_a = screeningRoomSection.parentOrganization) === null || _a === void 0 ? void 0 : _a.id) === 'string')
|
|
544
|
+
? { 'parentOrganization.id': { $exists: true, $eq: screeningRoomSection.parentOrganization.id } }
|
|
545
|
+
: undefined), Object.assign(Object.assign(Object.assign(Object.assign({ 'containsPlace.$[screeningRoomSection].branchCode': screeningRoomSection.branchCode }, (screeningRoomSection.name !== undefined && screeningRoomSection !== null)
|
|
532
546
|
? {
|
|
533
547
|
'containsPlace.$[screeningRoomSection].name': screeningRoomSection.name
|
|
534
548
|
}
|
|
@@ -558,7 +572,7 @@ class MongoRepository {
|
|
|
558
572
|
}
|
|
559
573
|
// tslint:disable-next-line:cyclomatic-complexity max-func-body-length
|
|
560
574
|
searchScreeningRoomSections(searchConditions) {
|
|
561
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
|
|
575
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
|
|
562
576
|
return __awaiter(this, void 0, void 0, function* () {
|
|
563
577
|
const matchStages = [{ $match: { typeOf: { $eq: factory.placeType.ScreeningRoom } } }];
|
|
564
578
|
const projectIdEq = (_b = (_a = searchConditions.project) === null || _a === void 0 ? void 0 : _a.id) === null || _b === void 0 ? void 0 : _b.$eq;
|
|
@@ -567,8 +581,14 @@ class MongoRepository {
|
|
|
567
581
|
$match: { 'project.id': { $eq: projectIdEq } }
|
|
568
582
|
});
|
|
569
583
|
}
|
|
584
|
+
const parentOrganizationIdEq = (_d = (_c = searchConditions.parentOrganization) === null || _c === void 0 ? void 0 : _c.id) === null || _d === void 0 ? void 0 : _d.$eq;
|
|
585
|
+
if (typeof parentOrganizationIdEq === 'string') {
|
|
586
|
+
matchStages.push({
|
|
587
|
+
$match: { 'parentOrganization.id': { $exists: true, $eq: parentOrganizationIdEq } }
|
|
588
|
+
});
|
|
589
|
+
}
|
|
570
590
|
// 施設コード
|
|
571
|
-
const movieTheaterBranchCodeEq = (
|
|
591
|
+
const movieTheaterBranchCodeEq = (_g = (_f = (_e = searchConditions.containedInPlace) === null || _e === void 0 ? void 0 : _e.containedInPlace) === null || _f === void 0 ? void 0 : _f.branchCode) === null || _g === void 0 ? void 0 : _g.$eq;
|
|
572
592
|
if (typeof movieTheaterBranchCodeEq === 'string') {
|
|
573
593
|
matchStages.push({
|
|
574
594
|
$match: {
|
|
@@ -580,7 +600,7 @@ class MongoRepository {
|
|
|
580
600
|
});
|
|
581
601
|
}
|
|
582
602
|
// ルームコード
|
|
583
|
-
const containedInPlaceBranchCodeEq = (
|
|
603
|
+
const containedInPlaceBranchCodeEq = (_j = (_h = searchConditions.containedInPlace) === null || _h === void 0 ? void 0 : _h.branchCode) === null || _j === void 0 ? void 0 : _j.$eq;
|
|
584
604
|
if (typeof containedInPlaceBranchCodeEq === 'string') {
|
|
585
605
|
matchStages.push({
|
|
586
606
|
$match: {
|
|
@@ -591,7 +611,7 @@ class MongoRepository {
|
|
|
591
611
|
});
|
|
592
612
|
}
|
|
593
613
|
// セクションコード
|
|
594
|
-
const sectionBranchCodeEq = (
|
|
614
|
+
const sectionBranchCodeEq = (_k = searchConditions === null || searchConditions === void 0 ? void 0 : searchConditions.branchCode) === null || _k === void 0 ? void 0 : _k.$eq;
|
|
595
615
|
if (typeof sectionBranchCodeEq === 'string') {
|
|
596
616
|
matchStages.push({
|
|
597
617
|
$match: {
|
|
@@ -602,7 +622,7 @@ class MongoRepository {
|
|
|
602
622
|
}
|
|
603
623
|
});
|
|
604
624
|
}
|
|
605
|
-
const nameCodeRegex = (
|
|
625
|
+
const nameCodeRegex = (_l = searchConditions.name) === null || _l === void 0 ? void 0 : _l.$regex;
|
|
606
626
|
if (typeof nameCodeRegex === 'string') {
|
|
607
627
|
matchStages.push({
|
|
608
628
|
$match: {
|
|
@@ -623,7 +643,7 @@ class MongoRepository {
|
|
|
623
643
|
}
|
|
624
644
|
});
|
|
625
645
|
}
|
|
626
|
-
const branchCodeRegex = (
|
|
646
|
+
const branchCodeRegex = (_m = searchConditions.branchCode) === null || _m === void 0 ? void 0 : _m.$regex;
|
|
627
647
|
if (typeof branchCodeRegex === 'string') {
|
|
628
648
|
matchStages.push({
|
|
629
649
|
$match: {
|
|
@@ -634,7 +654,7 @@ class MongoRepository {
|
|
|
634
654
|
}
|
|
635
655
|
});
|
|
636
656
|
}
|
|
637
|
-
const additionalPropertyElemMatch = (
|
|
657
|
+
const additionalPropertyElemMatch = (_o = searchConditions.additionalProperty) === null || _o === void 0 ? void 0 : _o.$elemMatch;
|
|
638
658
|
if (additionalPropertyElemMatch !== undefined && additionalPropertyElemMatch !== null) {
|
|
639
659
|
matchStages.push({
|
|
640
660
|
$match: {
|
|
@@ -659,7 +679,7 @@ class MongoRepository {
|
|
|
659
679
|
branchCode: '$containedInPlace.branchCode',
|
|
660
680
|
name: '$containedInPlace.name'
|
|
661
681
|
}
|
|
662
|
-
}, additionalProperty: '$containsPlace.additionalProperty' }, (((
|
|
682
|
+
}, additionalProperty: '$containsPlace.additionalProperty' }, (((_p = searchConditions.$projection) === null || _p === void 0 ? void 0 : _p.seatCount) === 1)
|
|
663
683
|
? {
|
|
664
684
|
seatCount: {
|
|
665
685
|
$cond: {
|
|
@@ -683,17 +703,14 @@ class MongoRepository {
|
|
|
683
703
|
});
|
|
684
704
|
}
|
|
685
705
|
deleteScreeningRoomSection(screeningRoomSection) {
|
|
706
|
+
var _a;
|
|
686
707
|
return __awaiter(this, void 0, void 0, function* () {
|
|
687
|
-
const doc = yield this.placeModel.findOneAndUpdate({
|
|
688
|
-
typeOf: { $eq: factory.placeType.ScreeningRoom },
|
|
689
|
-
'project.id': { $eq: screeningRoomSection.project.id },
|
|
690
|
-
'containedInPlace.branchCode': {
|
|
708
|
+
const doc = yield this.placeModel.findOneAndUpdate(Object.assign({ typeOf: { $eq: factory.placeType.ScreeningRoom }, 'project.id': { $eq: screeningRoomSection.project.id }, 'containedInPlace.branchCode': {
|
|
691
709
|
$exists: true,
|
|
692
710
|
$eq: screeningRoomSection.containedInPlace.containedInPlace.branchCode
|
|
693
|
-
},
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
}, {
|
|
711
|
+
}, branchCode: { $eq: screeningRoomSection.containedInPlace.branchCode }, 'containsPlace.branchCode': { $eq: screeningRoomSection.branchCode } }, (typeof ((_a = screeningRoomSection.parentOrganization) === null || _a === void 0 ? void 0 : _a.id) === 'string')
|
|
712
|
+
? { 'parentOrganization.id': { $exists: true, $eq: screeningRoomSection.parentOrganization.id } }
|
|
713
|
+
: undefined), {
|
|
697
714
|
$pull: {
|
|
698
715
|
containsPlace: {
|
|
699
716
|
branchCode: screeningRoomSection.branchCode
|
|
@@ -712,7 +729,7 @@ class MongoRepository {
|
|
|
712
729
|
}
|
|
713
730
|
// tslint:disable-next-line:cyclomatic-complexity max-func-body-length
|
|
714
731
|
searchScreeningRooms(searchConditions) {
|
|
715
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
|
|
732
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
|
|
716
733
|
return __awaiter(this, void 0, void 0, function* () {
|
|
717
734
|
const matchStages = [{ $match: { typeOf: { $eq: factory.placeType.ScreeningRoom } } }];
|
|
718
735
|
const projectIdEq = (_b = (_a = searchConditions.project) === null || _a === void 0 ? void 0 : _a.id) === null || _b === void 0 ? void 0 : _b.$eq;
|
|
@@ -721,8 +738,14 @@ class MongoRepository {
|
|
|
721
738
|
$match: { 'project.id': { $eq: projectIdEq } }
|
|
722
739
|
});
|
|
723
740
|
}
|
|
741
|
+
const parentOrganizationIdEq = (_d = (_c = searchConditions.parentOrganization) === null || _c === void 0 ? void 0 : _c.id) === null || _d === void 0 ? void 0 : _d.$eq;
|
|
742
|
+
if (typeof parentOrganizationIdEq === 'string') {
|
|
743
|
+
matchStages.push({
|
|
744
|
+
$match: { 'parentOrganization.id': { $exists: true, $eq: parentOrganizationIdEq } }
|
|
745
|
+
});
|
|
746
|
+
}
|
|
724
747
|
// 施設ID
|
|
725
|
-
const containedInPlaceIdEq = (
|
|
748
|
+
const containedInPlaceIdEq = (_f = (_e = searchConditions.containedInPlace) === null || _e === void 0 ? void 0 : _e.id) === null || _f === void 0 ? void 0 : _f.$eq;
|
|
726
749
|
if (typeof containedInPlaceIdEq === 'string') {
|
|
727
750
|
matchStages.push({
|
|
728
751
|
$match: {
|
|
@@ -748,7 +771,7 @@ class MongoRepository {
|
|
|
748
771
|
}
|
|
749
772
|
}
|
|
750
773
|
}
|
|
751
|
-
const branchCodeEq = (
|
|
774
|
+
const branchCodeEq = (_g = searchConditions.branchCode) === null || _g === void 0 ? void 0 : _g.$eq;
|
|
752
775
|
if (typeof branchCodeEq === 'string') {
|
|
753
776
|
matchStages.push({
|
|
754
777
|
$match: {
|
|
@@ -756,7 +779,7 @@ class MongoRepository {
|
|
|
756
779
|
}
|
|
757
780
|
});
|
|
758
781
|
}
|
|
759
|
-
const branchCodeIn = (
|
|
782
|
+
const branchCodeIn = (_h = searchConditions.branchCode) === null || _h === void 0 ? void 0 : _h.$in;
|
|
760
783
|
if (Array.isArray(branchCodeIn)) {
|
|
761
784
|
matchStages.push({
|
|
762
785
|
$match: {
|
|
@@ -764,7 +787,7 @@ class MongoRepository {
|
|
|
764
787
|
}
|
|
765
788
|
});
|
|
766
789
|
}
|
|
767
|
-
const branchCodeRegex = (
|
|
790
|
+
const branchCodeRegex = (_j = searchConditions.branchCode) === null || _j === void 0 ? void 0 : _j.$regex;
|
|
768
791
|
if (typeof branchCodeRegex === 'string') {
|
|
769
792
|
matchStages.push({
|
|
770
793
|
$match: {
|
|
@@ -774,7 +797,7 @@ class MongoRepository {
|
|
|
774
797
|
}
|
|
775
798
|
});
|
|
776
799
|
}
|
|
777
|
-
const nameCodeRegex = (
|
|
800
|
+
const nameCodeRegex = (_k = searchConditions.name) === null || _k === void 0 ? void 0 : _k.$regex;
|
|
778
801
|
if (typeof nameCodeRegex === 'string') {
|
|
779
802
|
matchStages.push({
|
|
780
803
|
$match: {
|
|
@@ -806,7 +829,7 @@ class MongoRepository {
|
|
|
806
829
|
}
|
|
807
830
|
});
|
|
808
831
|
}
|
|
809
|
-
const additionalPropertyElemMatch = (
|
|
832
|
+
const additionalPropertyElemMatch = (_l = searchConditions.additionalProperty) === null || _l === void 0 ? void 0 : _l.$elemMatch;
|
|
810
833
|
if (additionalPropertyElemMatch !== undefined && additionalPropertyElemMatch !== null) {
|
|
811
834
|
matchStages.push({
|
|
812
835
|
$match: {
|
|
@@ -827,7 +850,7 @@ class MongoRepository {
|
|
|
827
850
|
typeOf: '$containedInPlace.typeOf',
|
|
828
851
|
branchCode: '$containedInPlace.branchCode',
|
|
829
852
|
name: '$containedInPlace.name'
|
|
830
|
-
}, openSeatingAllowed: '$openSeatingAllowed', additionalProperty: '$additionalProperty', maximumAttendeeCapacity: '$maximumAttendeeCapacity' }, (((
|
|
853
|
+
}, openSeatingAllowed: '$openSeatingAllowed', additionalProperty: '$additionalProperty', maximumAttendeeCapacity: '$maximumAttendeeCapacity' }, (((_m = searchConditions.$projection) === null || _m === void 0 ? void 0 : _m.sectionCount) === 1)
|
|
831
854
|
? {
|
|
832
855
|
sectionCount: {
|
|
833
856
|
$cond: {
|
|
@@ -837,7 +860,7 @@ class MongoRepository {
|
|
|
837
860
|
}
|
|
838
861
|
}
|
|
839
862
|
}
|
|
840
|
-
: undefined), (((
|
|
863
|
+
: undefined), (((_o = searchConditions.$projection) === null || _o === void 0 ? void 0 : _o.seatCount) === 1)
|
|
841
864
|
? {
|
|
842
865
|
seatCount: {
|
|
843
866
|
$sum: {
|
|
@@ -871,12 +894,9 @@ class MongoRepository {
|
|
|
871
894
|
return __awaiter(this, void 0, void 0, function* () {
|
|
872
895
|
const matchStages = [
|
|
873
896
|
{ $match: { typeOf: { $eq: factory.placeType.ScreeningRoom } } },
|
|
874
|
-
{
|
|
875
|
-
|
|
876
|
-
}
|
|
877
|
-
{
|
|
878
|
-
$match: { branchCode: { $eq: params.branchCode.$eq } }
|
|
879
|
-
}
|
|
897
|
+
{ $match: { 'project.id': { $eq: params.project.id } } },
|
|
898
|
+
{ $match: { 'containedInPlace.id': { $exists: true, $eq: params.containedInPlace.id.$eq } } },
|
|
899
|
+
{ $match: { branchCode: { $eq: params.branchCode.$eq } } }
|
|
880
900
|
];
|
|
881
901
|
const aggregate = this.placeModel.aggregate([
|
|
882
902
|
// { $unwind: '$containsPlace' },
|
|
@@ -915,7 +935,7 @@ class MongoRepository {
|
|
|
915
935
|
}
|
|
916
936
|
// tslint:disable-next-line:max-func-body-length
|
|
917
937
|
createSeat(seat) {
|
|
918
|
-
var _a, _b;
|
|
938
|
+
var _a, _b, _c;
|
|
919
939
|
return __awaiter(this, void 0, void 0, function* () {
|
|
920
940
|
const screeningRoomSection = seat.containedInPlace;
|
|
921
941
|
if (typeof (screeningRoomSection === null || screeningRoomSection === void 0 ? void 0 : screeningRoomSection.branchCode) !== 'string') {
|
|
@@ -930,11 +950,9 @@ class MongoRepository {
|
|
|
930
950
|
throw new factory.errors.ArgumentNull('containedInPlace.containedInPlace.containedInPlace.branchCode');
|
|
931
951
|
}
|
|
932
952
|
// 施設存在確認
|
|
933
|
-
let doc = yield this.placeModel.findOne({
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
branchCode: { $eq: movieTheater.branchCode }
|
|
937
|
-
}, { _id: 1 })
|
|
953
|
+
let doc = yield this.placeModel.findOne(Object.assign({ typeOf: { $eq: factory.placeType.MovieTheater }, 'project.id': { $eq: seat.project.id }, branchCode: { $eq: movieTheater.branchCode } }, (typeof ((_a = seat.parentOrganization) === null || _a === void 0 ? void 0 : _a.id) === 'string')
|
|
954
|
+
? { 'parentOrganization.id': { $exists: true, $eq: seat.parentOrganization.id } }
|
|
955
|
+
: undefined), { _id: 1 })
|
|
938
956
|
.exec();
|
|
939
957
|
if (doc === null) {
|
|
940
958
|
throw new factory.errors.NotFound(factory.placeType.MovieTheater);
|
|
@@ -947,7 +965,7 @@ class MongoRepository {
|
|
|
947
965
|
'containsPlace.branchCode': { $eq: screeningRoomSection.branchCode }
|
|
948
966
|
}, {
|
|
949
967
|
$push: {
|
|
950
|
-
'containsPlace.$[screeningRoomSection].containsPlace': Object.assign(Object.assign({ typeOf: seat.typeOf, branchCode: seat.branchCode, additionalProperty: seat.additionalProperty }, (typeof ((
|
|
968
|
+
'containsPlace.$[screeningRoomSection].containsPlace': Object.assign(Object.assign({ typeOf: seat.typeOf, branchCode: seat.branchCode, additionalProperty: seat.additionalProperty }, (typeof ((_b = seat.name) === null || _b === void 0 ? void 0 : _b.ja) === 'string' || typeof ((_c = seat.name) === null || _c === void 0 ? void 0 : _c.en) === 'string') ? { name: seat.name } : undefined), (Array.isArray(seat.seatingType)) ? { seatingType: seat.seatingType } : undefined)
|
|
951
969
|
}
|
|
952
970
|
}, {
|
|
953
971
|
new: true,
|
|
@@ -969,7 +987,7 @@ class MongoRepository {
|
|
|
969
987
|
}
|
|
970
988
|
// tslint:disable-next-line:cyclomatic-complexity max-func-body-length
|
|
971
989
|
updateSeat(seat, $unset) {
|
|
972
|
-
var _a, _b;
|
|
990
|
+
var _a, _b, _c;
|
|
973
991
|
return __awaiter(this, void 0, void 0, function* () {
|
|
974
992
|
const screeningRoomSection = seat.containedInPlace;
|
|
975
993
|
if (typeof (screeningRoomSection === null || screeningRoomSection === void 0 ? void 0 : screeningRoomSection.branchCode) !== 'string') {
|
|
@@ -983,14 +1001,9 @@ class MongoRepository {
|
|
|
983
1001
|
if (typeof (movieTheater === null || movieTheater === void 0 ? void 0 : movieTheater.branchCode) !== 'string') {
|
|
984
1002
|
throw new factory.errors.ArgumentNull('containedInPlace.containedInPlace.containedInPlace.branchCode');
|
|
985
1003
|
}
|
|
986
|
-
const doc = yield this.placeModel.findOneAndUpdate({
|
|
987
|
-
|
|
988
|
-
'
|
|
989
|
-
'containedInPlace.branchCode': { $exists: true, $eq: movieTheater.branchCode },
|
|
990
|
-
branchCode: { $eq: screeningRoom.branchCode },
|
|
991
|
-
'containsPlace.branchCode': { $eq: screeningRoomSection.branchCode },
|
|
992
|
-
'containsPlace.containsPlace.branchCode': { $eq: seat.branchCode }
|
|
993
|
-
}, Object.assign(Object.assign(Object.assign(Object.assign({ 'containsPlace.$[screeningRoomSection].containsPlace.$[seat].branchCode': seat.branchCode }, (typeof ((_a = seat.name) === null || _a === void 0 ? void 0 : _a.ja) === 'string' || typeof ((_b = seat.name) === null || _b === void 0 ? void 0 : _b.en) === 'string')
|
|
1004
|
+
const doc = yield this.placeModel.findOneAndUpdate(Object.assign({ typeOf: { $eq: factory.placeType.ScreeningRoom }, 'project.id': { $eq: seat.project.id }, 'containedInPlace.branchCode': { $exists: true, $eq: movieTheater.branchCode }, branchCode: { $eq: screeningRoom.branchCode }, 'containsPlace.branchCode': { $eq: screeningRoomSection.branchCode }, 'containsPlace.containsPlace.branchCode': { $eq: seat.branchCode } }, (typeof ((_a = seat.parentOrganization) === null || _a === void 0 ? void 0 : _a.id) === 'string')
|
|
1005
|
+
? { 'parentOrganization.id': { $exists: true, $eq: seat.parentOrganization.id } }
|
|
1006
|
+
: undefined), Object.assign(Object.assign(Object.assign(Object.assign({ 'containsPlace.$[screeningRoomSection].containsPlace.$[seat].branchCode': seat.branchCode }, (typeof ((_b = seat.name) === null || _b === void 0 ? void 0 : _b.ja) === 'string' || typeof ((_c = seat.name) === null || _c === void 0 ? void 0 : _c.en) === 'string')
|
|
994
1007
|
? {
|
|
995
1008
|
'containsPlace.$[screeningRoomSection].containsPlace.$[seat].name': seat.name
|
|
996
1009
|
}
|
|
@@ -1031,7 +1044,7 @@ class MongoRepository {
|
|
|
1031
1044
|
}
|
|
1032
1045
|
// tslint:disable-next-line:cyclomatic-complexity max-func-body-length
|
|
1033
1046
|
searchSeats(params) {
|
|
1034
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
|
|
1047
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
|
|
1035
1048
|
return __awaiter(this, void 0, void 0, function* () {
|
|
1036
1049
|
const matchStages = [{ $match: { typeOf: { $eq: factory.placeType.ScreeningRoom } } }];
|
|
1037
1050
|
const projectIdEq = (_b = (_a = params.project) === null || _a === void 0 ? void 0 : _a.id) === null || _b === void 0 ? void 0 : _b.$eq;
|
|
@@ -1040,7 +1053,13 @@ class MongoRepository {
|
|
|
1040
1053
|
$match: { 'project.id': { $eq: projectIdEq } }
|
|
1041
1054
|
});
|
|
1042
1055
|
}
|
|
1043
|
-
const
|
|
1056
|
+
const parentOrganizationIdEq = (_d = (_c = params.parentOrganization) === null || _c === void 0 ? void 0 : _c.id) === null || _d === void 0 ? void 0 : _d.$eq;
|
|
1057
|
+
if (typeof parentOrganizationIdEq === 'string') {
|
|
1058
|
+
matchStages.push({
|
|
1059
|
+
$match: { 'parentOrganization.id': { $exists: true, $eq: parentOrganizationIdEq } }
|
|
1060
|
+
});
|
|
1061
|
+
}
|
|
1062
|
+
const containedInPlaceBranchCodeEq = (_f = (_e = params.containedInPlace) === null || _e === void 0 ? void 0 : _e.branchCode) === null || _f === void 0 ? void 0 : _f.$eq;
|
|
1044
1063
|
if (typeof containedInPlaceBranchCodeEq === 'string') {
|
|
1045
1064
|
matchStages.push({
|
|
1046
1065
|
$match: {
|
|
@@ -1051,7 +1070,7 @@ class MongoRepository {
|
|
|
1051
1070
|
}
|
|
1052
1071
|
});
|
|
1053
1072
|
}
|
|
1054
|
-
const containedInPlaceBranchCodeIn = (
|
|
1073
|
+
const containedInPlaceBranchCodeIn = (_h = (_g = params.containedInPlace) === null || _g === void 0 ? void 0 : _g.branchCode) === null || _h === void 0 ? void 0 : _h.$in;
|
|
1055
1074
|
if (Array.isArray(containedInPlaceBranchCodeIn)) {
|
|
1056
1075
|
matchStages.push({
|
|
1057
1076
|
$match: {
|
|
@@ -1104,7 +1123,7 @@ class MongoRepository {
|
|
|
1104
1123
|
});
|
|
1105
1124
|
}
|
|
1106
1125
|
}
|
|
1107
|
-
const branchCodeIn = (
|
|
1126
|
+
const branchCodeIn = (_j = params.branchCode) === null || _j === void 0 ? void 0 : _j.$in;
|
|
1108
1127
|
if (Array.isArray(branchCodeIn)) {
|
|
1109
1128
|
matchStages.push({
|
|
1110
1129
|
$match: {
|
|
@@ -1115,7 +1134,7 @@ class MongoRepository {
|
|
|
1115
1134
|
}
|
|
1116
1135
|
});
|
|
1117
1136
|
}
|
|
1118
|
-
const branchCodeRegex = (
|
|
1137
|
+
const branchCodeRegex = (_k = params.branchCode) === null || _k === void 0 ? void 0 : _k.$regex;
|
|
1119
1138
|
if (typeof branchCodeRegex === 'string' && branchCodeRegex.length > 0) {
|
|
1120
1139
|
matchStages.push({
|
|
1121
1140
|
$match: {
|
|
@@ -1126,7 +1145,7 @@ class MongoRepository {
|
|
|
1126
1145
|
}
|
|
1127
1146
|
});
|
|
1128
1147
|
}
|
|
1129
|
-
const nameRegex = (
|
|
1148
|
+
const nameRegex = (_l = params.name) === null || _l === void 0 ? void 0 : _l.$regex;
|
|
1130
1149
|
if (typeof nameRegex === 'string' && nameRegex.length > 0) {
|
|
1131
1150
|
matchStages.push({
|
|
1132
1151
|
$match: {
|
|
@@ -1147,7 +1166,7 @@ class MongoRepository {
|
|
|
1147
1166
|
}
|
|
1148
1167
|
});
|
|
1149
1168
|
}
|
|
1150
|
-
const seatingTypeEq = (
|
|
1169
|
+
const seatingTypeEq = (_m = params.seatingType) === null || _m === void 0 ? void 0 : _m.$eq;
|
|
1151
1170
|
if (typeof seatingTypeEq === 'string') {
|
|
1152
1171
|
matchStages.push({
|
|
1153
1172
|
$match: {
|
|
@@ -1163,7 +1182,7 @@ class MongoRepository {
|
|
|
1163
1182
|
&& params.$projection['containedInPlace.containedInPlace'] === 0) {
|
|
1164
1183
|
includeScreeningRooms = false;
|
|
1165
1184
|
}
|
|
1166
|
-
const additionalPropertyElemMatch = (
|
|
1185
|
+
const additionalPropertyElemMatch = (_o = params.additionalProperty) === null || _o === void 0 ? void 0 : _o.$elemMatch;
|
|
1167
1186
|
if (additionalPropertyElemMatch !== undefined && additionalPropertyElemMatch !== null) {
|
|
1168
1187
|
matchStages.push({
|
|
1169
1188
|
$match: {
|
|
@@ -1214,18 +1233,14 @@ class MongoRepository {
|
|
|
1214
1233
|
});
|
|
1215
1234
|
}
|
|
1216
1235
|
deleteSeat(seat) {
|
|
1236
|
+
var _a;
|
|
1217
1237
|
return __awaiter(this, void 0, void 0, function* () {
|
|
1218
|
-
const doc = yield this.placeModel.findOneAndUpdate({
|
|
1219
|
-
typeOf: { $eq: factory.placeType.ScreeningRoom },
|
|
1220
|
-
'project.id': { $eq: seat.project.id },
|
|
1221
|
-
'containedInPlace.branchCode': {
|
|
1238
|
+
const doc = yield this.placeModel.findOneAndUpdate(Object.assign({ typeOf: { $eq: factory.placeType.ScreeningRoom }, 'project.id': { $eq: seat.project.id }, 'containedInPlace.branchCode': {
|
|
1222
1239
|
$exists: true,
|
|
1223
1240
|
$eq: seat.containedInPlace.containedInPlace.containedInPlace.branchCode
|
|
1224
|
-
},
|
|
1225
|
-
|
|
1226
|
-
|
|
1227
|
-
'containsPlace.containsPlace.branchCode': { $eq: seat.branchCode }
|
|
1228
|
-
}, {
|
|
1241
|
+
}, branchCode: { $eq: seat.containedInPlace.containedInPlace.branchCode }, 'containsPlace.branchCode': { $eq: seat.containedInPlace.branchCode }, 'containsPlace.containsPlace.branchCode': { $eq: seat.branchCode } }, (typeof ((_a = seat.parentOrganization) === null || _a === void 0 ? void 0 : _a.id) === 'string')
|
|
1242
|
+
? { 'parentOrganization.id': { $exists: true, $eq: seat.parentOrganization.id } }
|
|
1243
|
+
: undefined), {
|
|
1229
1244
|
$pull: {
|
|
1230
1245
|
'containsPlace.$[screeningRoomSection].containsPlace': {
|
|
1231
1246
|
branchCode: seat.branchCode
|
|
@@ -1245,77 +1260,6 @@ class MongoRepository {
|
|
|
1245
1260
|
return doc.toObject();
|
|
1246
1261
|
});
|
|
1247
1262
|
}
|
|
1248
|
-
// tslint:disable-next-line:prefer-function-over-method
|
|
1249
|
-
syncScreeningRooms(__) {
|
|
1250
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
1251
|
-
return;
|
|
1252
|
-
// const movieTheater = <Pick<
|
|
1253
|
-
// factory.place.movieTheater.IPlace,
|
|
1254
|
-
// 'id' | 'branchCode' | 'name' | 'project' | 'typeOf' | 'containsPlace'
|
|
1255
|
-
// >>await this.placeModel.findOne({
|
|
1256
|
-
// _id: { $eq: params.id },
|
|
1257
|
-
// typeOf: { $eq: factory.placeType.MovieTheater }
|
|
1258
|
-
// })
|
|
1259
|
-
// .select({
|
|
1260
|
-
// _id: 1, branchCode: 1, name: 1, project: 1, typeOf: 1, containsPlace: 1
|
|
1261
|
-
// })
|
|
1262
|
-
// .exec()
|
|
1263
|
-
// .then((doc) => {
|
|
1264
|
-
// if (doc === null) {
|
|
1265
|
-
// throw new factory.errors.NotFound(factory.placeType.MovieTheater);
|
|
1266
|
-
// }
|
|
1267
|
-
// return doc.toObject();
|
|
1268
|
-
// });
|
|
1269
|
-
// let screeningRoomsFromMovieTheater = movieTheater.containsPlace;
|
|
1270
|
-
// if (typeof params.screeningRoomBranchCode === 'string' && params.screeningRoomBranchCode.length > 0) {
|
|
1271
|
-
// screeningRoomsFromMovieTheater = screeningRoomsFromMovieTheater.filter(
|
|
1272
|
-
// (place) => place.branchCode === params.screeningRoomBranchCode
|
|
1273
|
-
// );
|
|
1274
|
-
// }
|
|
1275
|
-
// const creatingScreeningRooms: ICreatingScreeningRoom[] = screeningRoomsFromMovieTheater.map((place) => {
|
|
1276
|
-
// return {
|
|
1277
|
-
// ...place,
|
|
1278
|
-
// containedInPlace: {
|
|
1279
|
-
// id: movieTheater.id,
|
|
1280
|
-
// typeOf: movieTheater.typeOf,
|
|
1281
|
-
// branchCode: movieTheater.branchCode,
|
|
1282
|
-
// name: movieTheater.name
|
|
1283
|
-
// },
|
|
1284
|
-
// containsPlace: (Array.isArray(place.containsPlace)) ? place.containsPlace : [],
|
|
1285
|
-
// project: movieTheater.project
|
|
1286
|
-
// };
|
|
1287
|
-
// });
|
|
1288
|
-
// debug('sync processing', creatingScreeningRooms.length, 'screeningRooms...', creatingScreeningRooms);
|
|
1289
|
-
// await Promise.all(creatingScreeningRooms.map(async (createScreeningRoom) => {
|
|
1290
|
-
// const { typeOf, project, branchCode, ...setFields } = createScreeningRoom;
|
|
1291
|
-
// if (typeof branchCode === 'string' && branchCode.length > 0) {
|
|
1292
|
-
// const upsertScreeningRoomResult = await this.placeModel.findOneAndUpdate(
|
|
1293
|
-
// {
|
|
1294
|
-
// typeOf: { $eq: factory.placeType.ScreeningRoom },
|
|
1295
|
-
// 'project.id': { $eq: createScreeningRoom.project.id },
|
|
1296
|
-
// 'containedInPlace.id': { $exists: true, $eq: createScreeningRoom.containedInPlace.id },
|
|
1297
|
-
// branchCode: { $eq: createScreeningRoom.branchCode }
|
|
1298
|
-
// },
|
|
1299
|
-
// {
|
|
1300
|
-
// $setOnInsert: {
|
|
1301
|
-
// typeOf: createScreeningRoom.typeOf,
|
|
1302
|
-
// project: createScreeningRoom.project,
|
|
1303
|
-
// branchCode: createScreeningRoom.branchCode
|
|
1304
|
-
// },
|
|
1305
|
-
// $set: setFields
|
|
1306
|
-
// },
|
|
1307
|
-
// {
|
|
1308
|
-
// upsert: true,
|
|
1309
|
-
// new: true,
|
|
1310
|
-
// projection: { _id: 1 }
|
|
1311
|
-
// }
|
|
1312
|
-
// )
|
|
1313
|
-
// .exec();
|
|
1314
|
-
// debug('screeningRoom upserted. upsertScreeningRoomResult:', upsertScreeningRoomResult);
|
|
1315
|
-
// }
|
|
1316
|
-
// }));
|
|
1317
|
-
});
|
|
1318
|
-
}
|
|
1319
1263
|
unsetContainsPlaceFromMovieTheater(params) {
|
|
1320
1264
|
return __awaiter(this, void 0, void 0, function* () {
|
|
1321
1265
|
return this.placeModel.findOneAndUpdate({
|
|
@@ -1420,7 +1364,8 @@ class MongoRepository {
|
|
|
1420
1364
|
return __awaiter(this, void 0, void 0, function* () {
|
|
1421
1365
|
yield this.placeModel.findOneAndDelete({
|
|
1422
1366
|
typeOf: { $eq: factory.placeType.BusStop },
|
|
1423
|
-
_id: { $eq: params.id }
|
|
1367
|
+
_id: { $eq: params.id },
|
|
1368
|
+
'project.id': { $eq: params.project.id }
|
|
1424
1369
|
})
|
|
1425
1370
|
.exec()
|
|
1426
1371
|
.then((doc) => {
|
|
@@ -37,9 +37,7 @@ export declare class MongoRepository {
|
|
|
37
37
|
static CREATE_MONGO_CONDITIONS(params: factory.product.ISearchConditions): any[];
|
|
38
38
|
findById(conditions: {
|
|
39
39
|
id: string;
|
|
40
|
-
},
|
|
41
|
-
[key: string]: number;
|
|
42
|
-
}): Promise<IProduct>;
|
|
40
|
+
}, inclusion: string[], exclusion: string[]): Promise<IProduct>;
|
|
43
41
|
search(conditions: factory.product.ISearchConditions, inclusion: string[], exclusion: string[]): Promise<IProduct[]>;
|
|
44
42
|
deleteById(params: {
|
|
45
43
|
id: string;
|
|
@@ -64,7 +62,7 @@ export declare class MongoRepository {
|
|
|
64
62
|
* idを指定すれば更新
|
|
65
63
|
*/
|
|
66
64
|
id?: string;
|
|
67
|
-
attributes: factory.product.IProduct;
|
|
65
|
+
attributes: factory.product.IProduct | factory.service.paymentService.IService;
|
|
68
66
|
/**
|
|
69
67
|
* 指定プロジェクトの指定プロダクトタイプが存在しなければ作成する
|
|
70
68
|
*/
|