@chevre/domain 21.2.0-alpha.134 → 21.2.0-alpha.135
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.
|
@@ -48,17 +48,11 @@ export declare class MongoRepository {
|
|
|
48
48
|
/**
|
|
49
49
|
* 施設検索
|
|
50
50
|
*/
|
|
51
|
-
searchMovieTheaters(params: factory.place.movieTheater.ISearchConditions & {
|
|
52
|
-
$projection?: {
|
|
53
|
-
[key: string]: 0;
|
|
54
|
-
};
|
|
55
|
-
}): Promise<factory.place.movieTheater.IPlaceWithoutScreeningRoom[]>;
|
|
51
|
+
searchMovieTheaters(params: factory.place.movieTheater.ISearchConditions & {}, inclusion: string[], exclusion: string[]): Promise<factory.place.movieTheater.IPlaceWithoutScreeningRoom[]>;
|
|
56
52
|
/**
|
|
57
53
|
* 施設取得
|
|
54
|
+
* 廃止(2023-06-22~)
|
|
58
55
|
*/
|
|
59
|
-
findById(params: {
|
|
60
|
-
id: string;
|
|
61
|
-
}, inclusion: string[], exclusion: string[]): Promise<factory.place.movieTheater.IPlace>;
|
|
62
56
|
deleteMovieTheaterById(params: {
|
|
63
57
|
id: string;
|
|
64
58
|
}): Promise<void>;
|
package/lib/chevre/repo/place.js
CHANGED
|
@@ -277,34 +277,12 @@ class MongoRepository {
|
|
|
277
277
|
/**
|
|
278
278
|
* 施設検索
|
|
279
279
|
*/
|
|
280
|
-
searchMovieTheaters(params
|
|
280
|
+
searchMovieTheaters(params,
|
|
281
|
+
// projection明示指定化(2023-06-22~)
|
|
282
|
+
inclusion, exclusion) {
|
|
281
283
|
var _a;
|
|
282
284
|
return __awaiter(this, void 0, void 0, function* () {
|
|
283
285
|
const conditions = MongoRepository.CREATE_MOVIE_THEATER_MONGO_CONDITIONS(params);
|
|
284
|
-
// containsPlaceを含めるとデータサイズが大きくなるので、検索結果には含めない
|
|
285
|
-
const query = this.placeModel.find((conditions.length > 0) ? { $and: conditions } : {}, Object.assign({ __v: 0, createdAt: 0, updatedAt: 0, containsPlace: 0 }, params.$projection));
|
|
286
|
-
if (typeof params.limit === 'number' && params.limit > 0) {
|
|
287
|
-
const page = (typeof params.page === 'number' && params.page > 0) ? params.page : 1;
|
|
288
|
-
query.limit(params.limit)
|
|
289
|
-
.skip(params.limit * (page - 1));
|
|
290
|
-
}
|
|
291
|
-
// tslint:disable-next-line:no-single-line-block-comment
|
|
292
|
-
/* istanbul ignore else */
|
|
293
|
-
if (((_a = params.sort) === null || _a === void 0 ? void 0 : _a.branchCode) !== undefined) {
|
|
294
|
-
query.sort({ branchCode: params.sort.branchCode });
|
|
295
|
-
}
|
|
296
|
-
return query.setOptions({ maxTimeMS: settings_1.MONGO_MAX_TIME_MS })
|
|
297
|
-
.exec()
|
|
298
|
-
.then((docs) => docs.map((doc) => doc.toObject()));
|
|
299
|
-
});
|
|
300
|
-
}
|
|
301
|
-
/**
|
|
302
|
-
* 施設取得
|
|
303
|
-
*/
|
|
304
|
-
findById(params,
|
|
305
|
-
// projection?: any
|
|
306
|
-
inclusion, exclusion) {
|
|
307
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
308
286
|
let projection = {};
|
|
309
287
|
if (Array.isArray(inclusion) && inclusion.length > 0) {
|
|
310
288
|
inclusion.forEach((field) => {
|
|
@@ -315,7 +293,9 @@ class MongoRepository {
|
|
|
315
293
|
projection = {
|
|
316
294
|
__v: 0,
|
|
317
295
|
createdAt: 0,
|
|
318
|
-
updatedAt: 0
|
|
296
|
+
updatedAt: 0,
|
|
297
|
+
// containsPlaceを含めるとデータサイズが大きくなるので、検索結果には含めない
|
|
298
|
+
containsPlace: 0
|
|
319
299
|
};
|
|
320
300
|
if (Array.isArray(exclusion) && exclusion.length > 0) {
|
|
321
301
|
exclusion.forEach((field) => {
|
|
@@ -323,17 +303,61 @@ class MongoRepository {
|
|
|
323
303
|
});
|
|
324
304
|
}
|
|
325
305
|
}
|
|
326
|
-
const
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
if (doc === null) {
|
|
332
|
-
throw new factory.errors.NotFound(this.placeModel.modelName);
|
|
306
|
+
const query = this.placeModel.find((conditions.length > 0) ? { $and: conditions } : {}, projection);
|
|
307
|
+
if (typeof params.limit === 'number' && params.limit > 0) {
|
|
308
|
+
const page = (typeof params.page === 'number' && params.page > 0) ? params.page : 1;
|
|
309
|
+
query.limit(params.limit)
|
|
310
|
+
.skip(params.limit * (page - 1));
|
|
333
311
|
}
|
|
334
|
-
|
|
312
|
+
// tslint:disable-next-line:no-single-line-block-comment
|
|
313
|
+
/* istanbul ignore else */
|
|
314
|
+
if (((_a = params.sort) === null || _a === void 0 ? void 0 : _a.branchCode) !== undefined) {
|
|
315
|
+
query.sort({ branchCode: params.sort.branchCode });
|
|
316
|
+
}
|
|
317
|
+
return query.setOptions({ maxTimeMS: settings_1.MONGO_MAX_TIME_MS })
|
|
318
|
+
.exec()
|
|
319
|
+
.then((docs) => docs.map((doc) => doc.toObject()));
|
|
335
320
|
});
|
|
336
321
|
}
|
|
322
|
+
/**
|
|
323
|
+
* 施設取得
|
|
324
|
+
* 廃止(2023-06-22~)
|
|
325
|
+
*/
|
|
326
|
+
// public async findById(
|
|
327
|
+
// params: { id: string },
|
|
328
|
+
// inclusion: string[],
|
|
329
|
+
// exclusion: string[]
|
|
330
|
+
// ): Promise<factory.place.movieTheater.IPlace> {
|
|
331
|
+
// let projection: { [key: string]: number } = {};
|
|
332
|
+
// if (Array.isArray(inclusion) && inclusion.length > 0) {
|
|
333
|
+
// inclusion.forEach((field) => {
|
|
334
|
+
// projection[field] = 1;
|
|
335
|
+
// });
|
|
336
|
+
// } else {
|
|
337
|
+
// projection = {
|
|
338
|
+
// __v: 0,
|
|
339
|
+
// createdAt: 0,
|
|
340
|
+
// updatedAt: 0
|
|
341
|
+
// };
|
|
342
|
+
// if (Array.isArray(exclusion) && exclusion.length > 0) {
|
|
343
|
+
// exclusion.forEach((field) => {
|
|
344
|
+
// projection[field] = 0;
|
|
345
|
+
// });
|
|
346
|
+
// }
|
|
347
|
+
// }
|
|
348
|
+
// const doc = await this.placeModel.findOne(
|
|
349
|
+
// {
|
|
350
|
+
// typeOf: { $eq: factory.placeType.MovieTheater },
|
|
351
|
+
// _id: { $eq: params.id }
|
|
352
|
+
// },
|
|
353
|
+
// projection
|
|
354
|
+
// )
|
|
355
|
+
// .exec();
|
|
356
|
+
// if (doc === null) {
|
|
357
|
+
// throw new factory.errors.NotFound(this.placeModel.modelName);
|
|
358
|
+
// }
|
|
359
|
+
// return doc.toObject();
|
|
360
|
+
// }
|
|
337
361
|
deleteMovieTheaterById(params) {
|
|
338
362
|
return __awaiter(this, void 0, void 0, function* () {
|
|
339
363
|
yield this.placeModel.findOneAndDelete({
|
|
@@ -59,15 +59,15 @@ function findEntranceGates(params) {
|
|
|
59
59
|
const searchMovieTheatersResult = yield repos.place.searchMovieTheaters({
|
|
60
60
|
limit: 1,
|
|
61
61
|
page: 1,
|
|
62
|
-
id: { $eq: params.event.superEvent.location.id }
|
|
63
|
-
$projection: {
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
}
|
|
70
|
-
});
|
|
62
|
+
id: { $eq: params.event.superEvent.location.id }
|
|
63
|
+
// $projection: {
|
|
64
|
+
// containsPlace: 0,
|
|
65
|
+
// hasPOS: 0,
|
|
66
|
+
// offers: 0,
|
|
67
|
+
// parentOrganization: 0,
|
|
68
|
+
// name: 0
|
|
69
|
+
// }
|
|
70
|
+
}, ['hasEntranceGate'], []);
|
|
71
71
|
movieTheater = searchMovieTheatersResult.shift();
|
|
72
72
|
// movieTheater = await repos.place.findById(
|
|
73
73
|
// { id: params.event.superEvent.location.id },
|
|
@@ -231,7 +231,12 @@ function createInformMovieTheaterTasks(params) {
|
|
|
231
231
|
if (params.ids.length !== 1) {
|
|
232
232
|
throw new factory.errors.Argument('id', 'id.length must be 1');
|
|
233
233
|
}
|
|
234
|
-
const
|
|
234
|
+
const movieTheaters = yield repos.place.searchMovieTheaters({
|
|
235
|
+
limit: 1,
|
|
236
|
+
page: 1,
|
|
237
|
+
project: { id: { $eq: params.project.id } },
|
|
238
|
+
id: { $eq: params.ids[0] }
|
|
239
|
+
}, [
|
|
235
240
|
'additionalProperty',
|
|
236
241
|
'branchCode',
|
|
237
242
|
'hasEntranceGate',
|
|
@@ -249,8 +254,9 @@ function createInformMovieTheaterTasks(params) {
|
|
|
249
254
|
// 'containsPlace.additionalProperty',
|
|
250
255
|
// 'containsPlace.address'
|
|
251
256
|
], []);
|
|
252
|
-
|
|
253
|
-
|
|
257
|
+
const movieTheater = movieTheaters.shift();
|
|
258
|
+
if (movieTheater === undefined) {
|
|
259
|
+
throw new factory.errors.NotFound(factory.placeType.MovieTheater);
|
|
254
260
|
}
|
|
255
261
|
// ルームを検索
|
|
256
262
|
const screeningRooms = yield repos.place.searchScreeningRooms({
|
package/package.json
CHANGED