@chevre/domain 23.2.0-alpha.2 → 23.2.0-alpha.20
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/actions/checkAuthorizePaymentActions.ts +55 -0
- package/example/src/chevre/event/importEventsFromCOAByTitle.ts +1 -1
- package/example/src/chevre/eventSeries/migrateEventSeriesOffers.ts +75 -0
- package/example/src/chevre/eventSeries/migrateEventSeriesVideoFormat.ts +80 -0
- package/example/src/chevre/place/adminEntranceGates.ts +68 -0
- package/example/src/chevre/place/checkEntranceGatesCount.ts +82 -0
- package/example/src/chevre/place/findRooms.ts +24 -0
- package/example/src/chevre/place/findSections.ts +28 -0
- package/example/src/chevre/place/migrateSectionIdentifier.ts +92 -0
- package/example/src/chevre/place/seatsJson2csv.ts +63 -0
- package/example/src/chevre/place/upsertSeatsByBranchCode.ts +72 -0
- package/example/src/chevre/reIndex.ts +1 -1
- package/example/src/chevre/roles/addAdminEventSeriesReadPermissionIfNotExists.ts +49 -0
- package/example/src/chevre/roles/addAdminMovieReadPermissionIfNotExists.ts +49 -0
- package/example/src/chevre/roles/addAdminMovieTheaterReadPermissionIfNotExists.ts +34 -0
- package/example/src/chevre/roles/addAdminMovieTheaterWritePermissionIfNotExists.ts +34 -0
- package/example/src/chevre/roles/addAdminRoomReadPermissionIfNotExists.ts +34 -0
- package/example/src/chevre/roles/addAdminRoomWritePermissionIfNotExists.ts +34 -0
- package/lib/chevre/repo/acceptedPaymentMethod.js +14 -10
- package/lib/chevre/repo/aggregateOrder.js +0 -93
- package/lib/chevre/repo/aggregateReservation.d.ts +0 -1
- package/lib/chevre/repo/aggregateReservation.js +0 -2
- package/lib/chevre/repo/creativeWork.js +9 -5
- package/lib/chevre/repo/eventSeries.js +16 -12
- package/lib/chevre/repo/mongoose/schemas/aggregateReservation.js +0 -1
- package/lib/chevre/repo/mongoose/schemas/creativeWork.js +10 -9
- package/lib/chevre/repo/mongoose/schemas/eventSeries.js +10 -0
- package/lib/chevre/repo/place/entranceGate.d.ts +58 -0
- package/lib/chevre/repo/place/entranceGate.js +159 -0
- package/lib/chevre/repo/place/movieTheater.d.ts +5 -2
- package/lib/chevre/repo/place/movieTheater.js +3 -1
- package/lib/chevre/repo/place/screeningRoom.d.ts +38 -31
- package/lib/chevre/repo/place/screeningRoom.js +166 -135
- package/lib/chevre/repo/place/seat.d.ts +47 -45
- package/lib/chevre/repo/place/seat.js +175 -45
- package/lib/chevre/repo/place/section.d.ts +36 -30
- package/lib/chevre/repo/place/section.js +214 -130
- package/lib/chevre/repository.d.ts +8 -0
- package/lib/chevre/repository.js +16 -0
- package/lib/chevre/service/assetTransaction/pay/validateAcceptedPaymentMethodIfNeeded.d.ts +6 -1
- package/lib/chevre/service/assetTransaction/pay/validateAcceptedPaymentMethodIfNeeded.js +26 -4
- package/lib/chevre/service/assetTransaction/pay.d.ts +3 -0
- package/lib/chevre/service/event/processUpdateMovieTheater.d.ts +1 -1
- package/lib/chevre/service/event/processUpdateMovieTheater.js +1 -1
- package/lib/chevre/service/event/saveScreeningEvents.d.ts +1 -1
- package/lib/chevre/service/event/saveScreeningEvents.js +1 -1
- package/lib/chevre/service/offer/event/searchEventTicketOffers.js +7 -4
- package/lib/chevre/service/offer/event/searchOfferAppliesToMovieTicket.js +9 -6
- package/lib/chevre/service/offer/event/searchOffersByIds.js +7 -4
- package/lib/chevre/service/offer/onEventChanged.js +7 -5
- package/lib/chevre/service/payment/any/factory.d.ts +5 -0
- package/lib/chevre/service/payment/any/factory.js +11 -2
- package/lib/chevre/service/payment/any.d.ts +8 -0
- package/lib/chevre/service/payment/any.js +3 -2
- package/lib/chevre/service/task/authorizePayment.js +3 -1
- package/lib/chevre/service/task/createEvent/createEventBySchedule/factory.d.ts +1 -1
- package/lib/chevre/service/task/createEvent/createEventBySchedule/factory.js +2 -2
- package/lib/chevre/service/task/createEvent/createEventBySchedule/schedule2events.js +1 -1
- package/lib/chevre/service/task/onResourceUpdated.js +2 -2
- package/lib/chevre/service/task/publishPaymentUrl.js +3 -1
- package/lib/chevre/service/task/syncResourcesFromCOA.js +1 -1
- package/lib/chevre/service/transaction/placeOrder/confirm/validation/factory.d.ts +2 -2
- package/lib/chevre/service/transaction/placeOrder/confirm/validation.js +3 -1
- package/lib/chevre/service/transaction/placeOrder/confirm.js +3 -1
- package/package.json +3 -2
- package/lib/chevre/service/eventOld.d.ts +0 -60
- package/lib/chevre/service/eventOld.js +0 -864
|
@@ -33,6 +33,120 @@ class ScreeningRoomRepo {
|
|
|
33
33
|
this.civicStructureModel = connection.model(civicStructure_1.modelName, (0, civicStructure_1.createSchema)());
|
|
34
34
|
this.placeModel = connection.model(place_1.modelName, (0, place_1.createSchema)());
|
|
35
35
|
}
|
|
36
|
+
// tslint:disable-next-line:max-func-body-length
|
|
37
|
+
static CREATE_ROOM_MONGO_CONDITIONS(searchConditions) {
|
|
38
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
|
|
39
|
+
const matchStages = [{ $match: { typeOf: { $eq: factory.placeType.ScreeningRoom } } }];
|
|
40
|
+
const projectIdEq = (_b = (_a = searchConditions.project) === null || _a === void 0 ? void 0 : _a.id) === null || _b === void 0 ? void 0 : _b.$eq;
|
|
41
|
+
if (typeof projectIdEq === 'string') {
|
|
42
|
+
matchStages.push({
|
|
43
|
+
$match: { 'project.id': { $eq: projectIdEq } }
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
const parentOrganizationIdEq = (_d = (_c = searchConditions.parentOrganization) === null || _c === void 0 ? void 0 : _c.id) === null || _d === void 0 ? void 0 : _d.$eq;
|
|
47
|
+
if (typeof parentOrganizationIdEq === 'string') {
|
|
48
|
+
matchStages.push({
|
|
49
|
+
$match: { 'parentOrganization.id': { $exists: true, $eq: parentOrganizationIdEq } }
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
// 施設ID
|
|
53
|
+
const containedInPlaceIdEq = (_f = (_e = searchConditions.containedInPlace) === null || _e === void 0 ? void 0 : _e.id) === null || _f === void 0 ? void 0 : _f.$eq;
|
|
54
|
+
if (typeof containedInPlaceIdEq === 'string') {
|
|
55
|
+
matchStages.push({
|
|
56
|
+
$match: {
|
|
57
|
+
'containedInPlace.id': {
|
|
58
|
+
$exists: true,
|
|
59
|
+
$eq: containedInPlaceIdEq
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
if (searchConditions.containedInPlace !== undefined) {
|
|
65
|
+
// 施設コード
|
|
66
|
+
if (searchConditions.containedInPlace.branchCode !== undefined) {
|
|
67
|
+
if (typeof searchConditions.containedInPlace.branchCode.$eq === 'string') {
|
|
68
|
+
matchStages.push({
|
|
69
|
+
$match: {
|
|
70
|
+
'containedInPlace.branchCode': {
|
|
71
|
+
$exists: true,
|
|
72
|
+
$eq: searchConditions.containedInPlace.branchCode.$eq
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
const branchCodeEq = (_g = searchConditions.branchCode) === null || _g === void 0 ? void 0 : _g.$eq;
|
|
80
|
+
if (typeof branchCodeEq === 'string') {
|
|
81
|
+
matchStages.push({
|
|
82
|
+
$match: {
|
|
83
|
+
branchCode: { $eq: branchCodeEq }
|
|
84
|
+
}
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
const branchCodeIn = (_h = searchConditions.branchCode) === null || _h === void 0 ? void 0 : _h.$in;
|
|
88
|
+
if (Array.isArray(branchCodeIn)) {
|
|
89
|
+
matchStages.push({
|
|
90
|
+
$match: {
|
|
91
|
+
branchCode: { $in: branchCodeIn }
|
|
92
|
+
}
|
|
93
|
+
});
|
|
94
|
+
}
|
|
95
|
+
const branchCodeRegex = (_j = searchConditions.branchCode) === null || _j === void 0 ? void 0 : _j.$regex;
|
|
96
|
+
if (typeof branchCodeRegex === 'string') {
|
|
97
|
+
matchStages.push({
|
|
98
|
+
$match: {
|
|
99
|
+
branchCode: {
|
|
100
|
+
$regex: new RegExp(branchCodeRegex)
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
});
|
|
104
|
+
}
|
|
105
|
+
const nameCodeRegex = (_k = searchConditions.name) === null || _k === void 0 ? void 0 : _k.$regex;
|
|
106
|
+
if (typeof nameCodeRegex === 'string') {
|
|
107
|
+
matchStages.push({
|
|
108
|
+
$match: {
|
|
109
|
+
$or: [
|
|
110
|
+
{
|
|
111
|
+
'name.ja': {
|
|
112
|
+
$exists: true,
|
|
113
|
+
$regex: new RegExp(nameCodeRegex)
|
|
114
|
+
}
|
|
115
|
+
},
|
|
116
|
+
{
|
|
117
|
+
'name.en': {
|
|
118
|
+
$exists: true,
|
|
119
|
+
$regex: new RegExp(nameCodeRegex)
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
]
|
|
123
|
+
}
|
|
124
|
+
});
|
|
125
|
+
}
|
|
126
|
+
const openSeatingAllowed = searchConditions.openSeatingAllowed;
|
|
127
|
+
if (typeof openSeatingAllowed === 'boolean') {
|
|
128
|
+
matchStages.push({
|
|
129
|
+
$match: {
|
|
130
|
+
openSeatingAllowed: {
|
|
131
|
+
$exists: true,
|
|
132
|
+
$eq: openSeatingAllowed
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
});
|
|
136
|
+
}
|
|
137
|
+
const additionalPropertyElemMatch = (_l = searchConditions.additionalProperty) === null || _l === void 0 ? void 0 : _l.$elemMatch;
|
|
138
|
+
if (additionalPropertyElemMatch !== undefined && additionalPropertyElemMatch !== null) {
|
|
139
|
+
matchStages.push({
|
|
140
|
+
$match: {
|
|
141
|
+
additionalProperty: {
|
|
142
|
+
$exists: true,
|
|
143
|
+
$elemMatch: additionalPropertyElemMatch
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
});
|
|
147
|
+
}
|
|
148
|
+
return matchStages;
|
|
149
|
+
}
|
|
36
150
|
saveScreeningRooms4coa(params) {
|
|
37
151
|
return __awaiter(this, void 0, void 0, function* () {
|
|
38
152
|
const { containsPlace } = params, movieTheater4update = __rest(params, ["containsPlace"]);
|
|
@@ -79,29 +193,24 @@ class ScreeningRoomRepo {
|
|
|
79
193
|
})));
|
|
80
194
|
});
|
|
81
195
|
}
|
|
82
|
-
|
|
196
|
+
createRoom(screeningRoom, options) {
|
|
83
197
|
return __awaiter(this, void 0, void 0, function* () {
|
|
84
|
-
|
|
198
|
+
const { project, parentOrganization, movieTheaterCode } = options;
|
|
85
199
|
// 施設存在確認
|
|
86
|
-
const
|
|
87
|
-
? { 'parentOrganization.id': { $exists: true, $eq:
|
|
200
|
+
const movieTheater = 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')
|
|
201
|
+
? { 'parentOrganization.id': { $exists: true, $eq: parentOrganization.id } }
|
|
88
202
|
: undefined), { _id: 0, id: { $toString: '$_id' }, typeOf: 1, branchCode: 1, name: 1, parentOrganization: 1 })
|
|
89
203
|
.lean()
|
|
90
204
|
.exec();
|
|
91
|
-
if (
|
|
205
|
+
if (movieTheater === null) {
|
|
92
206
|
throw new factory.errors.NotFound(factory.placeType.MovieTheater);
|
|
93
207
|
}
|
|
94
|
-
|
|
95
|
-
// factory.place.movieTheater.IPlace,
|
|
96
|
-
// 'id' | 'typeOf' | 'branchCode' | 'name' | 'parentOrganization'
|
|
97
|
-
// >>movieTheaterDoc.toObject();
|
|
98
|
-
const movieTheater = movieTheaterDoc;
|
|
99
|
-
const creatingScreeningRoom = Object.assign({ typeOf: screeningRoom.typeOf, branchCode: screeningRoom.branchCode, name: screeningRoom.name, address: screeningRoom.address, additionalProperty: (Array.isArray(screeningRoom.additionalProperty)) ? screeningRoom.additionalProperty : [], containedInPlace: {
|
|
208
|
+
const creatingScreeningRoom = Object.assign({ typeOf: factory.placeType.ScreeningRoom, branchCode: screeningRoom.branchCode, name: screeningRoom.name, address: screeningRoom.address, additionalProperty: (Array.isArray(screeningRoom.additionalProperty)) ? screeningRoom.additionalProperty : [], containedInPlace: {
|
|
100
209
|
id: movieTheater.id,
|
|
101
210
|
typeOf: movieTheater.typeOf,
|
|
102
211
|
branchCode: movieTheater.branchCode,
|
|
103
212
|
name: movieTheater.name
|
|
104
|
-
}, containsPlace: [], project:
|
|
213
|
+
}, containsPlace: [], project: { id: project.id, typeOf: factory.organizationType.Project },
|
|
105
214
|
// 必須化(2023-07-14~)
|
|
106
215
|
parentOrganization: movieTheater.parentOrganization }, (typeof screeningRoom.openSeatingAllowed === 'boolean')
|
|
107
216
|
? { openSeatingAllowed: screeningRoom.openSeatingAllowed }
|
|
@@ -125,11 +234,11 @@ class ScreeningRoomRepo {
|
|
|
125
234
|
};
|
|
126
235
|
});
|
|
127
236
|
}
|
|
128
|
-
|
|
237
|
+
updateRoomByBranchCode(screeningRoom, $unset, options) {
|
|
129
238
|
return __awaiter(this, void 0, void 0, function* () {
|
|
130
|
-
|
|
131
|
-
const doc = yield this.placeModel.findOneAndUpdate(Object.assign({ typeOf: { $eq: factory.placeType.ScreeningRoom }, 'project.id': { $eq:
|
|
132
|
-
? { 'parentOrganization.id': { $exists: true, $eq:
|
|
239
|
+
const { project, parentOrganization, movieTheaterCode } = options;
|
|
240
|
+
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: screeningRoom.branchCode }, (typeof (parentOrganization === null || parentOrganization === void 0 ? void 0 : parentOrganization.id) === 'string')
|
|
241
|
+
? { 'parentOrganization.id': { $exists: true, $eq: parentOrganization.id } }
|
|
133
242
|
: undefined), Object.assign(Object.assign(Object.assign(Object.assign({ name: screeningRoom.name }, (screeningRoom.address !== undefined && screeningRoom.address !== null)
|
|
134
243
|
? { address: screeningRoom.address }
|
|
135
244
|
: undefined), (typeof screeningRoom.openSeatingAllowed === 'boolean')
|
|
@@ -169,11 +278,11 @@ class ScreeningRoomRepo {
|
|
|
169
278
|
}
|
|
170
279
|
});
|
|
171
280
|
}
|
|
172
|
-
|
|
281
|
+
deleteRoomByBranchCode(screeningRoom, options) {
|
|
173
282
|
return __awaiter(this, void 0, void 0, function* () {
|
|
174
|
-
|
|
175
|
-
const doc = yield this.placeModel.findOneAndDelete(Object.assign({ typeOf: { $eq: factory.placeType.ScreeningRoom }, 'project.id': { $eq:
|
|
176
|
-
? { 'parentOrganization.id': { $exists: true, $eq:
|
|
283
|
+
const { project, parentOrganization, movieTheaterCode } = options;
|
|
284
|
+
const doc = yield this.placeModel.findOneAndDelete(Object.assign({ typeOf: { $eq: factory.placeType.ScreeningRoom }, 'project.id': { $eq: project.id }, 'containedInPlace.branchCode': { $exists: true, $eq: movieTheaterCode }, branchCode: screeningRoom.branchCode }, (typeof (parentOrganization === null || parentOrganization === void 0 ? void 0 : parentOrganization.id) === 'string')
|
|
285
|
+
? { 'parentOrganization.id': { $exists: true, $eq: parentOrganization.id } }
|
|
177
286
|
: undefined), {
|
|
178
287
|
projection: { 'containedInPlace.id': 1, typeOf: 1 }
|
|
179
288
|
})
|
|
@@ -194,130 +303,19 @@ class ScreeningRoomRepo {
|
|
|
194
303
|
.exec();
|
|
195
304
|
});
|
|
196
305
|
}
|
|
197
|
-
// tslint:disable-next-line:cyclomatic-complexity max-func-body-length
|
|
198
306
|
searchScreeningRooms(searchConditions) {
|
|
199
307
|
return __awaiter(this, void 0, void 0, function* () {
|
|
200
|
-
var _a, _b
|
|
201
|
-
const matchStages = [{ $match: { typeOf: { $eq: factory.placeType.ScreeningRoom } } }];
|
|
202
|
-
const projectIdEq = (_b = (_a = searchConditions.project) === null || _a === void 0 ? void 0 : _a.id) === null || _b === void 0 ? void 0 : _b.$eq;
|
|
203
|
-
if (typeof projectIdEq === 'string') {
|
|
204
|
-
matchStages.push({
|
|
205
|
-
$match: { 'project.id': { $eq: projectIdEq } }
|
|
206
|
-
});
|
|
207
|
-
}
|
|
208
|
-
const parentOrganizationIdEq = (_d = (_c = searchConditions.parentOrganization) === null || _c === void 0 ? void 0 : _c.id) === null || _d === void 0 ? void 0 : _d.$eq;
|
|
209
|
-
if (typeof parentOrganizationIdEq === 'string') {
|
|
210
|
-
matchStages.push({
|
|
211
|
-
$match: { 'parentOrganization.id': { $exists: true, $eq: parentOrganizationIdEq } }
|
|
212
|
-
});
|
|
213
|
-
}
|
|
214
|
-
// 施設ID
|
|
215
|
-
const containedInPlaceIdEq = (_f = (_e = searchConditions.containedInPlace) === null || _e === void 0 ? void 0 : _e.id) === null || _f === void 0 ? void 0 : _f.$eq;
|
|
216
|
-
if (typeof containedInPlaceIdEq === 'string') {
|
|
217
|
-
matchStages.push({
|
|
218
|
-
$match: {
|
|
219
|
-
'containedInPlace.id': {
|
|
220
|
-
$exists: true,
|
|
221
|
-
$eq: containedInPlaceIdEq
|
|
222
|
-
}
|
|
223
|
-
}
|
|
224
|
-
});
|
|
225
|
-
}
|
|
226
|
-
if (searchConditions.containedInPlace !== undefined) {
|
|
227
|
-
// 施設コード
|
|
228
|
-
if (searchConditions.containedInPlace.branchCode !== undefined) {
|
|
229
|
-
if (typeof searchConditions.containedInPlace.branchCode.$eq === 'string') {
|
|
230
|
-
matchStages.push({
|
|
231
|
-
$match: {
|
|
232
|
-
'containedInPlace.branchCode': {
|
|
233
|
-
$exists: true,
|
|
234
|
-
$eq: searchConditions.containedInPlace.branchCode.$eq
|
|
235
|
-
}
|
|
236
|
-
}
|
|
237
|
-
});
|
|
238
|
-
}
|
|
239
|
-
}
|
|
240
|
-
}
|
|
241
|
-
const branchCodeEq = (_g = searchConditions.branchCode) === null || _g === void 0 ? void 0 : _g.$eq;
|
|
242
|
-
if (typeof branchCodeEq === 'string') {
|
|
243
|
-
matchStages.push({
|
|
244
|
-
$match: {
|
|
245
|
-
branchCode: { $eq: branchCodeEq }
|
|
246
|
-
}
|
|
247
|
-
});
|
|
248
|
-
}
|
|
249
|
-
const branchCodeIn = (_h = searchConditions.branchCode) === null || _h === void 0 ? void 0 : _h.$in;
|
|
250
|
-
if (Array.isArray(branchCodeIn)) {
|
|
251
|
-
matchStages.push({
|
|
252
|
-
$match: {
|
|
253
|
-
branchCode: { $in: branchCodeIn }
|
|
254
|
-
}
|
|
255
|
-
});
|
|
256
|
-
}
|
|
257
|
-
const branchCodeRegex = (_j = searchConditions.branchCode) === null || _j === void 0 ? void 0 : _j.$regex;
|
|
258
|
-
if (typeof branchCodeRegex === 'string') {
|
|
259
|
-
matchStages.push({
|
|
260
|
-
$match: {
|
|
261
|
-
branchCode: {
|
|
262
|
-
$regex: new RegExp(branchCodeRegex)
|
|
263
|
-
}
|
|
264
|
-
}
|
|
265
|
-
});
|
|
266
|
-
}
|
|
267
|
-
const nameCodeRegex = (_k = searchConditions.name) === null || _k === void 0 ? void 0 : _k.$regex;
|
|
268
|
-
if (typeof nameCodeRegex === 'string') {
|
|
269
|
-
matchStages.push({
|
|
270
|
-
$match: {
|
|
271
|
-
$or: [
|
|
272
|
-
{
|
|
273
|
-
'name.ja': {
|
|
274
|
-
$exists: true,
|
|
275
|
-
$regex: new RegExp(nameCodeRegex)
|
|
276
|
-
}
|
|
277
|
-
},
|
|
278
|
-
{
|
|
279
|
-
'name.en': {
|
|
280
|
-
$exists: true,
|
|
281
|
-
$regex: new RegExp(nameCodeRegex)
|
|
282
|
-
}
|
|
283
|
-
}
|
|
284
|
-
]
|
|
285
|
-
}
|
|
286
|
-
});
|
|
287
|
-
}
|
|
288
|
-
const openSeatingAllowed = searchConditions.openSeatingAllowed;
|
|
289
|
-
if (typeof openSeatingAllowed === 'boolean') {
|
|
290
|
-
matchStages.push({
|
|
291
|
-
$match: {
|
|
292
|
-
openSeatingAllowed: {
|
|
293
|
-
$exists: true,
|
|
294
|
-
$eq: openSeatingAllowed
|
|
295
|
-
}
|
|
296
|
-
}
|
|
297
|
-
});
|
|
298
|
-
}
|
|
299
|
-
const additionalPropertyElemMatch = (_l = searchConditions.additionalProperty) === null || _l === void 0 ? void 0 : _l.$elemMatch;
|
|
300
|
-
if (additionalPropertyElemMatch !== undefined && additionalPropertyElemMatch !== null) {
|
|
301
|
-
matchStages.push({
|
|
302
|
-
$match: {
|
|
303
|
-
additionalProperty: {
|
|
304
|
-
$exists: true,
|
|
305
|
-
$elemMatch: additionalPropertyElemMatch
|
|
306
|
-
}
|
|
307
|
-
}
|
|
308
|
-
});
|
|
309
|
-
}
|
|
308
|
+
var _a, _b;
|
|
310
309
|
const aggregate = this.placeModel.aggregate([
|
|
311
310
|
{ $sort: { branchCode: factory.sortType.Ascending } },
|
|
312
|
-
|
|
313
|
-
...matchStages,
|
|
311
|
+
...ScreeningRoomRepo.CREATE_ROOM_MONGO_CONDITIONS(searchConditions),
|
|
314
312
|
{
|
|
315
313
|
$project: Object.assign(Object.assign({ _id: 0, typeOf: '$typeOf', branchCode: '$branchCode', name: '$name', address: '$address', containedInPlace: {
|
|
316
314
|
id: '$containedInPlace.id',
|
|
317
315
|
typeOf: '$containedInPlace.typeOf',
|
|
318
316
|
branchCode: '$containedInPlace.branchCode',
|
|
319
317
|
name: '$containedInPlace.name'
|
|
320
|
-
}, openSeatingAllowed: '$openSeatingAllowed', additionalProperty: '$additionalProperty', maximumAttendeeCapacity: '$maximumAttendeeCapacity' }, (((
|
|
318
|
+
}, openSeatingAllowed: '$openSeatingAllowed', additionalProperty: '$additionalProperty', maximumAttendeeCapacity: '$maximumAttendeeCapacity' }, (((_a = searchConditions.$projection) === null || _a === void 0 ? void 0 : _a.sectionCount) === 1)
|
|
321
319
|
? {
|
|
322
320
|
sectionCount: {
|
|
323
321
|
$cond: {
|
|
@@ -327,7 +325,7 @@ class ScreeningRoomRepo {
|
|
|
327
325
|
}
|
|
328
326
|
}
|
|
329
327
|
}
|
|
330
|
-
: undefined), (((
|
|
328
|
+
: undefined), (((_b = searchConditions.$projection) === null || _b === void 0 ? void 0 : _b.seatCount) === 1)
|
|
331
329
|
? {
|
|
332
330
|
seatCount: {
|
|
333
331
|
$sum: {
|
|
@@ -359,6 +357,34 @@ class ScreeningRoomRepo {
|
|
|
359
357
|
.exec();
|
|
360
358
|
});
|
|
361
359
|
}
|
|
360
|
+
findRooms(params) {
|
|
361
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
362
|
+
const aggregate = this.placeModel.aggregate([
|
|
363
|
+
...ScreeningRoomRepo.CREATE_ROOM_MONGO_CONDITIONS(params),
|
|
364
|
+
{
|
|
365
|
+
$project: {
|
|
366
|
+
_id: 0,
|
|
367
|
+
branchCode: '$branchCode',
|
|
368
|
+
name: '$name',
|
|
369
|
+
address: '$address',
|
|
370
|
+
openSeatingAllowed: '$openSeatingAllowed',
|
|
371
|
+
additionalProperty: '$additionalProperty',
|
|
372
|
+
maximumAttendeeCapacity: '$maximumAttendeeCapacity'
|
|
373
|
+
}
|
|
374
|
+
},
|
|
375
|
+
{ $sort: { branchCode: factory.sortType.Ascending } }
|
|
376
|
+
]);
|
|
377
|
+
const { limit, page } = params;
|
|
378
|
+
if (typeof limit === 'number' && limit > 0) {
|
|
379
|
+
const pageMustBePositive = (typeof page === 'number' && page > 0) ? page : 1;
|
|
380
|
+
aggregate.skip(limit * (pageMustBePositive - 1))
|
|
381
|
+
.limit(limit);
|
|
382
|
+
}
|
|
383
|
+
return aggregate
|
|
384
|
+
.option({ maxTimeMS: settings_1.MONGO_MAX_TIME_MS })
|
|
385
|
+
.exec();
|
|
386
|
+
});
|
|
387
|
+
}
|
|
362
388
|
/**
|
|
363
389
|
* セクションと座席も含めたひとつのルームを取得する
|
|
364
390
|
*/
|
|
@@ -430,5 +456,10 @@ class ScreeningRoomRepo {
|
|
|
430
456
|
.exec();
|
|
431
457
|
});
|
|
432
458
|
}
|
|
459
|
+
getCursor(conditions, projection) {
|
|
460
|
+
return this.placeModel.find(conditions, projection)
|
|
461
|
+
.sort({ branchCode: factory.sortType.Ascending })
|
|
462
|
+
.cursor();
|
|
463
|
+
}
|
|
433
464
|
}
|
|
434
465
|
exports.ScreeningRoomRepo = ScreeningRoomRepo;
|
|
@@ -1,6 +1,19 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { BulkWriteResult } from 'mongodb';
|
|
2
|
+
import { AnyExpression, Connection, PipelineStage } from 'mongoose';
|
|
2
3
|
import * as factory from '../../factory';
|
|
3
4
|
type IMatchStage = PipelineStage.Match;
|
|
5
|
+
type ICreatingSeat = Pick<factory.place.seat.IPlace, 'additionalProperty' | 'branchCode' | 'name' | 'maximumAttendeeCapacity' | 'seatingType'>;
|
|
6
|
+
interface IUpdateOptions {
|
|
7
|
+
project: {
|
|
8
|
+
id: string;
|
|
9
|
+
};
|
|
10
|
+
parentOrganization?: {
|
|
11
|
+
id?: string;
|
|
12
|
+
};
|
|
13
|
+
movieTheaterCode: string;
|
|
14
|
+
roomCode: string;
|
|
15
|
+
sectionCode: string;
|
|
16
|
+
}
|
|
4
17
|
/**
|
|
5
18
|
* 座席編集時レスポンス
|
|
6
19
|
*/
|
|
@@ -27,25 +40,27 @@ export declare class SeatRepo {
|
|
|
27
40
|
static CREATE_MATCH_STAGES(params: factory.place.seat.ISearchConditions, options: {
|
|
28
41
|
filterTypeOf: boolean;
|
|
29
42
|
}): IMatchStage[];
|
|
30
|
-
createSeat(seat:
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
id?: string;
|
|
43
|
+
createSeat(seat: ICreatingSeat, options: IUpdateOptions): Promise<IUpdateSeatResult>;
|
|
44
|
+
/**
|
|
45
|
+
* コードをキーにして冪等追加
|
|
46
|
+
*/
|
|
47
|
+
addSeatsByBranchCodeIfNotExist(params: {
|
|
48
|
+
$set: ICreatingSeat;
|
|
49
|
+
}[], options: IUpdateOptions): Promise<{
|
|
50
|
+
bulkWriteResult: BulkWriteResult;
|
|
51
|
+
} | void>;
|
|
52
|
+
/**
|
|
53
|
+
* コードをキーにして冪等編集
|
|
54
|
+
*/
|
|
55
|
+
updateSeatsByBranchCode(params: {
|
|
56
|
+
$set: ICreatingSeat;
|
|
57
|
+
$unset?: {
|
|
58
|
+
[key in keyof ICreatingSeat]?: 1;
|
|
47
59
|
};
|
|
48
|
-
},
|
|
60
|
+
}[], options: IUpdateOptions): Promise<{
|
|
61
|
+
bulkWriteResult: BulkWriteResult;
|
|
62
|
+
} | void>;
|
|
63
|
+
updateSeatByBranchCode(seat: ICreatingSeat, $unset: any, options: IUpdateOptions): Promise<IUpdateSeatResult>;
|
|
49
64
|
searchSeats(params: factory.place.seat.ISearchConditions): Promise<factory.place.seat.IPlace[]>;
|
|
50
65
|
projectSeatsByScreeningRoom(params: Pick<factory.place.seat.ISearchConditions, '$projection' | 'additionalProperty' | 'branchCode' | 'seatingType' | 'name' | 'limit' | 'page'> & {
|
|
51
66
|
project: {
|
|
@@ -137,35 +152,22 @@ export declare class SeatRepo {
|
|
|
137
152
|
};
|
|
138
153
|
};
|
|
139
154
|
}): Promise<string[]>;
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
parentOrganization?: {
|
|
145
|
-
id?: string;
|
|
146
|
-
};
|
|
155
|
+
/**
|
|
156
|
+
* コードをキーにして冪等削除
|
|
157
|
+
*/
|
|
158
|
+
deleteSeatsByBranchCode(params: {
|
|
147
159
|
/**
|
|
148
160
|
* 座席コード
|
|
149
161
|
*/
|
|
150
162
|
branchCode: string;
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
branchCode: string;
|
|
161
|
-
containedInPlace: {
|
|
162
|
-
/**
|
|
163
|
-
* 施設コード
|
|
164
|
-
*/
|
|
165
|
-
branchCode: string;
|
|
166
|
-
};
|
|
167
|
-
};
|
|
168
|
-
};
|
|
169
|
-
}): Promise<IUpdateSeatResult>;
|
|
163
|
+
}[], options: IUpdateOptions): Promise<{
|
|
164
|
+
bulkWriteResult: BulkWriteResult;
|
|
165
|
+
} | void>;
|
|
166
|
+
deleteSeatByBranchCode(seat: {
|
|
167
|
+
/**
|
|
168
|
+
* 座席コード
|
|
169
|
+
*/
|
|
170
|
+
branchCode: string;
|
|
171
|
+
}, options: IUpdateOptions): Promise<IUpdateSeatResult>;
|
|
170
172
|
}
|
|
171
173
|
export {};
|