@chevre/domain 21.2.0-alpha.147 → 21.2.0-alpha.148
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/lib/chevre/repo/place.d.ts +30 -8
- package/lib/chevre/repo/place.js +89 -40
- package/package.json +1 -1
|
@@ -61,10 +61,12 @@ export declare class MongoRepository {
|
|
|
61
61
|
id: string;
|
|
62
62
|
typeOf: factory.placeType.MovieTheater;
|
|
63
63
|
} | {
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
64
|
+
containedInPlace: {
|
|
65
|
+
/**
|
|
66
|
+
* 施設ID
|
|
67
|
+
*/
|
|
68
|
+
id: string;
|
|
69
|
+
};
|
|
68
70
|
typeOf: factory.placeType.ScreeningRoom;
|
|
69
71
|
}>;
|
|
70
72
|
updateScreeningRoom(screeningRoom: Omit<factory.place.screeningRoom.IPlace, 'containedInPlace' | 'containsPlace'> & {
|
|
@@ -78,10 +80,12 @@ export declare class MongoRepository {
|
|
|
78
80
|
id: string;
|
|
79
81
|
typeOf: factory.placeType.MovieTheater;
|
|
80
82
|
} | {
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
83
|
+
containedInPlace: {
|
|
84
|
+
/**
|
|
85
|
+
* 施設ID
|
|
86
|
+
*/
|
|
87
|
+
id: string;
|
|
88
|
+
};
|
|
85
89
|
typeOf: factory.placeType.ScreeningRoom;
|
|
86
90
|
}>;
|
|
87
91
|
deleteScreeningRoom(screeningRoom: {
|
|
@@ -105,6 +109,12 @@ export declare class MongoRepository {
|
|
|
105
109
|
id: string;
|
|
106
110
|
typeOf: factory.placeType.MovieTheater;
|
|
107
111
|
} | {
|
|
112
|
+
containedInPlace: {
|
|
113
|
+
/**
|
|
114
|
+
* 施設ID
|
|
115
|
+
*/
|
|
116
|
+
id: string;
|
|
117
|
+
};
|
|
108
118
|
typeOf: factory.placeType.ScreeningRoom;
|
|
109
119
|
}>;
|
|
110
120
|
deleteScreeningRoomsByMovieTheaterId(params: {
|
|
@@ -124,6 +134,12 @@ export declare class MongoRepository {
|
|
|
124
134
|
*/
|
|
125
135
|
id: string;
|
|
126
136
|
typeOf: factory.placeType.MovieTheater;
|
|
137
|
+
} | {
|
|
138
|
+
/**
|
|
139
|
+
* ルームID
|
|
140
|
+
*/
|
|
141
|
+
id: string;
|
|
142
|
+
typeOf: factory.placeType.ScreeningRoom;
|
|
127
143
|
}>;
|
|
128
144
|
updateScreeningRoomSection(screeningRoomSection: Omit<factory.place.screeningRoomSection.IPlace, 'containedInPlace'> & {
|
|
129
145
|
containedInPlace: {
|
|
@@ -138,6 +154,12 @@ export declare class MongoRepository {
|
|
|
138
154
|
*/
|
|
139
155
|
id: string;
|
|
140
156
|
typeOf: factory.placeType.MovieTheater;
|
|
157
|
+
} | {
|
|
158
|
+
/**
|
|
159
|
+
* ルームID
|
|
160
|
+
*/
|
|
161
|
+
id: string;
|
|
162
|
+
typeOf: factory.placeType.ScreeningRoom;
|
|
141
163
|
}>;
|
|
142
164
|
searchScreeningRoomSections(searchConditions: factory.place.screeningRoomSection.ISearchConditions & {
|
|
143
165
|
$projection?: {
|
package/lib/chevre/repo/place.js
CHANGED
|
@@ -450,7 +450,7 @@ class MongoRepository {
|
|
|
450
450
|
throw new factory.errors.AlreadyInUse(factory.placeType.ScreeningRoom, ['branchCode']);
|
|
451
451
|
}
|
|
452
452
|
return {
|
|
453
|
-
id:
|
|
453
|
+
containedInPlace: { id: creatingScreeningRoom.containedInPlace.id },
|
|
454
454
|
typeOf: factory.placeType.ScreeningRoom
|
|
455
455
|
};
|
|
456
456
|
}
|
|
@@ -511,16 +511,13 @@ class MongoRepository {
|
|
|
511
511
|
}
|
|
512
512
|
: undefined), {
|
|
513
513
|
new: true,
|
|
514
|
-
projection: {
|
|
514
|
+
projection: { 'containedInPlace.id': 1, typeOf: 1 }
|
|
515
515
|
})
|
|
516
516
|
.exec();
|
|
517
517
|
if (doc === null) {
|
|
518
518
|
throw new factory.errors.NotFound(factory.placeType.ScreeningRoom);
|
|
519
519
|
}
|
|
520
|
-
return
|
|
521
|
-
branchCode: screeningRoom.branchCode,
|
|
522
|
-
typeOf: factory.placeType.ScreeningRoom
|
|
523
|
-
};
|
|
520
|
+
return doc.toObject();
|
|
524
521
|
}
|
|
525
522
|
else {
|
|
526
523
|
const doc = yield this.placeModel.findOneAndUpdate({
|
|
@@ -563,12 +560,14 @@ class MongoRepository {
|
|
|
563
560
|
'project.id': { $eq: screeningRoom.project.id },
|
|
564
561
|
'containedInPlace.branchCode': { $exists: true, $eq: screeningRoom.containedInPlace.branchCode },
|
|
565
562
|
branchCode: screeningRoom.branchCode
|
|
566
|
-
}, {
|
|
563
|
+
}, {
|
|
564
|
+
projection: { 'containedInPlace.id': 1, typeOf: 1 }
|
|
565
|
+
})
|
|
567
566
|
.exec();
|
|
568
567
|
if (doc === null) {
|
|
569
568
|
throw new factory.errors.NotFound(factory.placeType.ScreeningRoom);
|
|
570
569
|
}
|
|
571
|
-
return
|
|
570
|
+
return doc.toObject();
|
|
572
571
|
}
|
|
573
572
|
else {
|
|
574
573
|
const doc = yield this.placeModel.findOneAndUpdate({
|
|
@@ -604,39 +603,59 @@ class MongoRepository {
|
|
|
604
603
|
.exec();
|
|
605
604
|
});
|
|
606
605
|
}
|
|
606
|
+
// tslint:disable-next-line:max-func-body-length
|
|
607
607
|
createScreeningRoomSection(screeningRoomSection, useScreeningRoomType) {
|
|
608
608
|
return __awaiter(this, void 0, void 0, function* () {
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
throw new factory.errors.NotImplemented('useScreeningRoomType not implemented');
|
|
609
|
+
const screeningRoom = screeningRoomSection.containedInPlace;
|
|
610
|
+
if (typeof (screeningRoom === null || screeningRoom === void 0 ? void 0 : screeningRoom.branchCode) !== 'string') {
|
|
611
|
+
throw new factory.errors.ArgumentNull('containedInPlace.branchCode');
|
|
613
612
|
}
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
613
|
+
const movieTheater = screeningRoom.containedInPlace;
|
|
614
|
+
if (typeof (movieTheater === null || movieTheater === void 0 ? void 0 : movieTheater.branchCode) !== 'string') {
|
|
615
|
+
throw new factory.errors.ArgumentNull('containedInPlace.containedInPlace.branchCode');
|
|
616
|
+
}
|
|
617
|
+
// 施設存在確認
|
|
618
|
+
let doc = yield this.placeModel.findOne({
|
|
619
|
+
typeOf: { $eq: factory.placeType.MovieTheater },
|
|
620
|
+
'project.id': { $eq: screeningRoomSection.project.id },
|
|
621
|
+
branchCode: movieTheater.branchCode,
|
|
622
|
+
'containsPlace.branchCode': screeningRoom.branchCode
|
|
623
|
+
}, { _id: 1 })
|
|
624
|
+
.exec();
|
|
625
|
+
if (doc === null) {
|
|
626
|
+
throw new factory.errors.NotFound(factory.placeType.MovieTheater);
|
|
627
|
+
}
|
|
628
|
+
if (useScreeningRoomType === true) {
|
|
629
|
+
// セクションコードが存在しなければ追加する
|
|
630
|
+
doc = yield this.placeModel.findOneAndUpdate({
|
|
631
|
+
typeOf: { $eq: factory.placeType.ScreeningRoom },
|
|
626
632
|
'project.id': { $eq: screeningRoomSection.project.id },
|
|
627
|
-
branchCode: movieTheater.branchCode,
|
|
628
|
-
|
|
629
|
-
|
|
633
|
+
'containedInPlace.branchCode': { $exists: true, $eq: movieTheater.branchCode },
|
|
634
|
+
branchCode: screeningRoom.branchCode,
|
|
635
|
+
'containsPlace.branchCode': { $ne: screeningRoomSection.branchCode }
|
|
636
|
+
}, {
|
|
637
|
+
$push: {
|
|
638
|
+
containsPlace: Object.assign({ typeOf: screeningRoomSection.typeOf, branchCode: screeningRoomSection.branchCode, name: screeningRoomSection.name }, (Array.isArray(screeningRoomSection.additionalProperty))
|
|
639
|
+
? { additionalProperty: screeningRoomSection.additionalProperty }
|
|
640
|
+
: undefined)
|
|
641
|
+
}
|
|
642
|
+
}, {
|
|
643
|
+
new: true,
|
|
644
|
+
projection: { _id: 1, typeOf: 1 }
|
|
645
|
+
})
|
|
630
646
|
.exec();
|
|
647
|
+
// 存在しなければコード重複
|
|
631
648
|
if (doc === null) {
|
|
632
|
-
throw new factory.errors.
|
|
649
|
+
throw new factory.errors.AlreadyInUse(factory.placeType.ScreeningRoomSection, ['branchCode']);
|
|
633
650
|
}
|
|
651
|
+
return doc.toObject();
|
|
652
|
+
}
|
|
653
|
+
else {
|
|
634
654
|
doc = yield this.placeModel.findOneAndUpdate({
|
|
635
655
|
typeOf: { $eq: factory.placeType.MovieTheater },
|
|
636
656
|
'project.id': { $eq: screeningRoomSection.project.id },
|
|
637
657
|
branchCode: movieTheater.branchCode,
|
|
638
658
|
'containsPlace.branchCode': screeningRoom.branchCode
|
|
639
|
-
// 'containsPlace.containsPlace.branchCode': { $ne: screeningRoomSection.branchCode }
|
|
640
659
|
}, {
|
|
641
660
|
$push: {
|
|
642
661
|
'containsPlace.$[screeningRoom].containsPlace': Object.assign({ typeOf: screeningRoomSection.typeOf, branchCode: screeningRoomSection.branchCode, name: screeningRoomSection.name }, (Array.isArray(screeningRoomSection.additionalProperty))
|
|
@@ -665,22 +684,52 @@ class MongoRepository {
|
|
|
665
684
|
}
|
|
666
685
|
});
|
|
667
686
|
}
|
|
687
|
+
// tslint:disable-next-line:max-func-body-length
|
|
668
688
|
updateScreeningRoomSection(screeningRoomSection, $unset, useScreeningRoomType) {
|
|
669
689
|
return __awaiter(this, void 0, void 0, function* () {
|
|
690
|
+
const screeningRoom = screeningRoomSection.containedInPlace;
|
|
691
|
+
if (typeof (screeningRoom === null || screeningRoom === void 0 ? void 0 : screeningRoom.branchCode) !== 'string') {
|
|
692
|
+
throw new factory.errors.ArgumentNull('containedInPlace.branchCode');
|
|
693
|
+
}
|
|
694
|
+
const movieTheater = screeningRoom.containedInPlace;
|
|
695
|
+
if (typeof (movieTheater === null || movieTheater === void 0 ? void 0 : movieTheater.branchCode) !== 'string') {
|
|
696
|
+
throw new factory.errors.ArgumentNull('containedInPlace.containedInPlace.branchCode');
|
|
697
|
+
}
|
|
670
698
|
if (useScreeningRoomType === true) {
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
699
|
+
const doc = yield this.placeModel.findOneAndUpdate({
|
|
700
|
+
typeOf: { $eq: factory.placeType.ScreeningRoom },
|
|
701
|
+
'project.id': { $eq: screeningRoomSection.project.id },
|
|
702
|
+
'containedInPlace.branchCode': { $exists: true, $eq: movieTheater.branchCode },
|
|
703
|
+
branchCode: { $eq: screeningRoom.branchCode },
|
|
704
|
+
'containsPlace.branchCode': { $eq: screeningRoomSection.branchCode }
|
|
705
|
+
}, Object.assign(Object.assign(Object.assign(Object.assign({ 'containsPlace.$[screeningRoomSection].branchCode': screeningRoomSection.branchCode }, (screeningRoomSection.name !== undefined && screeningRoomSection !== null)
|
|
706
|
+
? {
|
|
707
|
+
'containsPlace.$[screeningRoomSection].name': screeningRoomSection.name
|
|
708
|
+
}
|
|
709
|
+
: undefined), (Array.isArray(screeningRoomSection.additionalProperty))
|
|
710
|
+
? {
|
|
711
|
+
'containsPlace.$[screeningRoomSection].additionalProperty': screeningRoomSection.additionalProperty
|
|
712
|
+
}
|
|
713
|
+
: undefined), (Array.isArray(screeningRoomSection.containsPlace) && screeningRoomSection.containsPlace.length > 0)
|
|
714
|
+
? {
|
|
715
|
+
'containsPlace.$[screeningRoomSection].containsPlace': screeningRoomSection.containsPlace.map((p) => {
|
|
716
|
+
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);
|
|
717
|
+
})
|
|
718
|
+
}
|
|
719
|
+
: undefined), ($unset !== undefined && $unset !== null) ? { $unset } : undefined), {
|
|
720
|
+
new: true,
|
|
721
|
+
arrayFilters: [
|
|
722
|
+
{ 'screeningRoomSection.branchCode': screeningRoomSection.branchCode }
|
|
723
|
+
],
|
|
724
|
+
projection: { _id: 1, typeOf: 1 }
|
|
725
|
+
})
|
|
726
|
+
.exec();
|
|
727
|
+
if (doc === null) {
|
|
728
|
+
throw new factory.errors.NotFound(factory.placeType.ScreeningRoomSection);
|
|
729
|
+
}
|
|
730
|
+
return doc.toObject();
|
|
674
731
|
}
|
|
675
732
|
else {
|
|
676
|
-
const screeningRoom = screeningRoomSection.containedInPlace;
|
|
677
|
-
if (typeof (screeningRoom === null || screeningRoom === void 0 ? void 0 : screeningRoom.branchCode) !== 'string') {
|
|
678
|
-
throw new factory.errors.ArgumentNull('containedInPlace.branchCode');
|
|
679
|
-
}
|
|
680
|
-
const movieTheater = screeningRoom.containedInPlace;
|
|
681
|
-
if (typeof (movieTheater === null || movieTheater === void 0 ? void 0 : movieTheater.branchCode) !== 'string') {
|
|
682
|
-
throw new factory.errors.ArgumentNull('containedInPlace.containedInPlace.branchCode');
|
|
683
|
-
}
|
|
684
733
|
const doc = yield this.placeModel.findOneAndUpdate({
|
|
685
734
|
typeOf: { $eq: factory.placeType.MovieTheater },
|
|
686
735
|
'project.id': { $eq: screeningRoomSection.project.id },
|
package/package.json
CHANGED