@chevre/domain 23.2.0-alpha.8 → 23.2.0-alpha.9
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/seat.d.ts +16 -45
- package/lib/chevre/repo/place/seat.js +25 -47
- package/package.json +1 -1
|
@@ -1,6 +1,18 @@
|
|
|
1
1
|
import type { AnyExpression, Connection, PipelineStage } from 'mongoose';
|
|
2
2
|
import * as factory from '../../factory';
|
|
3
3
|
type IMatchStage = PipelineStage.Match;
|
|
4
|
+
type ICreatingSeat = Pick<factory.place.seat.IPlace, 'additionalProperty' | 'branchCode' | 'name' | 'maximumAttendeeCapacity' | 'seatingType'>;
|
|
5
|
+
interface IUpdateOptions {
|
|
6
|
+
project: {
|
|
7
|
+
id: string;
|
|
8
|
+
};
|
|
9
|
+
parentOrganization?: {
|
|
10
|
+
id?: string;
|
|
11
|
+
};
|
|
12
|
+
movieTheaterCode: string;
|
|
13
|
+
roomCode: string;
|
|
14
|
+
sectionCode: string;
|
|
15
|
+
}
|
|
4
16
|
/**
|
|
5
17
|
* 座席編集時レスポンス
|
|
6
18
|
*/
|
|
@@ -27,25 +39,8 @@ export declare class SeatRepo {
|
|
|
27
39
|
static CREATE_MATCH_STAGES(params: factory.place.seat.ISearchConditions, options: {
|
|
28
40
|
filterTypeOf: boolean;
|
|
29
41
|
}): IMatchStage[];
|
|
30
|
-
createSeat(seat:
|
|
31
|
-
|
|
32
|
-
id?: string;
|
|
33
|
-
};
|
|
34
|
-
}): Promise<IUpdateSeatResult>;
|
|
35
|
-
updateSeat(seat: Omit<factory.place.seat.IPlace, 'containedInPlace'> & {
|
|
36
|
-
containedInPlace: {
|
|
37
|
-
branchCode: string;
|
|
38
|
-
containedInPlace: {
|
|
39
|
-
branchCode: string;
|
|
40
|
-
containedInPlace: {
|
|
41
|
-
branchCode: string;
|
|
42
|
-
};
|
|
43
|
-
};
|
|
44
|
-
};
|
|
45
|
-
parentOrganization?: {
|
|
46
|
-
id?: string;
|
|
47
|
-
};
|
|
48
|
-
}, $unset: any): Promise<IUpdateSeatResult>;
|
|
42
|
+
createSeat(seat: ICreatingSeat, options: IUpdateOptions): Promise<IUpdateSeatResult>;
|
|
43
|
+
updateSeatByBranchCode(seat: ICreatingSeat, $unset: any, options: IUpdateOptions): Promise<IUpdateSeatResult>;
|
|
49
44
|
searchSeats(params: factory.place.seat.ISearchConditions): Promise<factory.place.seat.IPlace[]>;
|
|
50
45
|
projectSeatsByScreeningRoom(params: Pick<factory.place.seat.ISearchConditions, '$projection' | 'additionalProperty' | 'branchCode' | 'seatingType' | 'name' | 'limit' | 'page'> & {
|
|
51
46
|
project: {
|
|
@@ -137,35 +132,11 @@ export declare class SeatRepo {
|
|
|
137
132
|
};
|
|
138
133
|
};
|
|
139
134
|
}): Promise<string[]>;
|
|
140
|
-
|
|
141
|
-
project: {
|
|
142
|
-
id: string;
|
|
143
|
-
};
|
|
144
|
-
parentOrganization?: {
|
|
145
|
-
id?: string;
|
|
146
|
-
};
|
|
135
|
+
deleteSeatByBranchCode(seat: {
|
|
147
136
|
/**
|
|
148
137
|
* 座席コード
|
|
149
138
|
*/
|
|
150
139
|
branchCode: string;
|
|
151
|
-
|
|
152
|
-
/**
|
|
153
|
-
* セクションコード
|
|
154
|
-
*/
|
|
155
|
-
branchCode: string;
|
|
156
|
-
containedInPlace: {
|
|
157
|
-
/**
|
|
158
|
-
* ルームコード
|
|
159
|
-
*/
|
|
160
|
-
branchCode: string;
|
|
161
|
-
containedInPlace: {
|
|
162
|
-
/**
|
|
163
|
-
* 施設コード
|
|
164
|
-
*/
|
|
165
|
-
branchCode: string;
|
|
166
|
-
};
|
|
167
|
-
};
|
|
168
|
-
};
|
|
169
|
-
}): Promise<IUpdateSeatResult>;
|
|
140
|
+
}, options: IUpdateOptions): Promise<IUpdateSeatResult>;
|
|
170
141
|
}
|
|
171
142
|
export {};
|
|
@@ -226,24 +226,13 @@ class SeatRepo {
|
|
|
226
226
|
return matchStages;
|
|
227
227
|
}
|
|
228
228
|
// tslint:disable-next-line:max-func-body-length
|
|
229
|
-
createSeat(seat) {
|
|
229
|
+
createSeat(seat, options) {
|
|
230
230
|
return __awaiter(this, void 0, void 0, function* () {
|
|
231
|
-
var _a, _b
|
|
232
|
-
const
|
|
233
|
-
if (typeof (screeningRoomSection === null || screeningRoomSection === void 0 ? void 0 : screeningRoomSection.branchCode) !== 'string') {
|
|
234
|
-
throw new factory.errors.ArgumentNull('containedInPlace.branchCode');
|
|
235
|
-
}
|
|
236
|
-
const screeningRoom = screeningRoomSection.containedInPlace;
|
|
237
|
-
if (typeof (screeningRoom === null || screeningRoom === void 0 ? void 0 : screeningRoom.branchCode) !== 'string') {
|
|
238
|
-
throw new factory.errors.ArgumentNull('containedInPlace.containedInPlace.branchCode');
|
|
239
|
-
}
|
|
240
|
-
const movieTheater = screeningRoom.containedInPlace;
|
|
241
|
-
if (typeof (movieTheater === null || movieTheater === void 0 ? void 0 : movieTheater.branchCode) !== 'string') {
|
|
242
|
-
throw new factory.errors.ArgumentNull('containedInPlace.containedInPlace.containedInPlace.branchCode');
|
|
243
|
-
}
|
|
231
|
+
var _a, _b;
|
|
232
|
+
const { project, parentOrganization, movieTheaterCode, roomCode, sectionCode } = options;
|
|
244
233
|
// 施設存在確認
|
|
245
|
-
const movieTheaterDoc = yield this.civicStructureModel.findOne(Object.assign({ typeOf: { $eq: factory.placeType.MovieTheater }, 'project.id': { $eq:
|
|
246
|
-
? { 'parentOrganization.id': { $exists: true, $eq:
|
|
234
|
+
const movieTheaterDoc = yield this.civicStructureModel.findOne(Object.assign({ typeOf: { $eq: factory.placeType.MovieTheater }, 'project.id': { $eq: project.id }, branchCode: { $eq: movieTheaterCode } }, (typeof (parentOrganization === null || parentOrganization === void 0 ? void 0 : parentOrganization.id) === 'string')
|
|
235
|
+
? { 'parentOrganization.id': { $exists: true, $eq: parentOrganization.id } }
|
|
247
236
|
: undefined), { _id: 1 })
|
|
248
237
|
.lean()
|
|
249
238
|
.exec();
|
|
@@ -252,19 +241,19 @@ class SeatRepo {
|
|
|
252
241
|
}
|
|
253
242
|
const doc = yield this.placeModel.findOneAndUpdate({
|
|
254
243
|
typeOf: { $eq: factory.placeType.ScreeningRoom },
|
|
255
|
-
'project.id': { $eq:
|
|
256
|
-
'containedInPlace.branchCode': { $exists: true, $eq:
|
|
257
|
-
branchCode: { $eq:
|
|
258
|
-
'containsPlace.branchCode': { $eq:
|
|
244
|
+
'project.id': { $eq: project.id },
|
|
245
|
+
'containedInPlace.branchCode': { $exists: true, $eq: movieTheaterCode },
|
|
246
|
+
branchCode: { $eq: roomCode },
|
|
247
|
+
'containsPlace.branchCode': { $eq: sectionCode }
|
|
259
248
|
}, {
|
|
260
249
|
$push: {
|
|
261
|
-
'containsPlace.$[screeningRoomSection].containsPlace': Object.assign(Object.assign(Object.assign({ typeOf:
|
|
250
|
+
'containsPlace.$[screeningRoomSection].containsPlace': Object.assign(Object.assign(Object.assign({ typeOf: factory.placeType.Seat, 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), (seat.maximumAttendeeCapacity === 0) ? { maximumAttendeeCapacity: seat.maximumAttendeeCapacity } : undefined)
|
|
262
251
|
}
|
|
263
252
|
}, {
|
|
264
253
|
new: true,
|
|
265
254
|
arrayFilters: [
|
|
266
255
|
{
|
|
267
|
-
'screeningRoomSection.branchCode': { $eq:
|
|
256
|
+
'screeningRoomSection.branchCode': { $eq: sectionCode },
|
|
268
257
|
'screeningRoomSection.containsPlace.branchCode': { $ne: seat.branchCode }
|
|
269
258
|
}
|
|
270
259
|
],
|
|
@@ -279,24 +268,13 @@ class SeatRepo {
|
|
|
279
268
|
});
|
|
280
269
|
}
|
|
281
270
|
// tslint:disable-next-line:cyclomatic-complexity max-func-body-length
|
|
282
|
-
|
|
271
|
+
updateSeatByBranchCode(seat, $unset, options) {
|
|
283
272
|
return __awaiter(this, void 0, void 0, function* () {
|
|
284
|
-
var _a, _b
|
|
285
|
-
const
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
const screeningRoom = screeningRoomSection.containedInPlace;
|
|
290
|
-
if (typeof (screeningRoom === null || screeningRoom === void 0 ? void 0 : screeningRoom.branchCode) !== 'string') {
|
|
291
|
-
throw new factory.errors.ArgumentNull('containedInPlace.containedInPlace.branchCode');
|
|
292
|
-
}
|
|
293
|
-
const movieTheater = screeningRoom.containedInPlace;
|
|
294
|
-
if (typeof (movieTheater === null || movieTheater === void 0 ? void 0 : movieTheater.branchCode) !== 'string') {
|
|
295
|
-
throw new factory.errors.ArgumentNull('containedInPlace.containedInPlace.containedInPlace.branchCode');
|
|
296
|
-
}
|
|
297
|
-
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')
|
|
298
|
-
? { 'parentOrganization.id': { $exists: true, $eq: seat.parentOrganization.id } }
|
|
299
|
-
: undefined), Object.assign(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')
|
|
273
|
+
var _a, _b;
|
|
274
|
+
const { project, parentOrganization, movieTheaterCode, roomCode, sectionCode } = options;
|
|
275
|
+
const doc = yield this.placeModel.findOneAndUpdate(Object.assign({ typeOf: { $eq: factory.placeType.ScreeningRoom }, 'project.id': { $eq: project.id }, 'containedInPlace.branchCode': { $exists: true, $eq: movieTheaterCode }, branchCode: { $eq: roomCode }, 'containsPlace.branchCode': { $eq: sectionCode }, 'containsPlace.containsPlace.branchCode': { $eq: seat.branchCode } }, (typeof (parentOrganization === null || parentOrganization === void 0 ? void 0 : parentOrganization.id) === 'string')
|
|
276
|
+
? { 'parentOrganization.id': { $exists: true, $eq: parentOrganization.id } }
|
|
277
|
+
: undefined), Object.assign(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')
|
|
300
278
|
? {
|
|
301
279
|
'containsPlace.$[screeningRoomSection].containsPlace.$[seat].name': seat.name
|
|
302
280
|
}
|
|
@@ -333,7 +311,7 @@ class SeatRepo {
|
|
|
333
311
|
: undefined) }), {
|
|
334
312
|
new: true,
|
|
335
313
|
arrayFilters: [
|
|
336
|
-
{ 'screeningRoomSection.branchCode': { $eq:
|
|
314
|
+
{ 'screeningRoomSection.branchCode': { $eq: sectionCode } },
|
|
337
315
|
{ 'seat.branchCode': { $eq: seat.branchCode } }
|
|
338
316
|
],
|
|
339
317
|
projection: { 'containedInPlace.id': 1, typeOf: 1 }
|
|
@@ -585,14 +563,14 @@ class SeatRepo {
|
|
|
585
563
|
return (result !== undefined) ? result.seatingTypes : [];
|
|
586
564
|
});
|
|
587
565
|
}
|
|
588
|
-
|
|
566
|
+
deleteSeatByBranchCode(seat, options) {
|
|
589
567
|
return __awaiter(this, void 0, void 0, function* () {
|
|
590
|
-
|
|
591
|
-
const doc = yield this.placeModel.findOneAndUpdate(Object.assign({ typeOf: { $eq: factory.placeType.ScreeningRoom }, 'project.id': { $eq:
|
|
568
|
+
const { project, parentOrganization, movieTheaterCode, roomCode, sectionCode } = options;
|
|
569
|
+
const doc = yield this.placeModel.findOneAndUpdate(Object.assign({ typeOf: { $eq: factory.placeType.ScreeningRoom }, 'project.id': { $eq: project.id }, 'containedInPlace.branchCode': {
|
|
592
570
|
$exists: true,
|
|
593
|
-
$eq:
|
|
594
|
-
}, branchCode: { $eq:
|
|
595
|
-
? { 'parentOrganization.id': { $exists: true, $eq:
|
|
571
|
+
$eq: movieTheaterCode
|
|
572
|
+
}, branchCode: { $eq: roomCode }, 'containsPlace.branchCode': { $eq: sectionCode }, 'containsPlace.containsPlace.branchCode': { $eq: seat.branchCode } }, (typeof (parentOrganization === null || parentOrganization === void 0 ? void 0 : parentOrganization.id) === 'string')
|
|
573
|
+
? { 'parentOrganization.id': { $exists: true, $eq: parentOrganization.id } }
|
|
596
574
|
: undefined), {
|
|
597
575
|
$pull: {
|
|
598
576
|
'containsPlace.$[screeningRoomSection].containsPlace': {
|
|
@@ -602,7 +580,7 @@ class SeatRepo {
|
|
|
602
580
|
}, {
|
|
603
581
|
new: true,
|
|
604
582
|
arrayFilters: [
|
|
605
|
-
{ 'screeningRoomSection.branchCode': { $eq:
|
|
583
|
+
{ 'screeningRoomSection.branchCode': { $eq: sectionCode } }
|
|
606
584
|
],
|
|
607
585
|
projection: { 'containedInPlace.id': 1, typeOf: 1 }
|
|
608
586
|
})
|
package/package.json
CHANGED