@chevre/domain 21.2.0-alpha.144 → 21.2.0-alpha.146
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/findScreeningRoomsByBranchCode.ts +4 -3
- package/example/src/chevre/searchPermissions.ts +54 -0
- package/example/src/chevre/searchScreeningRooms.ts +2 -1
- package/example/src/chevre/syncScreeningRoomsAll.ts +1 -1
- package/lib/chevre/repo/member.d.ts +14 -0
- package/lib/chevre/repo/member.js +27 -0
- package/lib/chevre/repo/place.d.ts +13 -12
- package/lib/chevre/repo/place.js +478 -367
- package/lib/chevre/repo/role.d.ts +7 -0
- package/lib/chevre/repo/role.js +36 -0
- package/lib/chevre/service/aggregation/event/aggregateScreeningEvent.js +2 -1
- package/lib/chevre/service/assetTransaction/reserve.js +1 -1
- package/lib/chevre/service/event.js +2 -1
- package/lib/chevre/service/iam.d.ts +6 -2
- package/lib/chevre/service/iam.js +23 -9
- package/lib/chevre/service/offer.js +1 -1
- package/lib/chevre/service/task/onResourceUpdated.js +1 -6
- package/lib/chevre/settings.d.ts +2 -0
- package/lib/chevre/settings.js +3 -1
- package/package.json +1 -1
package/lib/chevre/repo/place.js
CHANGED
|
@@ -414,109 +414,130 @@ class MongoRepository {
|
|
|
414
414
|
});
|
|
415
415
|
});
|
|
416
416
|
}
|
|
417
|
-
createScreeningRoom(screeningRoom) {
|
|
417
|
+
createScreeningRoom(screeningRoom, useScreeningRoomType) {
|
|
418
418
|
return __awaiter(this, void 0, void 0, function* () {
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
branchCode: screeningRoom.containedInPlace.branchCode
|
|
424
|
-
}, {
|
|
425
|
-
_id: 1
|
|
426
|
-
})
|
|
427
|
-
.exec();
|
|
428
|
-
if (doc === null) {
|
|
429
|
-
throw new factory.errors.NotFound('containedInPlace');
|
|
419
|
+
if (useScreeningRoomType === true) {
|
|
420
|
+
// tslint:disable-next-line:no-suspicious-comment
|
|
421
|
+
// TODO implement
|
|
422
|
+
throw new factory.errors.NotImplemented('useScreeningRoomType not implemented');
|
|
430
423
|
}
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
424
|
+
else {
|
|
425
|
+
// 施設存在確認
|
|
426
|
+
let doc = yield this.placeModel.findOne({
|
|
427
|
+
typeOf: { $eq: factory.placeType.MovieTheater },
|
|
428
|
+
'project.id': { $eq: screeningRoom.project.id },
|
|
429
|
+
branchCode: screeningRoom.containedInPlace.branchCode
|
|
430
|
+
}, {
|
|
431
|
+
_id: 1
|
|
432
|
+
})
|
|
433
|
+
.exec();
|
|
434
|
+
if (doc === null) {
|
|
435
|
+
throw new factory.errors.NotFound('containedInPlace');
|
|
436
|
+
}
|
|
437
|
+
// ルームコードが存在しなければ追加する
|
|
438
|
+
doc = yield this.placeModel.findOneAndUpdate({
|
|
439
|
+
typeOf: { $eq: factory.placeType.MovieTheater },
|
|
440
|
+
'project.id': { $eq: screeningRoom.project.id },
|
|
441
|
+
branchCode: screeningRoom.containedInPlace.branchCode,
|
|
442
|
+
'containsPlace.branchCode': { $ne: screeningRoom.branchCode }
|
|
443
|
+
}, {
|
|
444
|
+
$push: {
|
|
445
|
+
containsPlace: {
|
|
446
|
+
typeOf: screeningRoom.typeOf,
|
|
447
|
+
branchCode: screeningRoom.branchCode,
|
|
448
|
+
name: screeningRoom.name,
|
|
449
|
+
address: screeningRoom.address,
|
|
450
|
+
additionalProperty: screeningRoom.additionalProperty
|
|
451
|
+
}
|
|
445
452
|
}
|
|
453
|
+
}, {
|
|
454
|
+
new: true,
|
|
455
|
+
projection: {
|
|
456
|
+
_id: 1,
|
|
457
|
+
// 'project.id': 1,
|
|
458
|
+
branchCode: 1,
|
|
459
|
+
typeOf: 1
|
|
460
|
+
}
|
|
461
|
+
})
|
|
462
|
+
.exec();
|
|
463
|
+
// 存在しなければコード重複
|
|
464
|
+
if (doc === null) {
|
|
465
|
+
throw new factory.errors.AlreadyInUse(factory.placeType.ScreeningRoom, ['branchCode']);
|
|
446
466
|
}
|
|
447
|
-
|
|
448
|
-
new: true,
|
|
449
|
-
projection: {
|
|
450
|
-
_id: 1,
|
|
451
|
-
// 'project.id': 1,
|
|
452
|
-
branchCode: 1,
|
|
453
|
-
typeOf: 1
|
|
454
|
-
}
|
|
455
|
-
})
|
|
456
|
-
.exec();
|
|
457
|
-
// 存在しなければコード重複
|
|
458
|
-
if (doc === null) {
|
|
459
|
-
throw new factory.errors.AlreadyInUse(factory.placeType.ScreeningRoom, ['branchCode']);
|
|
467
|
+
return doc.toObject();
|
|
460
468
|
}
|
|
461
|
-
return doc.toObject();
|
|
462
469
|
});
|
|
463
470
|
}
|
|
464
|
-
updateScreeningRoom(screeningRoom, $unset) {
|
|
471
|
+
updateScreeningRoom(screeningRoom, $unset, useScreeningRoomType) {
|
|
465
472
|
return __awaiter(this, void 0, void 0, function* () {
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
:
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
{ 'screeningRoom.
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
473
|
+
if (useScreeningRoomType === true) {
|
|
474
|
+
// tslint:disable-next-line:no-suspicious-comment
|
|
475
|
+
// TODO implement
|
|
476
|
+
throw new factory.errors.NotImplemented('useScreeningRoomType not implemented');
|
|
477
|
+
}
|
|
478
|
+
else {
|
|
479
|
+
const doc = yield this.placeModel.findOneAndUpdate({
|
|
480
|
+
typeOf: { $eq: factory.placeType.MovieTheater },
|
|
481
|
+
'project.id': { $eq: screeningRoom.project.id },
|
|
482
|
+
branchCode: screeningRoom.containedInPlace.branchCode,
|
|
483
|
+
'containsPlace.branchCode': screeningRoom.branchCode
|
|
484
|
+
}, Object.assign(Object.assign(Object.assign(Object.assign({ 'containsPlace.$[screeningRoom].name': screeningRoom.name }, (screeningRoom.address !== undefined && screeningRoom.address !== null)
|
|
485
|
+
? { 'containsPlace.$[screeningRoom].address': screeningRoom.address }
|
|
486
|
+
: undefined), (typeof screeningRoom.openSeatingAllowed === 'boolean')
|
|
487
|
+
? { 'containsPlace.$[screeningRoom].openSeatingAllowed': screeningRoom.openSeatingAllowed }
|
|
488
|
+
: undefined), (Array.isArray(screeningRoom.additionalProperty))
|
|
489
|
+
? { 'containsPlace.$[screeningRoom].additionalProperty': screeningRoom.additionalProperty }
|
|
490
|
+
: undefined), ($unset !== undefined && $unset !== null)
|
|
491
|
+
? { $unset }
|
|
492
|
+
: undefined), {
|
|
493
|
+
new: true,
|
|
494
|
+
arrayFilters: [
|
|
495
|
+
{ 'screeningRoom.branchCode': screeningRoom.branchCode }
|
|
496
|
+
],
|
|
497
|
+
projection: {
|
|
498
|
+
_id: 1,
|
|
499
|
+
// 'project.id': 1,
|
|
500
|
+
branchCode: 1,
|
|
501
|
+
typeOf: 1
|
|
502
|
+
}
|
|
503
|
+
})
|
|
504
|
+
.exec();
|
|
505
|
+
if (doc === null) {
|
|
506
|
+
throw new factory.errors.NotFound(factory.placeType.ScreeningRoom);
|
|
489
507
|
}
|
|
490
|
-
|
|
491
|
-
.exec();
|
|
492
|
-
if (doc === null) {
|
|
493
|
-
throw new factory.errors.NotFound(factory.placeType.ScreeningRoom);
|
|
508
|
+
return doc.toObject();
|
|
494
509
|
}
|
|
495
|
-
return doc.toObject();
|
|
496
510
|
});
|
|
497
511
|
}
|
|
498
|
-
deleteScreeningRoom(screeningRoom) {
|
|
512
|
+
deleteScreeningRoom(screeningRoom, useScreeningRoomType) {
|
|
499
513
|
return __awaiter(this, void 0, void 0, function* () {
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
514
|
+
if (useScreeningRoomType === true) {
|
|
515
|
+
// tslint:disable-next-line:no-suspicious-comment
|
|
516
|
+
// TODO implement
|
|
517
|
+
throw new factory.errors.NotImplemented('useScreeningRoomType not implemented');
|
|
518
|
+
}
|
|
519
|
+
else {
|
|
520
|
+
const doc = yield this.placeModel.findOneAndUpdate({
|
|
521
|
+
typeOf: { $eq: factory.placeType.MovieTheater },
|
|
522
|
+
'project.id': { $eq: screeningRoom.project.id },
|
|
523
|
+
branchCode: screeningRoom.containedInPlace.branchCode,
|
|
524
|
+
'containsPlace.branchCode': screeningRoom.branchCode
|
|
525
|
+
}, {
|
|
526
|
+
$pull: {
|
|
527
|
+
containsPlace: { branchCode: screeningRoom.branchCode }
|
|
528
|
+
}
|
|
529
|
+
}, {
|
|
530
|
+
projection: {
|
|
531
|
+
_id: 1,
|
|
532
|
+
typeOf: 1
|
|
533
|
+
}
|
|
534
|
+
})
|
|
535
|
+
.exec();
|
|
536
|
+
if (doc === null) {
|
|
537
|
+
throw new factory.errors.NotFound(factory.placeType.ScreeningRoom);
|
|
513
538
|
}
|
|
514
|
-
|
|
515
|
-
.exec();
|
|
516
|
-
if (doc === null) {
|
|
517
|
-
throw new factory.errors.NotFound(factory.placeType.ScreeningRoom);
|
|
539
|
+
return doc.toObject();
|
|
518
540
|
}
|
|
519
|
-
return doc.toObject();
|
|
520
541
|
});
|
|
521
542
|
}
|
|
522
543
|
deleteScreeningRoomsByMovieTheaterId(params) {
|
|
@@ -529,106 +550,120 @@ class MongoRepository {
|
|
|
529
550
|
.exec();
|
|
530
551
|
});
|
|
531
552
|
}
|
|
532
|
-
createScreeningRoomSection(screeningRoomSection) {
|
|
553
|
+
createScreeningRoomSection(screeningRoomSection, useScreeningRoomType) {
|
|
533
554
|
return __awaiter(this, void 0, void 0, function* () {
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
const movieTheater = screeningRoom.containedInPlace;
|
|
539
|
-
if (typeof (movieTheater === null || movieTheater === void 0 ? void 0 : movieTheater.branchCode) !== 'string') {
|
|
540
|
-
throw new factory.errors.ArgumentNull('containedInPlace.containedInPlace.branchCode');
|
|
541
|
-
}
|
|
542
|
-
// 施設存在確認
|
|
543
|
-
let doc = yield this.placeModel.findOne({
|
|
544
|
-
typeOf: { $eq: factory.placeType.MovieTheater },
|
|
545
|
-
'project.id': { $eq: screeningRoomSection.project.id },
|
|
546
|
-
branchCode: movieTheater.branchCode,
|
|
547
|
-
'containsPlace.branchCode': screeningRoom.branchCode
|
|
548
|
-
}, { _id: 1 })
|
|
549
|
-
.exec();
|
|
550
|
-
if (doc === null) {
|
|
551
|
-
throw new factory.errors.NotFound(factory.placeType.MovieTheater);
|
|
555
|
+
if (useScreeningRoomType === true) {
|
|
556
|
+
// tslint:disable-next-line:no-suspicious-comment
|
|
557
|
+
// TODO implement
|
|
558
|
+
throw new factory.errors.NotImplemented('useScreeningRoomType not implemented');
|
|
552
559
|
}
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
560
|
+
else {
|
|
561
|
+
const screeningRoom = screeningRoomSection.containedInPlace;
|
|
562
|
+
if (typeof (screeningRoom === null || screeningRoom === void 0 ? void 0 : screeningRoom.branchCode) !== 'string') {
|
|
563
|
+
throw new factory.errors.ArgumentNull('containedInPlace.branchCode');
|
|
564
|
+
}
|
|
565
|
+
const movieTheater = screeningRoom.containedInPlace;
|
|
566
|
+
if (typeof (movieTheater === null || movieTheater === void 0 ? void 0 : movieTheater.branchCode) !== 'string') {
|
|
567
|
+
throw new factory.errors.ArgumentNull('containedInPlace.containedInPlace.branchCode');
|
|
568
|
+
}
|
|
569
|
+
// 施設存在確認
|
|
570
|
+
let doc = yield this.placeModel.findOne({
|
|
571
|
+
typeOf: { $eq: factory.placeType.MovieTheater },
|
|
572
|
+
'project.id': { $eq: screeningRoomSection.project.id },
|
|
573
|
+
branchCode: movieTheater.branchCode,
|
|
574
|
+
'containsPlace.branchCode': screeningRoom.branchCode
|
|
575
|
+
}, { _id: 1 })
|
|
576
|
+
.exec();
|
|
577
|
+
if (doc === null) {
|
|
578
|
+
throw new factory.errors.NotFound(factory.placeType.MovieTheater);
|
|
579
|
+
}
|
|
580
|
+
doc = yield this.placeModel.findOneAndUpdate({
|
|
581
|
+
typeOf: { $eq: factory.placeType.MovieTheater },
|
|
582
|
+
'project.id': { $eq: screeningRoomSection.project.id },
|
|
583
|
+
branchCode: movieTheater.branchCode,
|
|
584
|
+
'containsPlace.branchCode': screeningRoom.branchCode
|
|
585
|
+
// 'containsPlace.containsPlace.branchCode': { $ne: screeningRoomSection.branchCode }
|
|
586
|
+
}, {
|
|
587
|
+
$push: {
|
|
588
|
+
'containsPlace.$[screeningRoom].containsPlace': Object.assign({ typeOf: screeningRoomSection.typeOf, branchCode: screeningRoomSection.branchCode, name: screeningRoomSection.name }, (Array.isArray(screeningRoomSection.additionalProperty))
|
|
589
|
+
? { additionalProperty: screeningRoomSection.additionalProperty }
|
|
590
|
+
: undefined)
|
|
571
591
|
}
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
592
|
+
}, {
|
|
593
|
+
new: true,
|
|
594
|
+
arrayFilters: [
|
|
595
|
+
{
|
|
596
|
+
'screeningRoom.branchCode': screeningRoom.branchCode,
|
|
597
|
+
'screeningRoom.containsPlace.branchCode': { $ne: screeningRoomSection.branchCode }
|
|
598
|
+
}
|
|
599
|
+
],
|
|
600
|
+
projection: {
|
|
601
|
+
_id: 1,
|
|
602
|
+
typeOf: 1
|
|
603
|
+
}
|
|
604
|
+
})
|
|
605
|
+
.exec();
|
|
606
|
+
// 存在しなければコード重複
|
|
607
|
+
if (doc === null) {
|
|
608
|
+
throw new factory.errors.AlreadyInUse(factory.placeType.ScreeningRoomSection, ['branchCode']);
|
|
576
609
|
}
|
|
577
|
-
|
|
578
|
-
.exec();
|
|
579
|
-
// 存在しなければコード重複
|
|
580
|
-
if (doc === null) {
|
|
581
|
-
throw new factory.errors.AlreadyInUse(factory.placeType.ScreeningRoomSection, ['branchCode']);
|
|
610
|
+
return doc.toObject();
|
|
582
611
|
}
|
|
583
|
-
return doc.toObject();
|
|
584
612
|
});
|
|
585
613
|
}
|
|
586
|
-
updateScreeningRoomSection(screeningRoomSection, $unset) {
|
|
614
|
+
updateScreeningRoomSection(screeningRoomSection, $unset, useScreeningRoomType) {
|
|
587
615
|
return __awaiter(this, void 0, void 0, function* () {
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
const movieTheater = screeningRoom.containedInPlace;
|
|
593
|
-
if (typeof (movieTheater === null || movieTheater === void 0 ? void 0 : movieTheater.branchCode) !== 'string') {
|
|
594
|
-
throw new factory.errors.ArgumentNull('containedInPlace.containedInPlace.branchCode');
|
|
616
|
+
if (useScreeningRoomType === true) {
|
|
617
|
+
// tslint:disable-next-line:no-suspicious-comment
|
|
618
|
+
// TODO implement
|
|
619
|
+
throw new factory.errors.NotImplemented('useScreeningRoomType not implemented');
|
|
595
620
|
}
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
}
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
{
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
621
|
+
else {
|
|
622
|
+
const screeningRoom = screeningRoomSection.containedInPlace;
|
|
623
|
+
if (typeof (screeningRoom === null || screeningRoom === void 0 ? void 0 : screeningRoom.branchCode) !== 'string') {
|
|
624
|
+
throw new factory.errors.ArgumentNull('containedInPlace.branchCode');
|
|
625
|
+
}
|
|
626
|
+
const movieTheater = screeningRoom.containedInPlace;
|
|
627
|
+
if (typeof (movieTheater === null || movieTheater === void 0 ? void 0 : movieTheater.branchCode) !== 'string') {
|
|
628
|
+
throw new factory.errors.ArgumentNull('containedInPlace.containedInPlace.branchCode');
|
|
629
|
+
}
|
|
630
|
+
const doc = yield this.placeModel.findOneAndUpdate({
|
|
631
|
+
typeOf: { $eq: factory.placeType.MovieTheater },
|
|
632
|
+
'project.id': { $eq: screeningRoomSection.project.id },
|
|
633
|
+
branchCode: movieTheater.branchCode,
|
|
634
|
+
'containsPlace.branchCode': screeningRoom.branchCode,
|
|
635
|
+
'containsPlace.containsPlace.branchCode': screeningRoomSection.branchCode
|
|
636
|
+
}, Object.assign(Object.assign(Object.assign(Object.assign({ 'containsPlace.$[screeningRoom].containsPlace.$[screeningRoomSection].branchCode': screeningRoomSection.branchCode }, (screeningRoomSection.name !== undefined && screeningRoomSection !== null)
|
|
637
|
+
? {
|
|
638
|
+
'containsPlace.$[screeningRoom].containsPlace.$[screeningRoomSection].name': screeningRoomSection.name
|
|
639
|
+
}
|
|
640
|
+
: undefined), (Array.isArray(screeningRoomSection.additionalProperty))
|
|
641
|
+
? {
|
|
642
|
+
'containsPlace.$[screeningRoom].containsPlace.$[screeningRoomSection].additionalProperty': screeningRoomSection.additionalProperty
|
|
643
|
+
}
|
|
644
|
+
: undefined), (Array.isArray(screeningRoomSection.containsPlace) && screeningRoomSection.containsPlace.length > 0)
|
|
645
|
+
? {
|
|
646
|
+
'containsPlace.$[screeningRoom].containsPlace.$[screeningRoomSection].containsPlace': screeningRoomSection.containsPlace.map((p) => {
|
|
647
|
+
return Object.assign(Object.assign(Object.assign({ typeOf: p.typeOf, branchCode: p.branchCode }, (p.name !== undefined && p.name !== null) ? { name: p.name } : undefined), (Array.isArray(p.seatingType)) ? { seatingType: p.seatingType } : undefined), (Array.isArray(p.additionalProperty)) ? { additionalProperty: p.additionalProperty } : undefined);
|
|
648
|
+
})
|
|
649
|
+
}
|
|
650
|
+
: undefined), ($unset !== undefined && $unset !== null) ? { $unset } : undefined), {
|
|
651
|
+
new: true,
|
|
652
|
+
arrayFilters: [
|
|
653
|
+
{ 'screeningRoom.branchCode': screeningRoom.branchCode },
|
|
654
|
+
{ 'screeningRoomSection.branchCode': screeningRoomSection.branchCode }
|
|
655
|
+
],
|
|
656
|
+
projection: {
|
|
657
|
+
_id: 1,
|
|
658
|
+
typeOf: 1
|
|
659
|
+
}
|
|
660
|
+
})
|
|
661
|
+
.exec();
|
|
662
|
+
if (doc === null) {
|
|
663
|
+
throw new factory.errors.NotFound(factory.placeType.ScreeningRoomSection);
|
|
625
664
|
}
|
|
626
|
-
|
|
627
|
-
.exec();
|
|
628
|
-
if (doc === null) {
|
|
629
|
-
throw new factory.errors.NotFound(factory.placeType.ScreeningRoomSection);
|
|
665
|
+
return doc.toObject();
|
|
630
666
|
}
|
|
631
|
-
return doc.toObject();
|
|
632
667
|
});
|
|
633
668
|
}
|
|
634
669
|
// tslint:disable-next-line:cyclomatic-complexity max-func-body-length
|
|
@@ -636,7 +671,7 @@ class MongoRepository {
|
|
|
636
671
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z;
|
|
637
672
|
return __awaiter(this, void 0, void 0, function* () {
|
|
638
673
|
if (useScreeningRoomType === true) {
|
|
639
|
-
const matchStages = [{ $match: { typeOf: { $eq: factory.placeType.
|
|
674
|
+
const matchStages = [{ $match: { typeOf: { $eq: factory.placeType.ScreeningRoom } } }];
|
|
640
675
|
const projectIdEq = (_b = (_a = searchConditions.project) === null || _a === void 0 ? void 0 : _a.id) === null || _b === void 0 ? void 0 : _b.$eq;
|
|
641
676
|
if (typeof projectIdEq === 'string') {
|
|
642
677
|
matchStages.push({
|
|
@@ -884,35 +919,42 @@ class MongoRepository {
|
|
|
884
919
|
}
|
|
885
920
|
});
|
|
886
921
|
}
|
|
887
|
-
deleteScreeningRoomSection(screeningRoomSection) {
|
|
922
|
+
deleteScreeningRoomSection(screeningRoomSection, useScreeningRoomType) {
|
|
888
923
|
return __awaiter(this, void 0, void 0, function* () {
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
'
|
|
898
|
-
|
|
924
|
+
if (useScreeningRoomType === true) {
|
|
925
|
+
// tslint:disable-next-line:no-suspicious-comment
|
|
926
|
+
// TODO implement
|
|
927
|
+
throw new factory.errors.NotImplemented('useScreeningRoomType not implemented');
|
|
928
|
+
}
|
|
929
|
+
else {
|
|
930
|
+
const doc = yield this.placeModel.findOneAndUpdate({
|
|
931
|
+
typeOf: { $eq: factory.placeType.MovieTheater },
|
|
932
|
+
'project.id': { $eq: screeningRoomSection.project.id },
|
|
933
|
+
branchCode: screeningRoomSection.containedInPlace.containedInPlace.branchCode,
|
|
934
|
+
'containsPlace.branchCode': screeningRoomSection.containedInPlace.branchCode,
|
|
935
|
+
'containsPlace.containsPlace.branchCode': screeningRoomSection.branchCode
|
|
936
|
+
}, {
|
|
937
|
+
$pull: {
|
|
938
|
+
'containsPlace.$[screeningRoom].containsPlace': {
|
|
939
|
+
branchCode: screeningRoomSection.branchCode
|
|
940
|
+
}
|
|
899
941
|
}
|
|
942
|
+
}, {
|
|
943
|
+
new: true,
|
|
944
|
+
arrayFilters: [
|
|
945
|
+
{ 'screeningRoom.branchCode': screeningRoomSection.containedInPlace.branchCode }
|
|
946
|
+
],
|
|
947
|
+
projection: {
|
|
948
|
+
_id: 1,
|
|
949
|
+
typeOf: 1
|
|
950
|
+
}
|
|
951
|
+
})
|
|
952
|
+
.exec();
|
|
953
|
+
if (doc === null) {
|
|
954
|
+
throw new factory.errors.NotFound(factory.placeType.ScreeningRoomSection);
|
|
900
955
|
}
|
|
901
|
-
|
|
902
|
-
new: true,
|
|
903
|
-
arrayFilters: [
|
|
904
|
-
{ 'screeningRoom.branchCode': screeningRoomSection.containedInPlace.branchCode }
|
|
905
|
-
],
|
|
906
|
-
projection: {
|
|
907
|
-
_id: 1,
|
|
908
|
-
typeOf: 1
|
|
909
|
-
}
|
|
910
|
-
})
|
|
911
|
-
.exec();
|
|
912
|
-
if (doc === null) {
|
|
913
|
-
throw new factory.errors.NotFound(factory.placeType.ScreeningRoomSection);
|
|
956
|
+
return doc.toObject();
|
|
914
957
|
}
|
|
915
|
-
return doc.toObject();
|
|
916
958
|
});
|
|
917
959
|
}
|
|
918
960
|
// tslint:disable-next-line:cyclomatic-complexity max-func-body-length
|
|
@@ -1227,166 +1269,228 @@ class MongoRepository {
|
|
|
1227
1269
|
}
|
|
1228
1270
|
findScreeningRoomsByBranchCode(params) {
|
|
1229
1271
|
return __awaiter(this, void 0, void 0, function* () {
|
|
1230
|
-
|
|
1231
|
-
|
|
1232
|
-
|
|
1233
|
-
|
|
1234
|
-
|
|
1235
|
-
|
|
1236
|
-
|
|
1237
|
-
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
|
-
|
|
1241
|
-
|
|
1242
|
-
|
|
1243
|
-
$
|
|
1244
|
-
|
|
1245
|
-
|
|
1246
|
-
|
|
1247
|
-
|
|
1248
|
-
|
|
1249
|
-
|
|
1250
|
-
|
|
1251
|
-
|
|
1252
|
-
|
|
1253
|
-
|
|
1254
|
-
|
|
1255
|
-
|
|
1256
|
-
|
|
1257
|
-
|
|
1272
|
+
if (params.useScreeningRoomType === true) {
|
|
1273
|
+
// tslint:disable-next-line:no-suspicious-comment
|
|
1274
|
+
// TODO implement
|
|
1275
|
+
const matchStages = [
|
|
1276
|
+
{ $match: { typeOf: { $eq: factory.placeType.ScreeningRoom } } },
|
|
1277
|
+
{
|
|
1278
|
+
$match: { 'containedInPlace.id': { $exists: true, $eq: params.containedInPlace.id.$eq } }
|
|
1279
|
+
},
|
|
1280
|
+
{
|
|
1281
|
+
$match: { branchCode: { $eq: params.branchCode.$eq } }
|
|
1282
|
+
}
|
|
1283
|
+
];
|
|
1284
|
+
const aggregate = this.placeModel.aggregate([
|
|
1285
|
+
// { $unwind: '$containsPlace' },
|
|
1286
|
+
...matchStages,
|
|
1287
|
+
{
|
|
1288
|
+
$project: {
|
|
1289
|
+
_id: 0,
|
|
1290
|
+
typeOf: '$typeOf',
|
|
1291
|
+
branchCode: '$branchCode',
|
|
1292
|
+
name: '$name',
|
|
1293
|
+
containsPlace: '$containsPlace',
|
|
1294
|
+
seatCount: {
|
|
1295
|
+
$sum: {
|
|
1296
|
+
$map: {
|
|
1297
|
+
input: '$containsPlace',
|
|
1298
|
+
in: {
|
|
1299
|
+
$cond: {
|
|
1300
|
+
if: { $isArray: '$$this.containsPlace' },
|
|
1301
|
+
then: { $size: '$$this.containsPlace' },
|
|
1302
|
+
else: 0
|
|
1303
|
+
}
|
|
1258
1304
|
}
|
|
1259
1305
|
}
|
|
1260
1306
|
}
|
|
1261
1307
|
}
|
|
1262
1308
|
}
|
|
1263
1309
|
}
|
|
1310
|
+
]);
|
|
1311
|
+
const docs = yield aggregate.limit(1)
|
|
1312
|
+
.exec();
|
|
1313
|
+
if (docs.length < 1) {
|
|
1314
|
+
throw new factory.errors.NotFound(factory.placeType.ScreeningRoom);
|
|
1264
1315
|
}
|
|
1265
|
-
|
|
1266
|
-
|
|
1267
|
-
|
|
1268
|
-
|
|
1269
|
-
|
|
1316
|
+
return docs[0];
|
|
1317
|
+
}
|
|
1318
|
+
else {
|
|
1319
|
+
const matchStages = [
|
|
1320
|
+
{ $match: { typeOf: { $eq: factory.placeType.MovieTheater } } },
|
|
1321
|
+
{
|
|
1322
|
+
$match: { _id: { $eq: new mongoose_1.Types.ObjectId(params.containedInPlace.id.$eq) } }
|
|
1323
|
+
},
|
|
1324
|
+
{
|
|
1325
|
+
$match: { 'containsPlace.branchCode': { $exists: true, $eq: params.branchCode.$eq } }
|
|
1326
|
+
}
|
|
1327
|
+
];
|
|
1328
|
+
const aggregate = this.placeModel.aggregate([
|
|
1329
|
+
{ $unwind: '$containsPlace' },
|
|
1330
|
+
...matchStages,
|
|
1331
|
+
{
|
|
1332
|
+
$project: {
|
|
1333
|
+
_id: 0,
|
|
1334
|
+
typeOf: '$containsPlace.typeOf',
|
|
1335
|
+
branchCode: '$containsPlace.branchCode',
|
|
1336
|
+
name: '$containsPlace.name',
|
|
1337
|
+
containsPlace: '$containsPlace.containsPlace',
|
|
1338
|
+
seatCount: {
|
|
1339
|
+
$sum: {
|
|
1340
|
+
$map: {
|
|
1341
|
+
input: '$containsPlace.containsPlace',
|
|
1342
|
+
in: {
|
|
1343
|
+
$cond: {
|
|
1344
|
+
if: { $isArray: '$$this.containsPlace' },
|
|
1345
|
+
then: { $size: '$$this.containsPlace' },
|
|
1346
|
+
else: 0
|
|
1347
|
+
}
|
|
1348
|
+
}
|
|
1349
|
+
}
|
|
1350
|
+
}
|
|
1351
|
+
}
|
|
1352
|
+
}
|
|
1353
|
+
}
|
|
1354
|
+
]);
|
|
1355
|
+
const docs = yield aggregate.limit(1)
|
|
1356
|
+
.exec();
|
|
1357
|
+
if (docs.length < 1) {
|
|
1358
|
+
throw new factory.errors.NotFound(factory.placeType.ScreeningRoom);
|
|
1359
|
+
}
|
|
1360
|
+
return docs[0];
|
|
1270
1361
|
}
|
|
1271
|
-
return docs[0];
|
|
1272
1362
|
});
|
|
1273
1363
|
}
|
|
1274
|
-
createSeat(seat) {
|
|
1364
|
+
createSeat(seat, useScreeningRoomType) {
|
|
1275
1365
|
var _a, _b;
|
|
1276
1366
|
return __awaiter(this, void 0, void 0, function* () {
|
|
1277
|
-
|
|
1278
|
-
|
|
1279
|
-
|
|
1280
|
-
|
|
1281
|
-
const screeningRoom = screeningRoomSection.containedInPlace;
|
|
1282
|
-
if (typeof (screeningRoom === null || screeningRoom === void 0 ? void 0 : screeningRoom.branchCode) !== 'string') {
|
|
1283
|
-
throw new factory.errors.ArgumentNull('containedInPlace.containedInPlace.branchCode');
|
|
1284
|
-
}
|
|
1285
|
-
const movieTheater = screeningRoom.containedInPlace;
|
|
1286
|
-
if (typeof (movieTheater === null || movieTheater === void 0 ? void 0 : movieTheater.branchCode) !== 'string') {
|
|
1287
|
-
throw new factory.errors.ArgumentNull('containedInPlace.containedInPlace.containedInPlace.branchCode');
|
|
1288
|
-
}
|
|
1289
|
-
// 施設存在確認
|
|
1290
|
-
let doc = yield this.placeModel.findOne({
|
|
1291
|
-
typeOf: { $eq: factory.placeType.MovieTheater },
|
|
1292
|
-
'project.id': { $eq: seat.project.id },
|
|
1293
|
-
branchCode: movieTheater.branchCode,
|
|
1294
|
-
'containsPlace.branchCode': screeningRoom.branchCode,
|
|
1295
|
-
'containsPlace.containsPlace.branchCode': screeningRoomSection.branchCode
|
|
1296
|
-
}, {
|
|
1297
|
-
_id: 1
|
|
1298
|
-
})
|
|
1299
|
-
.exec();
|
|
1300
|
-
if (doc === null) {
|
|
1301
|
-
throw new factory.errors.NotFound(factory.placeType.MovieTheater);
|
|
1367
|
+
if (useScreeningRoomType === true) {
|
|
1368
|
+
// tslint:disable-next-line:no-suspicious-comment
|
|
1369
|
+
// TODO implement
|
|
1370
|
+
throw new factory.errors.NotImplemented('useScreeningRoomType not implemented');
|
|
1302
1371
|
}
|
|
1303
|
-
|
|
1304
|
-
|
|
1305
|
-
|
|
1306
|
-
|
|
1307
|
-
|
|
1308
|
-
|
|
1309
|
-
|
|
1310
|
-
|
|
1311
|
-
|
|
1312
|
-
|
|
1313
|
-
|
|
1314
|
-
|
|
1315
|
-
|
|
1316
|
-
|
|
1317
|
-
|
|
1318
|
-
|
|
1319
|
-
|
|
1372
|
+
else {
|
|
1373
|
+
const screeningRoomSection = seat.containedInPlace;
|
|
1374
|
+
if (typeof (screeningRoomSection === null || screeningRoomSection === void 0 ? void 0 : screeningRoomSection.branchCode) !== 'string') {
|
|
1375
|
+
throw new factory.errors.ArgumentNull('containedInPlace.branchCode');
|
|
1376
|
+
}
|
|
1377
|
+
const screeningRoom = screeningRoomSection.containedInPlace;
|
|
1378
|
+
if (typeof (screeningRoom === null || screeningRoom === void 0 ? void 0 : screeningRoom.branchCode) !== 'string') {
|
|
1379
|
+
throw new factory.errors.ArgumentNull('containedInPlace.containedInPlace.branchCode');
|
|
1380
|
+
}
|
|
1381
|
+
const movieTheater = screeningRoom.containedInPlace;
|
|
1382
|
+
if (typeof (movieTheater === null || movieTheater === void 0 ? void 0 : movieTheater.branchCode) !== 'string') {
|
|
1383
|
+
throw new factory.errors.ArgumentNull('containedInPlace.containedInPlace.containedInPlace.branchCode');
|
|
1384
|
+
}
|
|
1385
|
+
// 施設存在確認
|
|
1386
|
+
let doc = yield this.placeModel.findOne({
|
|
1387
|
+
typeOf: { $eq: factory.placeType.MovieTheater },
|
|
1388
|
+
'project.id': { $eq: seat.project.id },
|
|
1389
|
+
branchCode: movieTheater.branchCode,
|
|
1390
|
+
'containsPlace.branchCode': screeningRoom.branchCode,
|
|
1391
|
+
'containsPlace.containsPlace.branchCode': screeningRoomSection.branchCode
|
|
1392
|
+
}, {
|
|
1393
|
+
_id: 1
|
|
1394
|
+
})
|
|
1395
|
+
.exec();
|
|
1396
|
+
if (doc === null) {
|
|
1397
|
+
throw new factory.errors.NotFound(factory.placeType.MovieTheater);
|
|
1398
|
+
}
|
|
1399
|
+
doc = yield this.placeModel.findOneAndUpdate({
|
|
1400
|
+
typeOf: { $eq: factory.placeType.MovieTheater },
|
|
1401
|
+
'project.id': { $eq: seat.project.id },
|
|
1402
|
+
branchCode: movieTheater.branchCode,
|
|
1403
|
+
'containsPlace.branchCode': screeningRoom.branchCode,
|
|
1404
|
+
'containsPlace.containsPlace.branchCode': screeningRoomSection.branchCode
|
|
1405
|
+
}, {
|
|
1406
|
+
$push: {
|
|
1407
|
+
'containsPlace.$[screeningRoom].containsPlace.$[screeningRoomSection].containsPlace': Object.assign(Object.assign({ typeOf: seat.typeOf, branchCode: seat.branchCode, additionalProperty: seat.additionalProperty }, (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') ? { name: seat.name } : undefined), (Array.isArray(seat.seatingType)) ? { seatingType: seat.seatingType } : undefined)
|
|
1408
|
+
}
|
|
1409
|
+
}, {
|
|
1410
|
+
new: true,
|
|
1411
|
+
arrayFilters: [
|
|
1412
|
+
{ 'screeningRoom.branchCode': screeningRoom.branchCode },
|
|
1413
|
+
{
|
|
1414
|
+
'screeningRoomSection.branchCode': screeningRoomSection.branchCode,
|
|
1415
|
+
'screeningRoomSection.containsPlace.branchCode': { $ne: seat.branchCode }
|
|
1416
|
+
}
|
|
1417
|
+
],
|
|
1418
|
+
projection: {
|
|
1419
|
+
_id: 1,
|
|
1420
|
+
// 'project.id': 1,
|
|
1421
|
+
branchCode: 1,
|
|
1422
|
+
typeOf: 1
|
|
1320
1423
|
}
|
|
1321
|
-
|
|
1322
|
-
|
|
1323
|
-
|
|
1324
|
-
|
|
1325
|
-
|
|
1326
|
-
typeOf: 1
|
|
1424
|
+
})
|
|
1425
|
+
.exec();
|
|
1426
|
+
// 存在しなければコード重複
|
|
1427
|
+
if (doc === null) {
|
|
1428
|
+
throw new factory.errors.AlreadyInUse(factory.placeType.Seat, ['branchCode']);
|
|
1327
1429
|
}
|
|
1328
|
-
|
|
1329
|
-
.exec();
|
|
1330
|
-
// 存在しなければコード重複
|
|
1331
|
-
if (doc === null) {
|
|
1332
|
-
throw new factory.errors.AlreadyInUse(factory.placeType.Seat, ['branchCode']);
|
|
1430
|
+
return doc.toObject();
|
|
1333
1431
|
}
|
|
1334
|
-
return doc.toObject();
|
|
1335
1432
|
});
|
|
1336
1433
|
}
|
|
1337
|
-
updateSeat(seat, $unset) {
|
|
1434
|
+
updateSeat(seat, $unset, useScreeningRoomType) {
|
|
1338
1435
|
var _a, _b;
|
|
1339
1436
|
return __awaiter(this, void 0, void 0, function* () {
|
|
1340
|
-
|
|
1341
|
-
|
|
1342
|
-
|
|
1343
|
-
|
|
1344
|
-
const screeningRoom = screeningRoomSection.containedInPlace;
|
|
1345
|
-
if (typeof (screeningRoom === null || screeningRoom === void 0 ? void 0 : screeningRoom.branchCode) !== 'string') {
|
|
1346
|
-
throw new factory.errors.ArgumentNull('containedInPlace.containedInPlace.branchCode');
|
|
1347
|
-
}
|
|
1348
|
-
const movieTheater = screeningRoom.containedInPlace;
|
|
1349
|
-
if (typeof (movieTheater === null || movieTheater === void 0 ? void 0 : movieTheater.branchCode) !== 'string') {
|
|
1350
|
-
throw new factory.errors.ArgumentNull('containedInPlace.containedInPlace.containedInPlace.branchCode');
|
|
1437
|
+
if (useScreeningRoomType === true) {
|
|
1438
|
+
// tslint:disable-next-line:no-suspicious-comment
|
|
1439
|
+
// TODO implement
|
|
1440
|
+
throw new factory.errors.NotImplemented('useScreeningRoomType not implemented');
|
|
1351
1441
|
}
|
|
1352
|
-
|
|
1353
|
-
|
|
1354
|
-
|
|
1355
|
-
|
|
1356
|
-
|
|
1357
|
-
|
|
1358
|
-
|
|
1359
|
-
|
|
1360
|
-
|
|
1361
|
-
|
|
1362
|
-
|
|
1363
|
-
|
|
1364
|
-
|
|
1365
|
-
|
|
1366
|
-
|
|
1367
|
-
|
|
1368
|
-
|
|
1369
|
-
'containsPlace
|
|
1370
|
-
|
|
1371
|
-
|
|
1372
|
-
|
|
1373
|
-
|
|
1374
|
-
|
|
1375
|
-
|
|
1376
|
-
|
|
1377
|
-
|
|
1378
|
-
|
|
1379
|
-
|
|
1380
|
-
|
|
1381
|
-
|
|
1382
|
-
|
|
1442
|
+
else {
|
|
1443
|
+
const screeningRoomSection = seat.containedInPlace;
|
|
1444
|
+
if (typeof (screeningRoomSection === null || screeningRoomSection === void 0 ? void 0 : screeningRoomSection.branchCode) !== 'string') {
|
|
1445
|
+
throw new factory.errors.ArgumentNull('containedInPlace.branchCode');
|
|
1446
|
+
}
|
|
1447
|
+
const screeningRoom = screeningRoomSection.containedInPlace;
|
|
1448
|
+
if (typeof (screeningRoom === null || screeningRoom === void 0 ? void 0 : screeningRoom.branchCode) !== 'string') {
|
|
1449
|
+
throw new factory.errors.ArgumentNull('containedInPlace.containedInPlace.branchCode');
|
|
1450
|
+
}
|
|
1451
|
+
const movieTheater = screeningRoom.containedInPlace;
|
|
1452
|
+
if (typeof (movieTheater === null || movieTheater === void 0 ? void 0 : movieTheater.branchCode) !== 'string') {
|
|
1453
|
+
throw new factory.errors.ArgumentNull('containedInPlace.containedInPlace.containedInPlace.branchCode');
|
|
1454
|
+
}
|
|
1455
|
+
const doc = yield this.placeModel.findOneAndUpdate({
|
|
1456
|
+
typeOf: { $eq: factory.placeType.MovieTheater },
|
|
1457
|
+
'project.id': { $eq: seat.project.id },
|
|
1458
|
+
branchCode: movieTheater.branchCode,
|
|
1459
|
+
'containsPlace.branchCode': screeningRoom.branchCode,
|
|
1460
|
+
'containsPlace.containsPlace.branchCode': screeningRoomSection.branchCode,
|
|
1461
|
+
'containsPlace.containsPlace.containsPlace.branchCode': seat.branchCode
|
|
1462
|
+
}, Object.assign(Object.assign(Object.assign(Object.assign({ 'containsPlace.$[screeningRoom].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')
|
|
1463
|
+
? {
|
|
1464
|
+
'containsPlace.$[screeningRoom].containsPlace.$[screeningRoomSection].containsPlace.$[seat].name': seat.name
|
|
1465
|
+
}
|
|
1466
|
+
: undefined), (Array.isArray(seat.seatingType))
|
|
1467
|
+
? {
|
|
1468
|
+
'containsPlace.$[screeningRoom].containsPlace.$[screeningRoomSection].containsPlace.$[seat].seatingType': seat.seatingType
|
|
1469
|
+
}
|
|
1470
|
+
: undefined), (Array.isArray(seat.additionalProperty))
|
|
1471
|
+
? {
|
|
1472
|
+
'containsPlace.$[screeningRoom].containsPlace.$[screeningRoomSection].containsPlace.$[seat].additionalProperty': seat.additionalProperty
|
|
1473
|
+
}
|
|
1474
|
+
: undefined), ($unset !== undefined && $unset !== null) ? { $unset } : undefined), {
|
|
1475
|
+
new: true,
|
|
1476
|
+
arrayFilters: [
|
|
1477
|
+
{ 'screeningRoom.branchCode': screeningRoom.branchCode },
|
|
1478
|
+
{ 'screeningRoomSection.branchCode': screeningRoomSection.branchCode },
|
|
1479
|
+
{ 'seat.branchCode': seat.branchCode }
|
|
1480
|
+
],
|
|
1481
|
+
projection: {
|
|
1482
|
+
_id: 1,
|
|
1483
|
+
// 'project.id': 1,
|
|
1484
|
+
branchCode: 1,
|
|
1485
|
+
typeOf: 1
|
|
1486
|
+
}
|
|
1487
|
+
})
|
|
1488
|
+
.exec();
|
|
1489
|
+
if (doc === null) {
|
|
1490
|
+
throw new factory.errors.NotFound(factory.placeType.Seat);
|
|
1383
1491
|
}
|
|
1384
|
-
|
|
1385
|
-
.exec();
|
|
1386
|
-
if (doc === null) {
|
|
1387
|
-
throw new factory.errors.NotFound(factory.placeType.Seat);
|
|
1492
|
+
return doc.toObject();
|
|
1388
1493
|
}
|
|
1389
|
-
return doc.toObject();
|
|
1390
1494
|
});
|
|
1391
1495
|
}
|
|
1392
1496
|
// tslint:disable-next-line:cyclomatic-complexity max-func-body-length
|
|
@@ -1757,37 +1861,44 @@ class MongoRepository {
|
|
|
1757
1861
|
}
|
|
1758
1862
|
});
|
|
1759
1863
|
}
|
|
1760
|
-
deleteSeat(seat) {
|
|
1864
|
+
deleteSeat(seat, useScreeningRoomType) {
|
|
1761
1865
|
return __awaiter(this, void 0, void 0, function* () {
|
|
1762
|
-
|
|
1763
|
-
|
|
1764
|
-
|
|
1765
|
-
|
|
1766
|
-
|
|
1767
|
-
|
|
1768
|
-
|
|
1769
|
-
|
|
1770
|
-
|
|
1771
|
-
|
|
1772
|
-
|
|
1866
|
+
if (useScreeningRoomType === true) {
|
|
1867
|
+
// tslint:disable-next-line:no-suspicious-comment
|
|
1868
|
+
// TODO implement
|
|
1869
|
+
throw new factory.errors.NotImplemented('useScreeningRoomType not implemented');
|
|
1870
|
+
}
|
|
1871
|
+
else {
|
|
1872
|
+
const doc = yield this.placeModel.findOneAndUpdate({
|
|
1873
|
+
typeOf: { $eq: factory.placeType.MovieTheater },
|
|
1874
|
+
'project.id': { $eq: seat.project.id },
|
|
1875
|
+
branchCode: seat.containedInPlace.containedInPlace.containedInPlace.branchCode,
|
|
1876
|
+
'containsPlace.branchCode': seat.containedInPlace.containedInPlace.branchCode,
|
|
1877
|
+
'containsPlace.containsPlace.branchCode': seat.containedInPlace.branchCode,
|
|
1878
|
+
'containsPlace.containsPlace.containsPlace.branchCode': seat.branchCode
|
|
1879
|
+
}, {
|
|
1880
|
+
$pull: {
|
|
1881
|
+
'containsPlace.$[screeningRoom].containsPlace.$[screeningRoomSection].containsPlace': {
|
|
1882
|
+
branchCode: seat.branchCode
|
|
1883
|
+
}
|
|
1773
1884
|
}
|
|
1885
|
+
}, {
|
|
1886
|
+
new: true,
|
|
1887
|
+
arrayFilters: [
|
|
1888
|
+
{ 'screeningRoom.branchCode': seat.containedInPlace.containedInPlace.branchCode },
|
|
1889
|
+
{ 'screeningRoomSection.branchCode': seat.containedInPlace.branchCode }
|
|
1890
|
+
],
|
|
1891
|
+
projection: {
|
|
1892
|
+
_id: 1,
|
|
1893
|
+
typeOf: 1
|
|
1894
|
+
}
|
|
1895
|
+
})
|
|
1896
|
+
.exec();
|
|
1897
|
+
if (doc === null) {
|
|
1898
|
+
throw new factory.errors.NotFound(factory.placeType.Seat);
|
|
1774
1899
|
}
|
|
1775
|
-
|
|
1776
|
-
new: true,
|
|
1777
|
-
arrayFilters: [
|
|
1778
|
-
{ 'screeningRoom.branchCode': seat.containedInPlace.containedInPlace.branchCode },
|
|
1779
|
-
{ 'screeningRoomSection.branchCode': seat.containedInPlace.branchCode }
|
|
1780
|
-
],
|
|
1781
|
-
projection: {
|
|
1782
|
-
_id: 1,
|
|
1783
|
-
typeOf: 1
|
|
1784
|
-
}
|
|
1785
|
-
})
|
|
1786
|
-
.exec();
|
|
1787
|
-
if (doc === null) {
|
|
1788
|
-
throw new factory.errors.NotFound(factory.placeType.Seat);
|
|
1900
|
+
return doc.toObject();
|
|
1789
1901
|
}
|
|
1790
|
-
return doc.toObject();
|
|
1791
1902
|
});
|
|
1792
1903
|
}
|
|
1793
1904
|
syncScreeningRooms(params) {
|