@chevre/domain 23.2.0-alpha.7 → 23.2.0-alpha.8
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.
|
@@ -1,6 +1,17 @@
|
|
|
1
1
|
import type { Connection } from 'mongoose';
|
|
2
2
|
import * as factory from '../../factory';
|
|
3
3
|
type IScreeningRoomSectionWithoutContainsPlace = Omit<factory.place.screeningRoomSection.IPlace, 'containsPlace'>;
|
|
4
|
+
type ICreatingSection = Pick<factory.place.screeningRoomSection.IPlace, 'additionalProperty' | 'branchCode' | 'name'>;
|
|
5
|
+
interface IUpdateOptions {
|
|
6
|
+
project: {
|
|
7
|
+
id: string;
|
|
8
|
+
};
|
|
9
|
+
parentOrganization?: {
|
|
10
|
+
id?: string;
|
|
11
|
+
};
|
|
12
|
+
movieTheaterCode: string;
|
|
13
|
+
roomCode: string;
|
|
14
|
+
}
|
|
4
15
|
/**
|
|
5
16
|
* セクション編集時レスポンス
|
|
6
17
|
*/
|
|
@@ -20,40 +31,15 @@ export declare class SectionRepo {
|
|
|
20
31
|
private readonly civicStructureModel;
|
|
21
32
|
private readonly placeModel;
|
|
22
33
|
constructor(connection: Connection);
|
|
23
|
-
|
|
24
|
-
parentOrganization?: {
|
|
25
|
-
id?: string;
|
|
26
|
-
};
|
|
27
|
-
}): Promise<IUpdateSectionResult>;
|
|
34
|
+
createSection(screeningRoomSection: ICreatingSection, options: IUpdateOptions): Promise<IUpdateSectionResult>;
|
|
28
35
|
/**
|
|
29
36
|
* セクションの名称と追加特性を編集する
|
|
30
37
|
*/
|
|
31
|
-
updateSectionByBranchCode(screeningRoomSection:
|
|
32
|
-
containedInPlace: {
|
|
33
|
-
branchCode: string;
|
|
34
|
-
containedInPlace: {
|
|
35
|
-
branchCode: string;
|
|
36
|
-
};
|
|
37
|
-
};
|
|
38
|
-
containsPlace?: never;
|
|
39
|
-
parentOrganization?: {
|
|
40
|
-
id?: string;
|
|
41
|
-
};
|
|
42
|
-
}, $unset: any): Promise<IUpdateSectionResult>;
|
|
38
|
+
updateSectionByBranchCode(screeningRoomSection: ICreatingSection, $unset: any, options: IUpdateOptions): Promise<IUpdateSectionResult>;
|
|
43
39
|
/**
|
|
44
40
|
* セクションの座席を上書きする
|
|
45
41
|
*/
|
|
46
|
-
overwriteSeats(screeningRoomSection: Pick<factory.place.screeningRoomSection.IPlace, 'branchCode' | 'containsPlace'
|
|
47
|
-
containedInPlace: {
|
|
48
|
-
branchCode: string;
|
|
49
|
-
containedInPlace: {
|
|
50
|
-
branchCode: string;
|
|
51
|
-
};
|
|
52
|
-
};
|
|
53
|
-
parentOrganization?: {
|
|
54
|
-
id?: string;
|
|
55
|
-
};
|
|
56
|
-
}): Promise<IUpdateSectionResult>;
|
|
42
|
+
overwriteSeats(screeningRoomSection: Pick<factory.place.screeningRoomSection.IPlace, 'branchCode' | 'containsPlace'>, options: IUpdateOptions): Promise<IUpdateSectionResult>;
|
|
57
43
|
migrateSectionIdentifier(screeningRoomSection: {
|
|
58
44
|
project: {
|
|
59
45
|
id: string;
|
|
@@ -88,29 +74,11 @@ export declare class SectionRepo {
|
|
|
88
74
|
*/
|
|
89
75
|
roomCode: string;
|
|
90
76
|
}): Promise<Pick<IScreeningRoomSectionWithoutContainsPlace, 'additionalProperty' | 'branchCode' | 'name'>[]>;
|
|
91
|
-
|
|
92
|
-
project: {
|
|
93
|
-
id: string;
|
|
94
|
-
};
|
|
95
|
-
parentOrganization?: {
|
|
96
|
-
id?: string;
|
|
97
|
-
};
|
|
77
|
+
deleteSectionByBranchCode(screeningRoomSection: {
|
|
98
78
|
/**
|
|
99
79
|
* セクションコード
|
|
100
80
|
*/
|
|
101
81
|
branchCode: string;
|
|
102
|
-
|
|
103
|
-
/**
|
|
104
|
-
* ルームコード
|
|
105
|
-
*/
|
|
106
|
-
branchCode: string;
|
|
107
|
-
containedInPlace: {
|
|
108
|
-
/**
|
|
109
|
-
* 施設コード
|
|
110
|
-
*/
|
|
111
|
-
branchCode: string;
|
|
112
|
-
};
|
|
113
|
-
};
|
|
114
|
-
}): Promise<IUpdateSectionResult>;
|
|
82
|
+
}, options: IUpdateOptions): Promise<IUpdateSectionResult>;
|
|
115
83
|
}
|
|
116
84
|
export {};
|
|
@@ -23,20 +23,12 @@ class SectionRepo {
|
|
|
23
23
|
this.placeModel = connection.model(place_1.modelName, (0, place_1.createSchema)());
|
|
24
24
|
}
|
|
25
25
|
// tslint:disable-next-line:max-func-body-length
|
|
26
|
-
|
|
26
|
+
createSection(screeningRoomSection, options) {
|
|
27
27
|
return __awaiter(this, void 0, void 0, function* () {
|
|
28
|
-
|
|
29
|
-
const screeningRoom = screeningRoomSection.containedInPlace;
|
|
30
|
-
if (typeof (screeningRoom === null || screeningRoom === void 0 ? void 0 : screeningRoom.branchCode) !== 'string') {
|
|
31
|
-
throw new factory.errors.ArgumentNull('containedInPlace.branchCode');
|
|
32
|
-
}
|
|
33
|
-
const movieTheater = screeningRoom.containedInPlace;
|
|
34
|
-
if (typeof (movieTheater === null || movieTheater === void 0 ? void 0 : movieTheater.branchCode) !== 'string') {
|
|
35
|
-
throw new factory.errors.ArgumentNull('containedInPlace.containedInPlace.branchCode');
|
|
36
|
-
}
|
|
28
|
+
const { project, parentOrganization, movieTheaterCode, roomCode } = options;
|
|
37
29
|
// 施設存在確認
|
|
38
|
-
const movieTheaterDoc = yield this.civicStructureModel.findOne(Object.assign({ typeOf: { $eq: factory.placeType.MovieTheater }, 'project.id': { $eq:
|
|
39
|
-
? { 'parentOrganization.id': { $exists: true, $eq:
|
|
30
|
+
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')
|
|
31
|
+
? { 'parentOrganization.id': { $exists: true, $eq: parentOrganization.id } }
|
|
40
32
|
: undefined), { _id: 1 })
|
|
41
33
|
.lean()
|
|
42
34
|
.exec();
|
|
@@ -46,13 +38,13 @@ class SectionRepo {
|
|
|
46
38
|
// セクションコードが存在しなければ追加する
|
|
47
39
|
const doc = yield this.placeModel.findOneAndUpdate({
|
|
48
40
|
typeOf: { $eq: factory.placeType.ScreeningRoom },
|
|
49
|
-
'project.id': { $eq:
|
|
50
|
-
'containedInPlace.branchCode': { $exists: true, $eq:
|
|
51
|
-
branchCode: { $eq:
|
|
41
|
+
'project.id': { $eq: project.id },
|
|
42
|
+
'containedInPlace.branchCode': { $exists: true, $eq: movieTheaterCode },
|
|
43
|
+
branchCode: { $eq: roomCode },
|
|
52
44
|
'containsPlace.branchCode': { $ne: screeningRoomSection.branchCode }
|
|
53
45
|
}, {
|
|
54
46
|
$push: {
|
|
55
|
-
containsPlace: Object.assign({ typeOf:
|
|
47
|
+
containsPlace: Object.assign({ typeOf: factory.placeType.ScreeningRoomSection, branchCode: screeningRoomSection.branchCode, name: screeningRoomSection.name }, (Array.isArray(screeningRoomSection.additionalProperty))
|
|
56
48
|
? { additionalProperty: screeningRoomSection.additionalProperty }
|
|
57
49
|
: undefined)
|
|
58
50
|
}
|
|
@@ -72,19 +64,11 @@ class SectionRepo {
|
|
|
72
64
|
* セクションの名称と追加特性を編集する
|
|
73
65
|
*/
|
|
74
66
|
// tslint:disable-next-line:max-func-body-length
|
|
75
|
-
updateSectionByBranchCode(screeningRoomSection, $unset) {
|
|
67
|
+
updateSectionByBranchCode(screeningRoomSection, $unset, options) {
|
|
76
68
|
return __awaiter(this, void 0, void 0, function* () {
|
|
77
|
-
|
|
78
|
-
const
|
|
79
|
-
|
|
80
|
-
throw new factory.errors.ArgumentNull('containedInPlace.branchCode');
|
|
81
|
-
}
|
|
82
|
-
const movieTheater = screeningRoom.containedInPlace;
|
|
83
|
-
if (typeof (movieTheater === null || movieTheater === void 0 ? void 0 : movieTheater.branchCode) !== 'string') {
|
|
84
|
-
throw new factory.errors.ArgumentNull('containedInPlace.containedInPlace.branchCode');
|
|
85
|
-
}
|
|
86
|
-
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')
|
|
87
|
-
? { 'parentOrganization.id': { $exists: true, $eq: screeningRoomSection.parentOrganization.id } }
|
|
69
|
+
const { project, parentOrganization, movieTheaterCode, roomCode } = options;
|
|
70
|
+
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: screeningRoomSection.branchCode } }, (typeof (parentOrganization === null || parentOrganization === void 0 ? void 0 : parentOrganization.id) === 'string')
|
|
71
|
+
? { 'parentOrganization.id': { $exists: true, $eq: parentOrganization.id } }
|
|
88
72
|
: undefined), Object.assign(Object.assign(Object.assign({ 'containsPlace.$[screeningRoomSection].branchCode': screeningRoomSection.branchCode }, (screeningRoomSection.name !== undefined && screeningRoomSection !== null)
|
|
89
73
|
? {
|
|
90
74
|
'containsPlace.$[screeningRoomSection].name': screeningRoomSection.name
|
|
@@ -111,23 +95,15 @@ class SectionRepo {
|
|
|
111
95
|
* セクションの座席を上書きする
|
|
112
96
|
*/
|
|
113
97
|
// tslint:disable-next-line:max-func-body-length
|
|
114
|
-
overwriteSeats(screeningRoomSection) {
|
|
98
|
+
overwriteSeats(screeningRoomSection, options) {
|
|
115
99
|
return __awaiter(this, void 0, void 0, function* () {
|
|
116
|
-
|
|
117
|
-
const {
|
|
118
|
-
const screeningRoom = containedInPlace;
|
|
119
|
-
if (typeof (screeningRoom === null || screeningRoom === void 0 ? void 0 : screeningRoom.branchCode) !== 'string') {
|
|
120
|
-
throw new factory.errors.ArgumentNull('containedInPlace.branchCode');
|
|
121
|
-
}
|
|
122
|
-
const movieTheater = screeningRoom.containedInPlace;
|
|
123
|
-
if (typeof (movieTheater === null || movieTheater === void 0 ? void 0 : movieTheater.branchCode) !== 'string') {
|
|
124
|
-
throw new factory.errors.ArgumentNull('containedInPlace.containedInPlace.branchCode');
|
|
125
|
-
}
|
|
100
|
+
const { project, parentOrganization, movieTheaterCode, roomCode } = options;
|
|
101
|
+
const { containsPlace } = screeningRoomSection;
|
|
126
102
|
if (!Array.isArray(containsPlace)) {
|
|
127
103
|
throw new factory.errors.ArgumentNull('containsPlace');
|
|
128
104
|
}
|
|
129
|
-
const doc = yield this.placeModel.findOneAndUpdate(Object.assign({ typeOf: { $eq: factory.placeType.ScreeningRoom }, 'project.id': { $eq:
|
|
130
|
-
? { 'parentOrganization.id': { $exists: true, $eq:
|
|
105
|
+
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: screeningRoomSection.branchCode } }, (typeof (parentOrganization === null || parentOrganization === void 0 ? void 0 : parentOrganization.id) === 'string')
|
|
106
|
+
? { 'parentOrganization.id': { $exists: true, $eq: parentOrganization.id } }
|
|
131
107
|
: undefined), Object.assign({}, (containsPlace.length > 0)
|
|
132
108
|
? {
|
|
133
109
|
'containsPlace.$[screeningRoomSection].containsPlace': containsPlace.map((p) => {
|
|
@@ -366,14 +342,14 @@ class SectionRepo {
|
|
|
366
342
|
.exec();
|
|
367
343
|
});
|
|
368
344
|
}
|
|
369
|
-
|
|
345
|
+
deleteSectionByBranchCode(screeningRoomSection, options) {
|
|
370
346
|
return __awaiter(this, void 0, void 0, function* () {
|
|
371
|
-
|
|
372
|
-
const doc = yield this.placeModel.findOneAndUpdate(Object.assign({ typeOf: { $eq: factory.placeType.ScreeningRoom }, 'project.id': { $eq:
|
|
347
|
+
const { project, parentOrganization, movieTheaterCode, roomCode } = options;
|
|
348
|
+
const doc = yield this.placeModel.findOneAndUpdate(Object.assign({ typeOf: { $eq: factory.placeType.ScreeningRoom }, 'project.id': { $eq: project.id }, 'containedInPlace.branchCode': {
|
|
373
349
|
$exists: true,
|
|
374
|
-
$eq:
|
|
375
|
-
}, branchCode: { $eq:
|
|
376
|
-
? { 'parentOrganization.id': { $exists: true, $eq:
|
|
350
|
+
$eq: movieTheaterCode
|
|
351
|
+
}, branchCode: { $eq: roomCode }, 'containsPlace.branchCode': { $eq: screeningRoomSection.branchCode } }, (typeof (parentOrganization === null || parentOrganization === void 0 ? void 0 : parentOrganization.id) === 'string')
|
|
352
|
+
? { 'parentOrganization.id': { $exists: true, $eq: parentOrganization.id } }
|
|
377
353
|
: undefined), {
|
|
378
354
|
$pull: {
|
|
379
355
|
containsPlace: {
|
package/package.json
CHANGED