@chevre/domain 22.9.0-alpha.105 → 22.9.0-alpha.106
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,5 +1,6 @@
|
|
|
1
|
-
import type { AnyExpression, Connection } from 'mongoose';
|
|
1
|
+
import type { AnyExpression, Connection, PipelineStage } from 'mongoose';
|
|
2
2
|
import * as factory from '../../factory';
|
|
3
|
+
type IMatchStage = PipelineStage.Match;
|
|
3
4
|
/**
|
|
4
5
|
* 座席編集時レスポンス
|
|
5
6
|
*/
|
|
@@ -23,6 +24,7 @@ export declare class SeatRepo {
|
|
|
23
24
|
static CREATE_SEARCH_SEATS_PROJECTION(params: factory.place.seat.IProjection): {
|
|
24
25
|
[field: string]: AnyExpression;
|
|
25
26
|
};
|
|
27
|
+
static CREATE_FILTER_QUERY(params: factory.place.seat.ISearchConditions): IMatchStage[];
|
|
26
28
|
createSeat(seat: factory.place.seat.IPlace & {
|
|
27
29
|
parentOrganization?: {
|
|
28
30
|
id?: string;
|
|
@@ -43,6 +45,7 @@ export declare class SeatRepo {
|
|
|
43
45
|
};
|
|
44
46
|
}, $unset: any): Promise<IUpdateSeatResult>;
|
|
45
47
|
searchSeats(params: factory.place.seat.ISearchConditions): Promise<factory.place.seat.IPlace[]>;
|
|
48
|
+
searchSeatsWithSort(params: factory.place.seat.ISearchConditions): Promise<factory.place.seat.IPlace[]>;
|
|
46
49
|
/**
|
|
47
50
|
* 座席区分集計検索
|
|
48
51
|
*/
|
|
@@ -61,6 +61,153 @@ class SeatRepo {
|
|
|
61
61
|
});
|
|
62
62
|
return projectStage;
|
|
63
63
|
}
|
|
64
|
+
// tslint:disable-next-line:cyclomatic-complexity max-func-body-length
|
|
65
|
+
static CREATE_FILTER_QUERY(params) {
|
|
66
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
|
|
67
|
+
const matchStages = [{ $match: { typeOf: { $eq: factory.placeType.ScreeningRoom } } }];
|
|
68
|
+
const projectIdEq = (_b = (_a = params.project) === null || _a === void 0 ? void 0 : _a.id) === null || _b === void 0 ? void 0 : _b.$eq;
|
|
69
|
+
if (typeof projectIdEq === 'string') {
|
|
70
|
+
matchStages.push({
|
|
71
|
+
$match: { 'project.id': { $eq: projectIdEq } }
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
const parentOrganizationIdEq = (_d = (_c = params.parentOrganization) === null || _c === void 0 ? void 0 : _c.id) === null || _d === void 0 ? void 0 : _d.$eq;
|
|
75
|
+
if (typeof parentOrganizationIdEq === 'string') {
|
|
76
|
+
matchStages.push({
|
|
77
|
+
$match: { 'parentOrganization.id': { $exists: true, $eq: parentOrganizationIdEq } }
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
const containedInPlaceBranchCodeEq = (_f = (_e = params.containedInPlace) === null || _e === void 0 ? void 0 : _e.branchCode) === null || _f === void 0 ? void 0 : _f.$eq;
|
|
81
|
+
if (typeof containedInPlaceBranchCodeEq === 'string') {
|
|
82
|
+
matchStages.push({
|
|
83
|
+
$match: {
|
|
84
|
+
'containsPlace.branchCode': {
|
|
85
|
+
$exists: true,
|
|
86
|
+
$eq: containedInPlaceBranchCodeEq
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
const containedInPlaceBranchCodeIn = (_h = (_g = params.containedInPlace) === null || _g === void 0 ? void 0 : _g.branchCode) === null || _h === void 0 ? void 0 : _h.$in;
|
|
92
|
+
if (Array.isArray(containedInPlaceBranchCodeIn)) {
|
|
93
|
+
matchStages.push({
|
|
94
|
+
$match: {
|
|
95
|
+
'containsPlace.branchCode': {
|
|
96
|
+
$exists: true,
|
|
97
|
+
$in: containedInPlaceBranchCodeIn
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
});
|
|
101
|
+
}
|
|
102
|
+
if (params.containedInPlace !== undefined) {
|
|
103
|
+
if (params.containedInPlace.containedInPlace !== undefined) {
|
|
104
|
+
if (params.containedInPlace.containedInPlace.branchCode !== undefined) {
|
|
105
|
+
if (typeof params.containedInPlace.containedInPlace.branchCode.$eq === 'string') {
|
|
106
|
+
matchStages.push({
|
|
107
|
+
$match: {
|
|
108
|
+
branchCode: {
|
|
109
|
+
$eq: params.containedInPlace.containedInPlace.branchCode.$eq
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
});
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
if (params.containedInPlace.containedInPlace.containedInPlace !== undefined) {
|
|
116
|
+
if (params.containedInPlace.containedInPlace.containedInPlace.branchCode !== undefined) {
|
|
117
|
+
if (typeof params.containedInPlace.containedInPlace.containedInPlace.branchCode.$eq === 'string') {
|
|
118
|
+
matchStages.push({
|
|
119
|
+
$match: {
|
|
120
|
+
'containedInPlace.branchCode': {
|
|
121
|
+
$exists: true,
|
|
122
|
+
$eq: params.containedInPlace.containedInPlace.containedInPlace.branchCode.$eq
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
});
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
// 座席コード
|
|
132
|
+
if (params.branchCode !== undefined) {
|
|
133
|
+
if (typeof params.branchCode.$eq === 'string') {
|
|
134
|
+
matchStages.push({
|
|
135
|
+
$match: {
|
|
136
|
+
'containsPlace.containsPlace.branchCode': {
|
|
137
|
+
$exists: true,
|
|
138
|
+
$eq: params.branchCode.$eq
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
});
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
const branchCodeIn = (_j = params.branchCode) === null || _j === void 0 ? void 0 : _j.$in;
|
|
145
|
+
if (Array.isArray(branchCodeIn)) {
|
|
146
|
+
matchStages.push({
|
|
147
|
+
$match: {
|
|
148
|
+
'containsPlace.containsPlace.branchCode': {
|
|
149
|
+
$exists: true,
|
|
150
|
+
$in: branchCodeIn
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
});
|
|
154
|
+
}
|
|
155
|
+
const branchCodeRegex = (_k = params.branchCode) === null || _k === void 0 ? void 0 : _k.$regex;
|
|
156
|
+
if (typeof branchCodeRegex === 'string' && branchCodeRegex.length > 0) {
|
|
157
|
+
matchStages.push({
|
|
158
|
+
$match: {
|
|
159
|
+
'containsPlace.containsPlace.branchCode': {
|
|
160
|
+
$exists: true,
|
|
161
|
+
$regex: new RegExp(branchCodeRegex)
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
});
|
|
165
|
+
}
|
|
166
|
+
const nameRegex = (_l = params.name) === null || _l === void 0 ? void 0 : _l.$regex;
|
|
167
|
+
if (typeof nameRegex === 'string' && nameRegex.length > 0) {
|
|
168
|
+
matchStages.push({
|
|
169
|
+
$match: {
|
|
170
|
+
$or: [
|
|
171
|
+
{
|
|
172
|
+
'containsPlace.containsPlace.name.ja': {
|
|
173
|
+
$exists: true,
|
|
174
|
+
$regex: new RegExp(nameRegex)
|
|
175
|
+
}
|
|
176
|
+
},
|
|
177
|
+
{
|
|
178
|
+
'containsPlace.containsPlace.name.en': {
|
|
179
|
+
$exists: true,
|
|
180
|
+
$regex: new RegExp(nameRegex)
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
]
|
|
184
|
+
}
|
|
185
|
+
});
|
|
186
|
+
}
|
|
187
|
+
const seatingTypeEq = (_m = params.seatingType) === null || _m === void 0 ? void 0 : _m.$eq;
|
|
188
|
+
if (typeof seatingTypeEq === 'string') {
|
|
189
|
+
matchStages.push({
|
|
190
|
+
$match: {
|
|
191
|
+
'containsPlace.containsPlace.seatingType': {
|
|
192
|
+
$exists: true,
|
|
193
|
+
$eq: seatingTypeEq
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
});
|
|
197
|
+
}
|
|
198
|
+
const additionalPropertyElemMatch = (_o = params.additionalProperty) === null || _o === void 0 ? void 0 : _o.$elemMatch;
|
|
199
|
+
if (additionalPropertyElemMatch !== undefined && additionalPropertyElemMatch !== null) {
|
|
200
|
+
matchStages.push({
|
|
201
|
+
$match: {
|
|
202
|
+
'containsPlace.containsPlace.additionalProperty': {
|
|
203
|
+
$exists: true,
|
|
204
|
+
$elemMatch: additionalPropertyElemMatch
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
});
|
|
208
|
+
}
|
|
209
|
+
return matchStages;
|
|
210
|
+
}
|
|
64
211
|
// tslint:disable-next-line:max-func-body-length
|
|
65
212
|
createSeat(seat) {
|
|
66
213
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -181,351 +328,92 @@ class SeatRepo {
|
|
|
181
328
|
return doc.toObject();
|
|
182
329
|
});
|
|
183
330
|
}
|
|
184
|
-
// tslint:disable-next-line:cyclomatic-complexity max-func-body-length
|
|
185
331
|
searchSeats(params) {
|
|
186
332
|
return __awaiter(this, void 0, void 0, function* () {
|
|
187
|
-
|
|
188
|
-
const
|
|
189
|
-
const
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
});
|
|
194
|
-
}
|
|
195
|
-
const parentOrganizationIdEq = (_d = (_c = params.parentOrganization) === null || _c === void 0 ? void 0 : _c.id) === null || _d === void 0 ? void 0 : _d.$eq;
|
|
196
|
-
if (typeof parentOrganizationIdEq === 'string') {
|
|
197
|
-
matchStages.push({
|
|
198
|
-
$match: { 'parentOrganization.id': { $exists: true, $eq: parentOrganizationIdEq } }
|
|
199
|
-
});
|
|
200
|
-
}
|
|
201
|
-
const containedInPlaceBranchCodeEq = (_f = (_e = params.containedInPlace) === null || _e === void 0 ? void 0 : _e.branchCode) === null || _f === void 0 ? void 0 : _f.$eq;
|
|
202
|
-
if (typeof containedInPlaceBranchCodeEq === 'string') {
|
|
203
|
-
matchStages.push({
|
|
204
|
-
$match: {
|
|
205
|
-
'containsPlace.branchCode': {
|
|
206
|
-
$exists: true,
|
|
207
|
-
$eq: containedInPlaceBranchCodeEq
|
|
208
|
-
}
|
|
209
|
-
}
|
|
210
|
-
});
|
|
211
|
-
}
|
|
212
|
-
const containedInPlaceBranchCodeIn = (_h = (_g = params.containedInPlace) === null || _g === void 0 ? void 0 : _g.branchCode) === null || _h === void 0 ? void 0 : _h.$in;
|
|
213
|
-
if (Array.isArray(containedInPlaceBranchCodeIn)) {
|
|
214
|
-
matchStages.push({
|
|
215
|
-
$match: {
|
|
216
|
-
'containsPlace.branchCode': {
|
|
217
|
-
$exists: true,
|
|
218
|
-
$in: containedInPlaceBranchCodeIn
|
|
219
|
-
}
|
|
220
|
-
}
|
|
221
|
-
});
|
|
222
|
-
}
|
|
223
|
-
if (params.containedInPlace !== undefined) {
|
|
224
|
-
if (params.containedInPlace.containedInPlace !== undefined) {
|
|
225
|
-
if (params.containedInPlace.containedInPlace.branchCode !== undefined) {
|
|
226
|
-
if (typeof params.containedInPlace.containedInPlace.branchCode.$eq === 'string') {
|
|
227
|
-
matchStages.push({
|
|
228
|
-
$match: {
|
|
229
|
-
branchCode: {
|
|
230
|
-
$eq: params.containedInPlace.containedInPlace.branchCode.$eq
|
|
231
|
-
}
|
|
232
|
-
}
|
|
233
|
-
});
|
|
234
|
-
}
|
|
333
|
+
const matchStages = SeatRepo.CREATE_FILTER_QUERY(params);
|
|
334
|
+
const projectStage = SeatRepo.CREATE_SEARCH_SEATS_PROJECTION(Object.assign({}, params.$projection));
|
|
335
|
+
const aggregate = this.placeModel.aggregate([
|
|
336
|
+
{
|
|
337
|
+
$unwind: {
|
|
338
|
+
path: '$containsPlace'
|
|
235
339
|
}
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
$match: {
|
|
241
|
-
'containedInPlace.branchCode': {
|
|
242
|
-
$exists: true,
|
|
243
|
-
$eq: params.containedInPlace.containedInPlace.containedInPlace.branchCode.$eq
|
|
244
|
-
}
|
|
245
|
-
}
|
|
246
|
-
});
|
|
247
|
-
}
|
|
248
|
-
}
|
|
340
|
+
},
|
|
341
|
+
{
|
|
342
|
+
$unwind: {
|
|
343
|
+
path: '$containsPlace.containsPlace'
|
|
249
344
|
}
|
|
345
|
+
},
|
|
346
|
+
...matchStages,
|
|
347
|
+
{
|
|
348
|
+
$project: projectStage
|
|
250
349
|
}
|
|
350
|
+
]);
|
|
351
|
+
if (typeof params.limit === 'number' && params.limit > 0) {
|
|
352
|
+
const page = (typeof params.page === 'number' && params.page > 0) ? params.page : 1;
|
|
353
|
+
aggregate.limit(params.limit * page)
|
|
354
|
+
.skip(params.limit * (page - 1));
|
|
251
355
|
}
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
}
|
|
261
|
-
}
|
|
262
|
-
});
|
|
263
|
-
}
|
|
264
|
-
}
|
|
265
|
-
const branchCodeIn = (_j = params.branchCode) === null || _j === void 0 ? void 0 : _j.$in;
|
|
266
|
-
if (Array.isArray(branchCodeIn)) {
|
|
267
|
-
matchStages.push({
|
|
268
|
-
$match: {
|
|
269
|
-
'containsPlace.containsPlace.branchCode': {
|
|
270
|
-
$exists: true,
|
|
271
|
-
$in: branchCodeIn
|
|
272
|
-
}
|
|
273
|
-
}
|
|
274
|
-
});
|
|
275
|
-
}
|
|
276
|
-
const branchCodeRegex = (_k = params.branchCode) === null || _k === void 0 ? void 0 : _k.$regex;
|
|
277
|
-
if (typeof branchCodeRegex === 'string' && branchCodeRegex.length > 0) {
|
|
278
|
-
matchStages.push({
|
|
279
|
-
$match: {
|
|
280
|
-
'containsPlace.containsPlace.branchCode': {
|
|
281
|
-
$exists: true,
|
|
282
|
-
$regex: new RegExp(branchCodeRegex)
|
|
283
|
-
}
|
|
284
|
-
}
|
|
285
|
-
});
|
|
286
|
-
}
|
|
287
|
-
const nameRegex = (_l = params.name) === null || _l === void 0 ? void 0 : _l.$regex;
|
|
288
|
-
if (typeof nameRegex === 'string' && nameRegex.length > 0) {
|
|
289
|
-
matchStages.push({
|
|
290
|
-
$match: {
|
|
291
|
-
$or: [
|
|
292
|
-
{
|
|
293
|
-
'containsPlace.containsPlace.name.ja': {
|
|
294
|
-
$exists: true,
|
|
295
|
-
$regex: new RegExp(nameRegex)
|
|
296
|
-
}
|
|
297
|
-
},
|
|
298
|
-
{
|
|
299
|
-
'containsPlace.containsPlace.name.en': {
|
|
300
|
-
$exists: true,
|
|
301
|
-
$regex: new RegExp(nameRegex)
|
|
302
|
-
}
|
|
303
|
-
}
|
|
304
|
-
]
|
|
305
|
-
}
|
|
306
|
-
});
|
|
307
|
-
}
|
|
308
|
-
const seatingTypeEq = (_m = params.seatingType) === null || _m === void 0 ? void 0 : _m.$eq;
|
|
309
|
-
if (typeof seatingTypeEq === 'string') {
|
|
310
|
-
matchStages.push({
|
|
311
|
-
$match: {
|
|
312
|
-
'containsPlace.containsPlace.seatingType': {
|
|
313
|
-
$exists: true,
|
|
314
|
-
$eq: seatingTypeEq
|
|
315
|
-
}
|
|
316
|
-
}
|
|
317
|
-
});
|
|
318
|
-
}
|
|
319
|
-
const additionalPropertyElemMatch = (_o = params.additionalProperty) === null || _o === void 0 ? void 0 : _o.$elemMatch;
|
|
320
|
-
if (additionalPropertyElemMatch !== undefined && additionalPropertyElemMatch !== null) {
|
|
321
|
-
matchStages.push({
|
|
322
|
-
$match: {
|
|
323
|
-
'containsPlace.containsPlace.additionalProperty': {
|
|
324
|
-
$exists: true,
|
|
325
|
-
$elemMatch: additionalPropertyElemMatch
|
|
326
|
-
}
|
|
327
|
-
}
|
|
328
|
-
});
|
|
329
|
-
}
|
|
356
|
+
return aggregate
|
|
357
|
+
.option({ maxTimeMS: settings_1.MONGO_MAX_TIME_MS })
|
|
358
|
+
.exec();
|
|
359
|
+
});
|
|
360
|
+
}
|
|
361
|
+
searchSeatsWithSort(params) {
|
|
362
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
363
|
+
const matchStages = SeatRepo.CREATE_FILTER_QUERY(params);
|
|
330
364
|
const projectStage = SeatRepo.CREATE_SEARCH_SEATS_PROJECTION(Object.assign({}, params.$projection));
|
|
331
365
|
const aggregate = this.placeModel.aggregate([
|
|
366
|
+
...matchStages,
|
|
332
367
|
{
|
|
333
368
|
$unwind: {
|
|
334
|
-
path: '$containsPlace'
|
|
335
|
-
includeArrayIndex: 'sectionIndex'
|
|
369
|
+
path: '$containsPlace'
|
|
370
|
+
// includeArrayIndex: 'sectionIndex'
|
|
336
371
|
}
|
|
337
372
|
},
|
|
338
373
|
{
|
|
339
374
|
$unwind: {
|
|
340
|
-
path: '$containsPlace.containsPlace'
|
|
341
|
-
includeArrayIndex: 'seatIndex'
|
|
375
|
+
path: '$containsPlace.containsPlace'
|
|
376
|
+
// includeArrayIndex: 'seatIndex'
|
|
342
377
|
}
|
|
343
378
|
},
|
|
344
379
|
...matchStages,
|
|
345
380
|
{
|
|
346
|
-
$project:
|
|
347
|
-
// sectionIndex: '$sectionIndex',
|
|
348
|
-
// seatIndex: '$seatIndex',
|
|
349
|
-
// add combinedIndex(2025-04-27~)
|
|
350
|
-
combinedIndex: {
|
|
351
|
-
$add: [
|
|
352
|
-
{ $multiply: ['$sectionIndex', exports.DEFAULT_ROOM_MAXIMUM_CAPACITY] },
|
|
353
|
-
'$seatIndex'
|
|
354
|
-
]
|
|
355
|
-
} })
|
|
381
|
+
$project: projectStage
|
|
356
382
|
}
|
|
383
|
+
// {
|
|
384
|
+
// $project: {
|
|
385
|
+
// ...projectStage,
|
|
386
|
+
// // sectionIndex: '$sectionIndex',
|
|
387
|
+
// // seatIndex: '$seatIndex',
|
|
388
|
+
// // add combinedIndex(2025-04-27~)
|
|
389
|
+
// combinedIndex: {
|
|
390
|
+
// $add: [
|
|
391
|
+
// { $multiply: ['$sectionIndex', DEFAULT_ROOM_MAXIMUM_CAPACITY] },
|
|
392
|
+
// '$seatIndex'
|
|
393
|
+
// ]
|
|
394
|
+
// }
|
|
395
|
+
// // combinedIndex: {
|
|
396
|
+
// // $concat: [{ $toString: '$sectionIndex' }, ':', { $toString: '$seatIndex' }]
|
|
397
|
+
// // }
|
|
398
|
+
// }
|
|
399
|
+
// }
|
|
357
400
|
]);
|
|
358
401
|
if (typeof params.limit === 'number' && params.limit > 0) {
|
|
359
402
|
const page = (typeof params.page === 'number' && params.page > 0) ? params.page : 1;
|
|
360
|
-
//
|
|
361
|
-
//
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
403
|
+
// tslint:disable-next-line:no-suspicious-comment
|
|
404
|
+
// TODO reimplement using $sort + $skip + $limit(2025-4-27~)
|
|
405
|
+
aggregate.limit(params.limit * page)
|
|
406
|
+
.skip(params.limit * (page - 1));
|
|
407
|
+
// aggregate
|
|
408
|
+
// .sort({ combinedIndex: factory.sortType.Ascending })
|
|
409
|
+
// .skip(params.limit * (page - 1))
|
|
410
|
+
// .limit(params.limit);
|
|
367
411
|
}
|
|
368
412
|
return aggregate
|
|
369
413
|
.option({ maxTimeMS: settings_1.MONGO_MAX_TIME_MS })
|
|
370
414
|
.exec();
|
|
371
415
|
});
|
|
372
416
|
}
|
|
373
|
-
// tslint:disable-next-line:cyclomatic-complexity max-func-body-length
|
|
374
|
-
// public async searchSeatsNext(params: factory.place.seat.ISearchConditions): Promise<factory.place.seat.IPlace[]> {
|
|
375
|
-
// // unwindごとのフィルターを分離する(unwind,matchの順序を最適化するため)(2025-04-27~)
|
|
376
|
-
// const filterQueries4screeningRoom: FilterQuery<factory.place.screeningRoom.IPlace>[] = [
|
|
377
|
-
// { typeOf: { $eq: factory.placeType.ScreeningRoom } }
|
|
378
|
-
// ];
|
|
379
|
-
// const filterQueries4section: FilterQuery<factory.place.screeningRoomSection.IPlace>[] = [];
|
|
380
|
-
// const filterQueries4seat: FilterQuery<factory.place.seat.IPlace>[] = [];
|
|
381
|
-
// const projectIdEq = params.project?.id?.$eq;
|
|
382
|
-
// if (typeof projectIdEq === 'string') {
|
|
383
|
-
// filterQueries4screeningRoom.push({ 'project.id': { $eq: projectIdEq } });
|
|
384
|
-
// }
|
|
385
|
-
// const parentOrganizationIdEq = params.parentOrganization?.id?.$eq;
|
|
386
|
-
// if (typeof parentOrganizationIdEq === 'string') {
|
|
387
|
-
// filterQueries4screeningRoom.push({ 'parentOrganization.id': { $exists: true, $eq: parentOrganizationIdEq } });
|
|
388
|
-
// }
|
|
389
|
-
// if (params.containedInPlace !== undefined) {
|
|
390
|
-
// if (params.containedInPlace.containedInPlace !== undefined) {
|
|
391
|
-
// if (params.containedInPlace.containedInPlace.containedInPlace !== undefined) {
|
|
392
|
-
// if (params.containedInPlace.containedInPlace.containedInPlace.branchCode !== undefined) {
|
|
393
|
-
// // 施設コード
|
|
394
|
-
// if (typeof params.containedInPlace.containedInPlace.containedInPlace.branchCode.$eq === 'string') {
|
|
395
|
-
// filterQueries4screeningRoom.push({
|
|
396
|
-
// 'containedInPlace.branchCode': {
|
|
397
|
-
// // $exists: true, // 必ず存在するので削除(2025-04-27~)
|
|
398
|
-
// $eq: params.containedInPlace.containedInPlace.containedInPlace.branchCode.$eq
|
|
399
|
-
// }
|
|
400
|
-
// });
|
|
401
|
-
// }
|
|
402
|
-
// }
|
|
403
|
-
// }
|
|
404
|
-
// if (params.containedInPlace.containedInPlace.branchCode !== undefined) {
|
|
405
|
-
// // ルームコード
|
|
406
|
-
// if (typeof params.containedInPlace.containedInPlace.branchCode.$eq === 'string') {
|
|
407
|
-
// filterQueries4screeningRoom.push({
|
|
408
|
-
// branchCode: {
|
|
409
|
-
// $eq: params.containedInPlace.containedInPlace.branchCode.$eq
|
|
410
|
-
// }
|
|
411
|
-
// });
|
|
412
|
-
// }
|
|
413
|
-
// }
|
|
414
|
-
// }
|
|
415
|
-
// }
|
|
416
|
-
// // セクションコード
|
|
417
|
-
// const containedInPlaceBranchCodeEq = params.containedInPlace?.branchCode?.$eq;
|
|
418
|
-
// if (typeof containedInPlaceBranchCodeEq === 'string') {
|
|
419
|
-
// filterQueries4section.push({
|
|
420
|
-
// 'containsPlace.branchCode': {
|
|
421
|
-
// $exists: true,
|
|
422
|
-
// $eq: containedInPlaceBranchCodeEq
|
|
423
|
-
// }
|
|
424
|
-
// });
|
|
425
|
-
// }
|
|
426
|
-
// // セクションコード
|
|
427
|
-
// const containedInPlaceBranchCodeIn = params.containedInPlace?.branchCode?.$in;
|
|
428
|
-
// if (Array.isArray(containedInPlaceBranchCodeIn)) {
|
|
429
|
-
// filterQueries4section.push({
|
|
430
|
-
// 'containsPlace.branchCode': {
|
|
431
|
-
// $exists: true,
|
|
432
|
-
// $in: containedInPlaceBranchCodeIn
|
|
433
|
-
// }
|
|
434
|
-
// });
|
|
435
|
-
// }
|
|
436
|
-
// // 座席コード
|
|
437
|
-
// if (params.branchCode !== undefined) {
|
|
438
|
-
// if (typeof params.branchCode.$eq === 'string') {
|
|
439
|
-
// filterQueries4seat.push({
|
|
440
|
-
// 'containsPlace.containsPlace.branchCode': {
|
|
441
|
-
// $exists: true,
|
|
442
|
-
// $eq: params.branchCode.$eq
|
|
443
|
-
// }
|
|
444
|
-
// });
|
|
445
|
-
// }
|
|
446
|
-
// }
|
|
447
|
-
// const branchCodeIn = params.branchCode?.$in;
|
|
448
|
-
// if (Array.isArray(branchCodeIn)) {
|
|
449
|
-
// filterQueries4seat.push({
|
|
450
|
-
// 'containsPlace.containsPlace.branchCode': {
|
|
451
|
-
// $exists: true,
|
|
452
|
-
// $in: branchCodeIn
|
|
453
|
-
// }
|
|
454
|
-
// });
|
|
455
|
-
// }
|
|
456
|
-
// const branchCodeRegex = params.branchCode?.$regex;
|
|
457
|
-
// if (typeof branchCodeRegex === 'string' && branchCodeRegex.length > 0) {
|
|
458
|
-
// filterQueries4seat.push({
|
|
459
|
-
// 'containsPlace.containsPlace.branchCode': {
|
|
460
|
-
// $exists: true,
|
|
461
|
-
// $regex: new RegExp(branchCodeRegex)
|
|
462
|
-
// }
|
|
463
|
-
// });
|
|
464
|
-
// }
|
|
465
|
-
// const nameRegex = params.name?.$regex;
|
|
466
|
-
// if (typeof nameRegex === 'string' && nameRegex.length > 0) {
|
|
467
|
-
// filterQueries4seat.push({
|
|
468
|
-
// $or: [
|
|
469
|
-
// {
|
|
470
|
-
// 'containsPlace.containsPlace.name.ja': {
|
|
471
|
-
// $exists: true,
|
|
472
|
-
// $regex: new RegExp(nameRegex)
|
|
473
|
-
// }
|
|
474
|
-
// },
|
|
475
|
-
// {
|
|
476
|
-
// 'containsPlace.containsPlace.name.en': {
|
|
477
|
-
// $exists: true,
|
|
478
|
-
// $regex: new RegExp(nameRegex)
|
|
479
|
-
// }
|
|
480
|
-
// }
|
|
481
|
-
// ]
|
|
482
|
-
// });
|
|
483
|
-
// }
|
|
484
|
-
// const seatingTypeEq = params.seatingType?.$eq;
|
|
485
|
-
// if (typeof seatingTypeEq === 'string') {
|
|
486
|
-
// filterQueries4seat.push({
|
|
487
|
-
// 'containsPlace.containsPlace.seatingType': {
|
|
488
|
-
// $exists: true,
|
|
489
|
-
// $eq: seatingTypeEq
|
|
490
|
-
// }
|
|
491
|
-
// });
|
|
492
|
-
// }
|
|
493
|
-
// const additionalPropertyElemMatch = params.additionalProperty?.$elemMatch;
|
|
494
|
-
// if (additionalPropertyElemMatch !== undefined && additionalPropertyElemMatch !== null) {
|
|
495
|
-
// filterQueries4seat.push({
|
|
496
|
-
// 'containsPlace.containsPlace.additionalProperty': {
|
|
497
|
-
// $exists: true,
|
|
498
|
-
// $elemMatch: additionalPropertyElemMatch
|
|
499
|
-
// }
|
|
500
|
-
// });
|
|
501
|
-
// }
|
|
502
|
-
// const matchStage4screeningRoom: IMatchStage = { $match: { $and: filterQueries4screeningRoom } };
|
|
503
|
-
// const matchStage4section: IMatchStage | undefined = (filterQueries4section.length > 0)
|
|
504
|
-
// ? { $match: { $and: filterQueries4section } }
|
|
505
|
-
// : undefined;
|
|
506
|
-
// const matchStage4seat: IMatchStage | undefined = (filterQueries4seat.length > 0)
|
|
507
|
-
// ? { $match: { $and: filterQueries4seat } }
|
|
508
|
-
// : undefined;
|
|
509
|
-
// const projectStage = SeatRepo.CREATE_SEARCH_SEATS_PROJECTION({ ...params.$projection });
|
|
510
|
-
// const pipeline: PipelineStage[] = [
|
|
511
|
-
// matchStage4screeningRoom,
|
|
512
|
-
// { $unwind: '$containsPlace' },
|
|
513
|
-
// ...(matchStage4section !== undefined) ? [matchStage4section] : [],
|
|
514
|
-
// { $unwind: '$containsPlace.containsPlace' },
|
|
515
|
-
// ...(matchStage4seat !== undefined) ? [matchStage4seat] : [],
|
|
516
|
-
// { $project: projectStage }
|
|
517
|
-
// ];
|
|
518
|
-
// // console.dir(pipeline, { depth: null });
|
|
519
|
-
// const aggregate = this.placeModel.aggregate<factory.place.seat.IPlace>(pipeline);
|
|
520
|
-
// if (typeof params.limit === 'number' && params.limit > 0) {
|
|
521
|
-
// const page: number = (typeof params.page === 'number' && params.page > 0) ? params.page : 1;
|
|
522
|
-
// aggregate.limit(params.limit * page)
|
|
523
|
-
// .skip(params.limit * (page - 1));
|
|
524
|
-
// }
|
|
525
|
-
// return aggregate
|
|
526
|
-
// .option({ maxTimeMS: MONGO_MAX_TIME_MS })
|
|
527
|
-
// .exec();
|
|
528
|
-
// }
|
|
529
417
|
/**
|
|
530
418
|
* 座席区分集計検索
|
|
531
419
|
*/
|
|
@@ -71,7 +71,7 @@ function searchEventSeatOffersWithPaging(params) {
|
|
|
71
71
|
if (reservedSeatsAvailable) {
|
|
72
72
|
const roomBranchCode = String((_d = (_c = eventOffers.itemOffered) === null || _c === void 0 ? void 0 : _c.availableChannel) === null || _d === void 0 ? void 0 : _d.serviceLocation.branchCode);
|
|
73
73
|
const movieTheaterBranchCode = String((_f = (_e = eventOffers.itemOffered) === null || _e === void 0 ? void 0 : _e.availableChannel) === null || _f === void 0 ? void 0 : _f.serviceLocation.containedInPlace.branchCode);
|
|
74
|
-
const seats = yield repos.seat.
|
|
74
|
+
const seats = yield repos.seat.searchSeatsWithSort(Object.assign(Object.assign({}, params), { project: { id: { $eq: event.project.id } }, containedInPlace: {
|
|
75
75
|
branchCode: {
|
|
76
76
|
$eq: (typeof ((_h = (_g = params.containedInPlace) === null || _g === void 0 ? void 0 : _g.branchCode) === null || _h === void 0 ? void 0 : _h.$eq) === 'string')
|
|
77
77
|
? (_k = (_j = params.containedInPlace) === null || _j === void 0 ? void 0 : _j.branchCode) === null || _k === void 0 ? void 0 : _k.$eq
|
package/package.json
CHANGED