@chevre/domain 21.2.0-alpha.148 → 21.2.0-alpha.149
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 +50 -14
- package/lib/chevre/repo/place.js +165 -54
- package/package.json +1 -1
|
@@ -128,17 +128,19 @@ export declare class MongoRepository {
|
|
|
128
128
|
id: string;
|
|
129
129
|
};
|
|
130
130
|
}): Promise<void>;
|
|
131
|
-
createScreeningRoomSection(screeningRoomSection: IScreeningRoomSectionWithoutContainsPlace, useScreeningRoomType
|
|
131
|
+
createScreeningRoomSection(screeningRoomSection: IScreeningRoomSectionWithoutContainsPlace, useScreeningRoomType: boolean): Promise<{
|
|
132
132
|
/**
|
|
133
133
|
* 施設ID
|
|
134
134
|
*/
|
|
135
135
|
id: string;
|
|
136
136
|
typeOf: factory.placeType.MovieTheater;
|
|
137
137
|
} | {
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
138
|
+
containedInPlace: {
|
|
139
|
+
/**
|
|
140
|
+
* 施設ID
|
|
141
|
+
*/
|
|
142
|
+
id: string;
|
|
143
|
+
};
|
|
142
144
|
typeOf: factory.placeType.ScreeningRoom;
|
|
143
145
|
}>;
|
|
144
146
|
updateScreeningRoomSection(screeningRoomSection: Omit<factory.place.screeningRoomSection.IPlace, 'containedInPlace'> & {
|
|
@@ -148,17 +150,19 @@ export declare class MongoRepository {
|
|
|
148
150
|
branchCode: string;
|
|
149
151
|
};
|
|
150
152
|
};
|
|
151
|
-
}, $unset: any, useScreeningRoomType
|
|
153
|
+
}, $unset: any, useScreeningRoomType: boolean): Promise<{
|
|
152
154
|
/**
|
|
153
155
|
* 施設ID
|
|
154
156
|
*/
|
|
155
157
|
id: string;
|
|
156
158
|
typeOf: factory.placeType.MovieTheater;
|
|
157
159
|
} | {
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
160
|
+
containedInPlace: {
|
|
161
|
+
/**
|
|
162
|
+
* 施設ID
|
|
163
|
+
*/
|
|
164
|
+
id: string;
|
|
165
|
+
};
|
|
162
166
|
typeOf: factory.placeType.ScreeningRoom;
|
|
163
167
|
}>;
|
|
164
168
|
searchScreeningRoomSections(searchConditions: factory.place.screeningRoomSection.ISearchConditions & {
|
|
@@ -186,12 +190,20 @@ export declare class MongoRepository {
|
|
|
186
190
|
branchCode: string;
|
|
187
191
|
};
|
|
188
192
|
};
|
|
189
|
-
}, useScreeningRoomType
|
|
193
|
+
}, useScreeningRoomType: boolean): Promise<{
|
|
190
194
|
/**
|
|
191
195
|
* 施設ID
|
|
192
196
|
*/
|
|
193
197
|
id: string;
|
|
194
198
|
typeOf: factory.placeType.MovieTheater;
|
|
199
|
+
} | {
|
|
200
|
+
containedInPlace: {
|
|
201
|
+
/**
|
|
202
|
+
* 施設ID
|
|
203
|
+
*/
|
|
204
|
+
id: string;
|
|
205
|
+
};
|
|
206
|
+
typeOf: factory.placeType.ScreeningRoom;
|
|
195
207
|
}>;
|
|
196
208
|
searchScreeningRooms(searchConditions: factory.place.screeningRoom.ISearchConditions, useScreeningRoomType: boolean): Promise<Omit<factory.place.screeningRoom.IPlace, 'containsPlace'>[]>;
|
|
197
209
|
findScreeningRoomsByBranchCode(params: {
|
|
@@ -205,12 +217,20 @@ export declare class MongoRepository {
|
|
|
205
217
|
};
|
|
206
218
|
useScreeningRoomType: boolean;
|
|
207
219
|
}): Promise<IScreeningRoomFoundByBranchCode>;
|
|
208
|
-
createSeat(seat: factory.place.seat.IPlace, useScreeningRoomType
|
|
220
|
+
createSeat(seat: factory.place.seat.IPlace, useScreeningRoomType: boolean): Promise<{
|
|
209
221
|
/**
|
|
210
222
|
* 施設ID
|
|
211
223
|
*/
|
|
212
224
|
id: string;
|
|
213
225
|
typeOf: factory.placeType.MovieTheater;
|
|
226
|
+
} | {
|
|
227
|
+
containedInPlace: {
|
|
228
|
+
/**
|
|
229
|
+
* 施設ID
|
|
230
|
+
*/
|
|
231
|
+
id: string;
|
|
232
|
+
};
|
|
233
|
+
typeOf: factory.placeType.ScreeningRoom;
|
|
214
234
|
}>;
|
|
215
235
|
updateSeat(seat: Omit<factory.place.seat.IPlace, 'containedInPlace'> & {
|
|
216
236
|
containedInPlace: {
|
|
@@ -222,12 +242,20 @@ export declare class MongoRepository {
|
|
|
222
242
|
};
|
|
223
243
|
};
|
|
224
244
|
};
|
|
225
|
-
}, $unset: any, useScreeningRoomType
|
|
245
|
+
}, $unset: any, useScreeningRoomType: boolean): Promise<{
|
|
226
246
|
/**
|
|
227
247
|
* 施設ID
|
|
228
248
|
*/
|
|
229
249
|
id: string;
|
|
230
250
|
typeOf: factory.placeType.MovieTheater;
|
|
251
|
+
} | {
|
|
252
|
+
containedInPlace: {
|
|
253
|
+
/**
|
|
254
|
+
* 施設ID
|
|
255
|
+
*/
|
|
256
|
+
id: string;
|
|
257
|
+
};
|
|
258
|
+
typeOf: factory.placeType.ScreeningRoom;
|
|
231
259
|
}>;
|
|
232
260
|
searchSeats(params: factory.place.seat.ISearchConditions, useScreeningRoomType: boolean): Promise<factory.place.seat.IPlace[]>;
|
|
233
261
|
deleteSeat(seat: {
|
|
@@ -256,12 +284,20 @@ export declare class MongoRepository {
|
|
|
256
284
|
};
|
|
257
285
|
};
|
|
258
286
|
};
|
|
259
|
-
}, useScreeningRoomType
|
|
287
|
+
}, useScreeningRoomType: boolean): Promise<{
|
|
260
288
|
/**
|
|
261
289
|
* 施設ID
|
|
262
290
|
*/
|
|
263
291
|
id: string;
|
|
264
292
|
typeOf: factory.placeType.MovieTheater;
|
|
293
|
+
} | {
|
|
294
|
+
containedInPlace: {
|
|
295
|
+
/**
|
|
296
|
+
* 施設ID
|
|
297
|
+
*/
|
|
298
|
+
id: string;
|
|
299
|
+
};
|
|
300
|
+
typeOf: factory.placeType.ScreeningRoom;
|
|
265
301
|
}>;
|
|
266
302
|
syncScreeningRooms(params: {
|
|
267
303
|
/**
|
package/lib/chevre/repo/place.js
CHANGED
|
@@ -631,7 +631,7 @@ class MongoRepository {
|
|
|
631
631
|
typeOf: { $eq: factory.placeType.ScreeningRoom },
|
|
632
632
|
'project.id': { $eq: screeningRoomSection.project.id },
|
|
633
633
|
'containedInPlace.branchCode': { $exists: true, $eq: movieTheater.branchCode },
|
|
634
|
-
branchCode: screeningRoom.branchCode,
|
|
634
|
+
branchCode: { $eq: screeningRoom.branchCode },
|
|
635
635
|
'containsPlace.branchCode': { $ne: screeningRoomSection.branchCode }
|
|
636
636
|
}, {
|
|
637
637
|
$push: {
|
|
@@ -641,7 +641,7 @@ class MongoRepository {
|
|
|
641
641
|
}
|
|
642
642
|
}, {
|
|
643
643
|
new: true,
|
|
644
|
-
projection: {
|
|
644
|
+
projection: { 'containedInPlace.id': 1, typeOf: 1 }
|
|
645
645
|
})
|
|
646
646
|
.exec();
|
|
647
647
|
// 存在しなければコード重複
|
|
@@ -721,7 +721,7 @@ class MongoRepository {
|
|
|
721
721
|
arrayFilters: [
|
|
722
722
|
{ 'screeningRoomSection.branchCode': screeningRoomSection.branchCode }
|
|
723
723
|
],
|
|
724
|
-
projection: {
|
|
724
|
+
projection: { 'containedInPlace.id': 1, typeOf: 1 }
|
|
725
725
|
})
|
|
726
726
|
.exec();
|
|
727
727
|
if (doc === null) {
|
|
@@ -1025,9 +1025,30 @@ class MongoRepository {
|
|
|
1025
1025
|
deleteScreeningRoomSection(screeningRoomSection, useScreeningRoomType) {
|
|
1026
1026
|
return __awaiter(this, void 0, void 0, function* () {
|
|
1027
1027
|
if (useScreeningRoomType === true) {
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1028
|
+
const doc = yield this.placeModel.findOneAndUpdate({
|
|
1029
|
+
typeOf: { $eq: factory.placeType.ScreeningRoom },
|
|
1030
|
+
'project.id': { $eq: screeningRoomSection.project.id },
|
|
1031
|
+
'containedInPlace.branchCode': {
|
|
1032
|
+
$exists: true,
|
|
1033
|
+
$eq: screeningRoomSection.containedInPlace.containedInPlace.branchCode
|
|
1034
|
+
},
|
|
1035
|
+
branchCode: { $eq: screeningRoomSection.containedInPlace.branchCode },
|
|
1036
|
+
'containsPlace.branchCode': { $eq: screeningRoomSection.branchCode }
|
|
1037
|
+
}, {
|
|
1038
|
+
$pull: {
|
|
1039
|
+
containsPlace: {
|
|
1040
|
+
branchCode: screeningRoomSection.branchCode
|
|
1041
|
+
}
|
|
1042
|
+
}
|
|
1043
|
+
}, {
|
|
1044
|
+
new: true,
|
|
1045
|
+
projection: { 'containedInPlace.id': 1, typeOf: 1 }
|
|
1046
|
+
})
|
|
1047
|
+
.exec();
|
|
1048
|
+
if (doc === null) {
|
|
1049
|
+
throw new factory.errors.NotFound(factory.placeType.ScreeningRoomSection);
|
|
1050
|
+
}
|
|
1051
|
+
return doc.toObject();
|
|
1031
1052
|
}
|
|
1032
1053
|
else {
|
|
1033
1054
|
const doc = yield this.placeModel.findOneAndUpdate({
|
|
@@ -1462,41 +1483,65 @@ class MongoRepository {
|
|
|
1462
1483
|
}
|
|
1463
1484
|
});
|
|
1464
1485
|
}
|
|
1486
|
+
// tslint:disable-next-line:max-func-body-length
|
|
1465
1487
|
createSeat(seat, useScreeningRoomType) {
|
|
1466
|
-
var _a, _b;
|
|
1488
|
+
var _a, _b, _c, _d;
|
|
1467
1489
|
return __awaiter(this, void 0, void 0, function* () {
|
|
1468
|
-
|
|
1469
|
-
|
|
1470
|
-
|
|
1471
|
-
throw new factory.errors.NotImplemented('useScreeningRoomType not implemented');
|
|
1490
|
+
const screeningRoomSection = seat.containedInPlace;
|
|
1491
|
+
if (typeof (screeningRoomSection === null || screeningRoomSection === void 0 ? void 0 : screeningRoomSection.branchCode) !== 'string') {
|
|
1492
|
+
throw new factory.errors.ArgumentNull('containedInPlace.branchCode');
|
|
1472
1493
|
}
|
|
1473
|
-
|
|
1474
|
-
|
|
1475
|
-
|
|
1476
|
-
|
|
1477
|
-
|
|
1478
|
-
|
|
1479
|
-
|
|
1480
|
-
|
|
1481
|
-
|
|
1482
|
-
|
|
1483
|
-
|
|
1484
|
-
|
|
1485
|
-
|
|
1486
|
-
|
|
1487
|
-
|
|
1488
|
-
|
|
1494
|
+
const screeningRoom = screeningRoomSection.containedInPlace;
|
|
1495
|
+
if (typeof (screeningRoom === null || screeningRoom === void 0 ? void 0 : screeningRoom.branchCode) !== 'string') {
|
|
1496
|
+
throw new factory.errors.ArgumentNull('containedInPlace.containedInPlace.branchCode');
|
|
1497
|
+
}
|
|
1498
|
+
const movieTheater = screeningRoom.containedInPlace;
|
|
1499
|
+
if (typeof (movieTheater === null || movieTheater === void 0 ? void 0 : movieTheater.branchCode) !== 'string') {
|
|
1500
|
+
throw new factory.errors.ArgumentNull('containedInPlace.containedInPlace.containedInPlace.branchCode');
|
|
1501
|
+
}
|
|
1502
|
+
// 施設存在確認
|
|
1503
|
+
let doc = yield this.placeModel.findOne({
|
|
1504
|
+
typeOf: { $eq: factory.placeType.MovieTheater },
|
|
1505
|
+
'project.id': { $eq: seat.project.id },
|
|
1506
|
+
branchCode: movieTheater.branchCode,
|
|
1507
|
+
'containsPlace.branchCode': screeningRoom.branchCode,
|
|
1508
|
+
'containsPlace.containsPlace.branchCode': screeningRoomSection.branchCode
|
|
1509
|
+
}, {
|
|
1510
|
+
_id: 1
|
|
1511
|
+
})
|
|
1512
|
+
.exec();
|
|
1513
|
+
if (doc === null) {
|
|
1514
|
+
throw new factory.errors.NotFound(factory.placeType.MovieTheater);
|
|
1515
|
+
}
|
|
1516
|
+
if (useScreeningRoomType === true) {
|
|
1517
|
+
doc = yield this.placeModel.findOneAndUpdate({
|
|
1518
|
+
typeOf: { $eq: factory.placeType.ScreeningRoom },
|
|
1489
1519
|
'project.id': { $eq: seat.project.id },
|
|
1490
|
-
branchCode: movieTheater.branchCode,
|
|
1491
|
-
|
|
1492
|
-
'containsPlace.
|
|
1520
|
+
'containedInPlace.branchCode': { $exists: true, $eq: movieTheater.branchCode },
|
|
1521
|
+
branchCode: { $eq: screeningRoom.branchCode },
|
|
1522
|
+
'containsPlace.branchCode': { $eq: screeningRoomSection.branchCode }
|
|
1523
|
+
}, {
|
|
1524
|
+
$push: {
|
|
1525
|
+
'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)
|
|
1526
|
+
}
|
|
1493
1527
|
}, {
|
|
1494
|
-
|
|
1528
|
+
new: true,
|
|
1529
|
+
arrayFilters: [
|
|
1530
|
+
{
|
|
1531
|
+
'screeningRoomSection.branchCode': { $eq: screeningRoomSection.branchCode },
|
|
1532
|
+
'screeningRoomSection.containsPlace.branchCode': { $ne: seat.branchCode }
|
|
1533
|
+
}
|
|
1534
|
+
],
|
|
1535
|
+
projection: { 'containedInPlace.id': 1, typeOf: 1 }
|
|
1495
1536
|
})
|
|
1496
1537
|
.exec();
|
|
1538
|
+
// 存在しなければコード重複
|
|
1497
1539
|
if (doc === null) {
|
|
1498
|
-
throw new factory.errors.
|
|
1540
|
+
throw new factory.errors.AlreadyInUse(factory.placeType.Seat, ['branchCode']);
|
|
1499
1541
|
}
|
|
1542
|
+
return doc.toObject();
|
|
1543
|
+
}
|
|
1544
|
+
else {
|
|
1500
1545
|
doc = yield this.placeModel.findOneAndUpdate({
|
|
1501
1546
|
typeOf: { $eq: factory.placeType.MovieTheater },
|
|
1502
1547
|
'project.id': { $eq: seat.project.id },
|
|
@@ -1505,7 +1550,7 @@ class MongoRepository {
|
|
|
1505
1550
|
'containsPlace.containsPlace.branchCode': screeningRoomSection.branchCode
|
|
1506
1551
|
}, {
|
|
1507
1552
|
$push: {
|
|
1508
|
-
'containsPlace.$[screeningRoom].containsPlace.$[screeningRoomSection].containsPlace': Object.assign(Object.assign({ typeOf: seat.typeOf, branchCode: seat.branchCode, additionalProperty: seat.additionalProperty }, (typeof ((
|
|
1553
|
+
'containsPlace.$[screeningRoom].containsPlace.$[screeningRoomSection].containsPlace': Object.assign(Object.assign({ typeOf: seat.typeOf, branchCode: seat.branchCode, additionalProperty: seat.additionalProperty }, (typeof ((_c = seat.name) === null || _c === void 0 ? void 0 : _c.ja) === 'string' || typeof ((_d = seat.name) === null || _d === void 0 ? void 0 : _d.en) === 'string') ? { name: seat.name } : undefined), (Array.isArray(seat.seatingType)) ? { seatingType: seat.seatingType } : undefined)
|
|
1509
1554
|
}
|
|
1510
1555
|
}, {
|
|
1511
1556
|
new: true,
|
|
@@ -1518,7 +1563,6 @@ class MongoRepository {
|
|
|
1518
1563
|
],
|
|
1519
1564
|
projection: {
|
|
1520
1565
|
_id: 1,
|
|
1521
|
-
// 'project.id': 1,
|
|
1522
1566
|
branchCode: 1,
|
|
1523
1567
|
typeOf: 1
|
|
1524
1568
|
}
|
|
@@ -1532,27 +1576,69 @@ class MongoRepository {
|
|
|
1532
1576
|
}
|
|
1533
1577
|
});
|
|
1534
1578
|
}
|
|
1579
|
+
// tslint:disable-next-line:cyclomatic-complexity max-func-body-length
|
|
1535
1580
|
updateSeat(seat, $unset, useScreeningRoomType) {
|
|
1536
|
-
var _a, _b;
|
|
1581
|
+
var _a, _b, _c, _d;
|
|
1537
1582
|
return __awaiter(this, void 0, void 0, function* () {
|
|
1583
|
+
const screeningRoomSection = seat.containedInPlace;
|
|
1584
|
+
if (typeof (screeningRoomSection === null || screeningRoomSection === void 0 ? void 0 : screeningRoomSection.branchCode) !== 'string') {
|
|
1585
|
+
throw new factory.errors.ArgumentNull('containedInPlace.branchCode');
|
|
1586
|
+
}
|
|
1587
|
+
const screeningRoom = screeningRoomSection.containedInPlace;
|
|
1588
|
+
if (typeof (screeningRoom === null || screeningRoom === void 0 ? void 0 : screeningRoom.branchCode) !== 'string') {
|
|
1589
|
+
throw new factory.errors.ArgumentNull('containedInPlace.containedInPlace.branchCode');
|
|
1590
|
+
}
|
|
1591
|
+
const movieTheater = screeningRoom.containedInPlace;
|
|
1592
|
+
if (typeof (movieTheater === null || movieTheater === void 0 ? void 0 : movieTheater.branchCode) !== 'string') {
|
|
1593
|
+
throw new factory.errors.ArgumentNull('containedInPlace.containedInPlace.containedInPlace.branchCode');
|
|
1594
|
+
}
|
|
1538
1595
|
if (useScreeningRoomType === true) {
|
|
1539
|
-
|
|
1540
|
-
|
|
1541
|
-
|
|
1596
|
+
const doc = yield this.placeModel.findOneAndUpdate({
|
|
1597
|
+
typeOf: { $eq: factory.placeType.ScreeningRoom },
|
|
1598
|
+
'project.id': { $eq: seat.project.id },
|
|
1599
|
+
'containedInPlace.branchCode': { $exists: true, $eq: movieTheater.branchCode },
|
|
1600
|
+
branchCode: { $eq: screeningRoom.branchCode },
|
|
1601
|
+
'containsPlace.branchCode': { $eq: screeningRoomSection.branchCode },
|
|
1602
|
+
'containsPlace.containsPlace.branchCode': { $eq: seat.branchCode }
|
|
1603
|
+
}, 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')
|
|
1604
|
+
? {
|
|
1605
|
+
'containsPlace.$[screeningRoomSection].containsPlace.$[seat].name': seat.name
|
|
1606
|
+
}
|
|
1607
|
+
: undefined), (Array.isArray(seat.seatingType))
|
|
1608
|
+
? {
|
|
1609
|
+
'containsPlace.$[screeningRoomSection].containsPlace.$[seat].seatingType': seat.seatingType
|
|
1610
|
+
}
|
|
1611
|
+
: undefined), (Array.isArray(seat.additionalProperty))
|
|
1612
|
+
? {
|
|
1613
|
+
'containsPlace.$[screeningRoomSection].containsPlace.$[seat].additionalProperty': seat.additionalProperty
|
|
1614
|
+
}
|
|
1615
|
+
: undefined), { $unset: Object.assign(Object.assign({ noExistingAttributeName: 1 }, (($unset === null || $unset === void 0 ? void 0 : $unset['containsPlace.$[screeningRoom].containsPlace.$[screeningRoomSection].containsPlace.$[seat].name'])
|
|
1616
|
+
=== 1
|
|
1617
|
+
|| ($unset === null || $unset === void 0 ? void 0 : $unset['containsPlace.$[screeningRoomSection].containsPlace.$[seat].name']) === 1)
|
|
1618
|
+
? {
|
|
1619
|
+
'containsPlace.$[screeningRoomSection].containsPlace.$[seat].name': 1
|
|
1620
|
+
}
|
|
1621
|
+
: undefined), (($unset === null || $unset === void 0 ? void 0 : $unset['containsPlace.$[screeningRoom].containsPlace.$[screeningRoomSection].containsPlace.$[seat].seatingType'])
|
|
1622
|
+
=== 1
|
|
1623
|
+
|| ($unset === null || $unset === void 0 ? void 0 : $unset['containsPlace.$[screeningRoomSection].containsPlace.$[seat].seatingType']) === 1)
|
|
1624
|
+
? {
|
|
1625
|
+
'containsPlace.$[screeningRoomSection].containsPlace.$[seat].seatingType': 1
|
|
1626
|
+
}
|
|
1627
|
+
: undefined) }), {
|
|
1628
|
+
new: true,
|
|
1629
|
+
arrayFilters: [
|
|
1630
|
+
{ 'screeningRoomSection.branchCode': { $eq: screeningRoomSection.branchCode } },
|
|
1631
|
+
{ 'seat.branchCode': { $eq: seat.branchCode } }
|
|
1632
|
+
],
|
|
1633
|
+
projection: { 'containedInPlace.id': 1, typeOf: 1 }
|
|
1634
|
+
})
|
|
1635
|
+
.exec();
|
|
1636
|
+
if (doc === null) {
|
|
1637
|
+
throw new factory.errors.NotFound(factory.placeType.Seat);
|
|
1638
|
+
}
|
|
1639
|
+
return doc.toObject();
|
|
1542
1640
|
}
|
|
1543
1641
|
else {
|
|
1544
|
-
const screeningRoomSection = seat.containedInPlace;
|
|
1545
|
-
if (typeof (screeningRoomSection === null || screeningRoomSection === void 0 ? void 0 : screeningRoomSection.branchCode) !== 'string') {
|
|
1546
|
-
throw new factory.errors.ArgumentNull('containedInPlace.branchCode');
|
|
1547
|
-
}
|
|
1548
|
-
const screeningRoom = screeningRoomSection.containedInPlace;
|
|
1549
|
-
if (typeof (screeningRoom === null || screeningRoom === void 0 ? void 0 : screeningRoom.branchCode) !== 'string') {
|
|
1550
|
-
throw new factory.errors.ArgumentNull('containedInPlace.containedInPlace.branchCode');
|
|
1551
|
-
}
|
|
1552
|
-
const movieTheater = screeningRoom.containedInPlace;
|
|
1553
|
-
if (typeof (movieTheater === null || movieTheater === void 0 ? void 0 : movieTheater.branchCode) !== 'string') {
|
|
1554
|
-
throw new factory.errors.ArgumentNull('containedInPlace.containedInPlace.containedInPlace.branchCode');
|
|
1555
|
-
}
|
|
1556
1642
|
const doc = yield this.placeModel.findOneAndUpdate({
|
|
1557
1643
|
typeOf: { $eq: factory.placeType.MovieTheater },
|
|
1558
1644
|
'project.id': { $eq: seat.project.id },
|
|
@@ -1560,7 +1646,7 @@ class MongoRepository {
|
|
|
1560
1646
|
'containsPlace.branchCode': screeningRoom.branchCode,
|
|
1561
1647
|
'containsPlace.containsPlace.branchCode': screeningRoomSection.branchCode,
|
|
1562
1648
|
'containsPlace.containsPlace.containsPlace.branchCode': seat.branchCode
|
|
1563
|
-
}, Object.assign(Object.assign(Object.assign(Object.assign({ 'containsPlace.$[screeningRoom].containsPlace.$[screeningRoomSection].containsPlace.$[seat].branchCode': seat.branchCode }, (typeof ((
|
|
1649
|
+
}, Object.assign(Object.assign(Object.assign(Object.assign({ 'containsPlace.$[screeningRoom].containsPlace.$[screeningRoomSection].containsPlace.$[seat].branchCode': seat.branchCode }, (typeof ((_c = seat.name) === null || _c === void 0 ? void 0 : _c.ja) === 'string' || typeof ((_d = seat.name) === null || _d === void 0 ? void 0 : _d.en) === 'string')
|
|
1564
1650
|
? {
|
|
1565
1651
|
'containsPlace.$[screeningRoom].containsPlace.$[screeningRoomSection].containsPlace.$[seat].name': seat.name
|
|
1566
1652
|
}
|
|
@@ -1965,9 +2051,34 @@ class MongoRepository {
|
|
|
1965
2051
|
deleteSeat(seat, useScreeningRoomType) {
|
|
1966
2052
|
return __awaiter(this, void 0, void 0, function* () {
|
|
1967
2053
|
if (useScreeningRoomType === true) {
|
|
1968
|
-
|
|
1969
|
-
|
|
1970
|
-
|
|
2054
|
+
const doc = yield this.placeModel.findOneAndUpdate({
|
|
2055
|
+
typeOf: { $eq: factory.placeType.ScreeningRoom },
|
|
2056
|
+
'project.id': { $eq: seat.project.id },
|
|
2057
|
+
'containedInPlace.branchCode': {
|
|
2058
|
+
$exists: true,
|
|
2059
|
+
$eq: seat.containedInPlace.containedInPlace.containedInPlace.branchCode
|
|
2060
|
+
},
|
|
2061
|
+
branchCode: { $eq: seat.containedInPlace.containedInPlace.branchCode },
|
|
2062
|
+
'containsPlace.branchCode': { $eq: seat.containedInPlace.branchCode },
|
|
2063
|
+
'containsPlace.containsPlace.branchCode': { $eq: seat.branchCode }
|
|
2064
|
+
}, {
|
|
2065
|
+
$pull: {
|
|
2066
|
+
'containsPlace.$[screeningRoomSection].containsPlace': {
|
|
2067
|
+
branchCode: seat.branchCode
|
|
2068
|
+
}
|
|
2069
|
+
}
|
|
2070
|
+
}, {
|
|
2071
|
+
new: true,
|
|
2072
|
+
arrayFilters: [
|
|
2073
|
+
{ 'screeningRoomSection.branchCode': { $eq: seat.containedInPlace.branchCode } }
|
|
2074
|
+
],
|
|
2075
|
+
projection: { 'containedInPlace.id': 1, typeOf: 1 }
|
|
2076
|
+
})
|
|
2077
|
+
.exec();
|
|
2078
|
+
if (doc === null) {
|
|
2079
|
+
throw new factory.errors.NotFound(factory.placeType.Seat);
|
|
2080
|
+
}
|
|
2081
|
+
return doc.toObject();
|
|
1971
2082
|
}
|
|
1972
2083
|
else {
|
|
1973
2084
|
const doc = yield this.placeModel.findOneAndUpdate({
|
package/package.json
CHANGED