@chevre/domain 23.2.0-alpha.15 → 23.2.0-alpha.17
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/event/importEventsFromCOAByTitle.ts +1 -1
- package/example/src/chevre/eventSeries/migrateEventSeriesVideoFormat.ts +1 -1
- package/example/src/chevre/place/findRooms.ts +24 -0
- package/example/src/chevre/roles/{addAdminSeatReadPermissionIfNotExists.ts → addAdminMovieTheaterReadPermissionIfNotExists.ts} +2 -1
- package/example/src/chevre/roles/{addAdminSeatWritePermissionIfNotExists.ts → addAdminMovieTheaterWritePermissionIfNotExists.ts} +2 -1
- package/lib/chevre/repo/place/entranceGate.d.ts +30 -0
- package/lib/chevre/repo/place/entranceGate.js +62 -0
- package/lib/chevre/repo/place/screeningRoom.d.ts +4 -1
- package/lib/chevre/repo/place/screeningRoom.js +146 -115
- package/lib/chevre/repository.d.ts +8 -0
- package/lib/chevre/repository.js +16 -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/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/syncResourcesFromCOA.js +1 -1
- package/package.json +1 -1
- package/lib/chevre/service/eventOld.d.ts +0 -60
- package/lib/chevre/service/eventOld.js +0 -864
|
@@ -67,7 +67,7 @@ async function main() {
|
|
|
67
67
|
}
|
|
68
68
|
console.log('movieTheater:', movieTheater);
|
|
69
69
|
|
|
70
|
-
const screeningRooms = await roomRepo.
|
|
70
|
+
const screeningRooms = await roomRepo.findRooms({
|
|
71
71
|
project: { id: { $eq: project.id } },
|
|
72
72
|
containedInPlace: { branchCode: { $eq: movieTheater.branchCode } },
|
|
73
73
|
branchCode: { $eq: roomCode }
|
|
@@ -13,7 +13,7 @@ async function main() {
|
|
|
13
13
|
const cursor = eventSeriesRepo.getCursor(
|
|
14
14
|
{
|
|
15
15
|
// _id: { $eq: 'al9s38bj6' },
|
|
16
|
-
'project.id': { $
|
|
16
|
+
'project.id': { $nin: ['sskts-development', 'sskts-test', 'sskts-production'] }
|
|
17
17
|
},
|
|
18
18
|
{
|
|
19
19
|
// _id: 1,
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
// tslint:disable:no-console
|
|
2
|
+
import * as mongoose from 'mongoose';
|
|
3
|
+
|
|
4
|
+
import { chevre } from '../../../../lib/index';
|
|
5
|
+
|
|
6
|
+
const project = { id: String(process.env.PROJECT_ID) };
|
|
7
|
+
|
|
8
|
+
async function main() {
|
|
9
|
+
await mongoose.connect(<string>process.env.MONGOLAB_URI, { autoIndex: false });
|
|
10
|
+
|
|
11
|
+
const roomRepo = await chevre.repository.place.ScreeningRoom.createInstance(mongoose.connection);
|
|
12
|
+
|
|
13
|
+
const rooms = await roomRepo.findRooms({
|
|
14
|
+
limit: 20,
|
|
15
|
+
page: 1,
|
|
16
|
+
project: { id: { $eq: project.id } }
|
|
17
|
+
});
|
|
18
|
+
console.log(rooms);
|
|
19
|
+
console.log(rooms.length);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
main()
|
|
23
|
+
.then(console.log)
|
|
24
|
+
.catch(console.error);
|
|
@@ -15,7 +15,8 @@ async function main() {
|
|
|
15
15
|
chevre.factory.role.organizationRole.RoleName.TicketClerk
|
|
16
16
|
];
|
|
17
17
|
const permissions = [
|
|
18
|
-
'admin.sellers.
|
|
18
|
+
'admin.sellers.entranceGates.read',
|
|
19
|
+
'admin.sellers.movieTheaters.read'
|
|
19
20
|
];
|
|
20
21
|
for (const roleName of roleNames) {
|
|
21
22
|
for (const permission of permissions) {
|
|
@@ -15,7 +15,8 @@ async function main() {
|
|
|
15
15
|
// chevre.factory.role.organizationRole.RoleName.TicketClerk
|
|
16
16
|
];
|
|
17
17
|
const permissions = [
|
|
18
|
-
'admin.sellers.
|
|
18
|
+
'admin.sellers.entranceGates.*',
|
|
19
|
+
'admin.sellers.movieTheaters.*'
|
|
19
20
|
];
|
|
20
21
|
for (const roleName of roleNames) {
|
|
21
22
|
for (const permission of permissions) {
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { Connection } from 'mongoose';
|
|
2
|
+
import * as factory from '../../factory';
|
|
3
|
+
/**
|
|
4
|
+
* ゲートを操作する組織
|
|
5
|
+
*/
|
|
6
|
+
interface IOperator {
|
|
7
|
+
/**
|
|
8
|
+
* 施設ID
|
|
9
|
+
*/
|
|
10
|
+
id: string;
|
|
11
|
+
}
|
|
12
|
+
type IEntranceGate = Pick<factory.place.movieTheater.IEntranceGate, 'identifier' | 'name'>;
|
|
13
|
+
/**
|
|
14
|
+
* 施設の入場ゲートリポジトリ
|
|
15
|
+
*/
|
|
16
|
+
export declare class EntranceGateRepo {
|
|
17
|
+
private readonly operator;
|
|
18
|
+
private readonly civicStructureModel;
|
|
19
|
+
constructor(connection: Connection, operater: IOperator);
|
|
20
|
+
findEntranceGates(params: {
|
|
21
|
+
limit: number;
|
|
22
|
+
page: number;
|
|
23
|
+
project?: {
|
|
24
|
+
id?: {
|
|
25
|
+
$eq?: string;
|
|
26
|
+
};
|
|
27
|
+
};
|
|
28
|
+
}): Promise<IEntranceGate[]>;
|
|
29
|
+
}
|
|
30
|
+
export {};
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.EntranceGateRepo = void 0;
|
|
13
|
+
const mongoose_1 = require("mongoose");
|
|
14
|
+
const factory = require("../../factory");
|
|
15
|
+
const settings_1 = require("../../settings");
|
|
16
|
+
const civicStructure_1 = require("../mongoose/schemas/civicStructure");
|
|
17
|
+
/**
|
|
18
|
+
* 施設の入場ゲートリポジトリ
|
|
19
|
+
*/
|
|
20
|
+
class EntranceGateRepo {
|
|
21
|
+
constructor(connection, operater) {
|
|
22
|
+
this.civicStructureModel = connection.model(civicStructure_1.modelName, (0, civicStructure_1.createSchema)());
|
|
23
|
+
this.operator = operater;
|
|
24
|
+
}
|
|
25
|
+
findEntranceGates(params) {
|
|
26
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
27
|
+
var _a, _b;
|
|
28
|
+
const matchStages = [
|
|
29
|
+
{ $match: { _id: { $eq: new mongoose_1.Types.ObjectId(this.operator.id) } } }
|
|
30
|
+
];
|
|
31
|
+
const projectIdEq = (_b = (_a = params.project) === null || _a === void 0 ? void 0 : _a.id) === null || _b === void 0 ? void 0 : _b.$eq;
|
|
32
|
+
if (typeof projectIdEq === 'string') {
|
|
33
|
+
matchStages.push({ $match: { 'project.id': { $eq: projectIdEq } } });
|
|
34
|
+
}
|
|
35
|
+
const aggregate = this.civicStructureModel.aggregate([
|
|
36
|
+
{
|
|
37
|
+
$unwind: {
|
|
38
|
+
path: '$hasEntranceGate'
|
|
39
|
+
}
|
|
40
|
+
},
|
|
41
|
+
...matchStages,
|
|
42
|
+
{ $sort: { 'hasEntranceGate.identifier': factory.sortType.Ascending } },
|
|
43
|
+
{
|
|
44
|
+
$project: {
|
|
45
|
+
_id: 0,
|
|
46
|
+
identifier: '$hasEntranceGate.identifier',
|
|
47
|
+
name: '$hasEntranceGate.name'
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
]);
|
|
51
|
+
const { limit, page } = params;
|
|
52
|
+
if (typeof limit === 'number' && limit > 0) {
|
|
53
|
+
const pageMustBePositive = (typeof page === 'number' && page > 0) ? page : 1;
|
|
54
|
+
aggregate.skip(limit * (pageMustBePositive - 1))
|
|
55
|
+
.limit(limit);
|
|
56
|
+
}
|
|
57
|
+
return aggregate.option({ maxTimeMS: settings_1.MONGO_MAX_TIME_MS })
|
|
58
|
+
.exec();
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
exports.EntranceGateRepo = EntranceGateRepo;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import type { Connection, FilterQuery } from 'mongoose';
|
|
1
|
+
import type { Connection, FilterQuery, PipelineStage } from 'mongoose';
|
|
2
2
|
import * as factory from '../../factory';
|
|
3
3
|
export type IScreeningRoomFoundByBranchCode = Pick<factory.place.screeningRoom.IPlace, 'typeOf' | 'branchCode' | 'name' | 'containsPlace' | 'seatCount' | 'parentOrganization'>;
|
|
4
|
+
type IMatchStage = PipelineStage.Match;
|
|
4
5
|
interface IUpdateOptions {
|
|
5
6
|
project: {
|
|
6
7
|
id: string;
|
|
@@ -32,6 +33,7 @@ export declare class ScreeningRoomRepo {
|
|
|
32
33
|
private readonly civicStructureModel;
|
|
33
34
|
private readonly placeModel;
|
|
34
35
|
constructor(connection: Connection);
|
|
36
|
+
static CREATE_ROOM_MONGO_CONDITIONS(searchConditions: Omit<factory.place.screeningRoom.ISearchConditions, '$projection' | 'limit' | 'page'>): IMatchStage[];
|
|
35
37
|
saveScreeningRooms4coa(params: IMovieTheaterIncludingScreeningRooms): Promise<void>;
|
|
36
38
|
createRoom(screeningRoom: Pick<factory.place.screeningRoom.IPlace, 'additionalProperty' | 'address' | 'branchCode' | 'name' | 'openSeatingAllowed'>, options: IUpdateOptions): Promise<IUpdateScreeningRoomResult>;
|
|
37
39
|
updateRoomByBranchCode(screeningRoom: Pick<factory.place.screeningRoom.IPlace, 'additionalProperty' | 'address' | 'branchCode' | 'name' | 'openSeatingAllowed'>, $unset: any, options: IUpdateOptions): Promise<IUpdateScreeningRoomResult>;
|
|
@@ -59,6 +61,7 @@ export declare class ScreeningRoomRepo {
|
|
|
59
61
|
};
|
|
60
62
|
}): Promise<import("mongodb").DeleteResult>;
|
|
61
63
|
searchScreeningRooms(searchConditions: factory.place.screeningRoom.ISearchConditions): Promise<Omit<factory.place.screeningRoom.IPlace, 'containsPlace' | 'parentOrganization'>[]>;
|
|
64
|
+
findRooms(params: Omit<factory.place.screeningRoom.ISearchConditions, '$projection'>): Promise<Pick<factory.place.screeningRoom.IPlace, 'additionalProperty' | 'address' | 'branchCode' | 'name' | 'openSeatingAllowed' | 'maximumAttendeeCapacity'>[]>;
|
|
62
65
|
/**
|
|
63
66
|
* セクションと座席も含めたひとつのルームを取得する
|
|
64
67
|
*/
|
|
@@ -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"]);
|
|
@@ -189,130 +303,19 @@ class ScreeningRoomRepo {
|
|
|
189
303
|
.exec();
|
|
190
304
|
});
|
|
191
305
|
}
|
|
192
|
-
// tslint:disable-next-line:cyclomatic-complexity max-func-body-length
|
|
193
306
|
searchScreeningRooms(searchConditions) {
|
|
194
307
|
return __awaiter(this, void 0, void 0, function* () {
|
|
195
|
-
var _a, _b
|
|
196
|
-
const matchStages = [{ $match: { typeOf: { $eq: factory.placeType.ScreeningRoom } } }];
|
|
197
|
-
const projectIdEq = (_b = (_a = searchConditions.project) === null || _a === void 0 ? void 0 : _a.id) === null || _b === void 0 ? void 0 : _b.$eq;
|
|
198
|
-
if (typeof projectIdEq === 'string') {
|
|
199
|
-
matchStages.push({
|
|
200
|
-
$match: { 'project.id': { $eq: projectIdEq } }
|
|
201
|
-
});
|
|
202
|
-
}
|
|
203
|
-
const parentOrganizationIdEq = (_d = (_c = searchConditions.parentOrganization) === null || _c === void 0 ? void 0 : _c.id) === null || _d === void 0 ? void 0 : _d.$eq;
|
|
204
|
-
if (typeof parentOrganizationIdEq === 'string') {
|
|
205
|
-
matchStages.push({
|
|
206
|
-
$match: { 'parentOrganization.id': { $exists: true, $eq: parentOrganizationIdEq } }
|
|
207
|
-
});
|
|
208
|
-
}
|
|
209
|
-
// 施設ID
|
|
210
|
-
const containedInPlaceIdEq = (_f = (_e = searchConditions.containedInPlace) === null || _e === void 0 ? void 0 : _e.id) === null || _f === void 0 ? void 0 : _f.$eq;
|
|
211
|
-
if (typeof containedInPlaceIdEq === 'string') {
|
|
212
|
-
matchStages.push({
|
|
213
|
-
$match: {
|
|
214
|
-
'containedInPlace.id': {
|
|
215
|
-
$exists: true,
|
|
216
|
-
$eq: containedInPlaceIdEq
|
|
217
|
-
}
|
|
218
|
-
}
|
|
219
|
-
});
|
|
220
|
-
}
|
|
221
|
-
if (searchConditions.containedInPlace !== undefined) {
|
|
222
|
-
// 施設コード
|
|
223
|
-
if (searchConditions.containedInPlace.branchCode !== undefined) {
|
|
224
|
-
if (typeof searchConditions.containedInPlace.branchCode.$eq === 'string') {
|
|
225
|
-
matchStages.push({
|
|
226
|
-
$match: {
|
|
227
|
-
'containedInPlace.branchCode': {
|
|
228
|
-
$exists: true,
|
|
229
|
-
$eq: searchConditions.containedInPlace.branchCode.$eq
|
|
230
|
-
}
|
|
231
|
-
}
|
|
232
|
-
});
|
|
233
|
-
}
|
|
234
|
-
}
|
|
235
|
-
}
|
|
236
|
-
const branchCodeEq = (_g = searchConditions.branchCode) === null || _g === void 0 ? void 0 : _g.$eq;
|
|
237
|
-
if (typeof branchCodeEq === 'string') {
|
|
238
|
-
matchStages.push({
|
|
239
|
-
$match: {
|
|
240
|
-
branchCode: { $eq: branchCodeEq }
|
|
241
|
-
}
|
|
242
|
-
});
|
|
243
|
-
}
|
|
244
|
-
const branchCodeIn = (_h = searchConditions.branchCode) === null || _h === void 0 ? void 0 : _h.$in;
|
|
245
|
-
if (Array.isArray(branchCodeIn)) {
|
|
246
|
-
matchStages.push({
|
|
247
|
-
$match: {
|
|
248
|
-
branchCode: { $in: branchCodeIn }
|
|
249
|
-
}
|
|
250
|
-
});
|
|
251
|
-
}
|
|
252
|
-
const branchCodeRegex = (_j = searchConditions.branchCode) === null || _j === void 0 ? void 0 : _j.$regex;
|
|
253
|
-
if (typeof branchCodeRegex === 'string') {
|
|
254
|
-
matchStages.push({
|
|
255
|
-
$match: {
|
|
256
|
-
branchCode: {
|
|
257
|
-
$regex: new RegExp(branchCodeRegex)
|
|
258
|
-
}
|
|
259
|
-
}
|
|
260
|
-
});
|
|
261
|
-
}
|
|
262
|
-
const nameCodeRegex = (_k = searchConditions.name) === null || _k === void 0 ? void 0 : _k.$regex;
|
|
263
|
-
if (typeof nameCodeRegex === 'string') {
|
|
264
|
-
matchStages.push({
|
|
265
|
-
$match: {
|
|
266
|
-
$or: [
|
|
267
|
-
{
|
|
268
|
-
'name.ja': {
|
|
269
|
-
$exists: true,
|
|
270
|
-
$regex: new RegExp(nameCodeRegex)
|
|
271
|
-
}
|
|
272
|
-
},
|
|
273
|
-
{
|
|
274
|
-
'name.en': {
|
|
275
|
-
$exists: true,
|
|
276
|
-
$regex: new RegExp(nameCodeRegex)
|
|
277
|
-
}
|
|
278
|
-
}
|
|
279
|
-
]
|
|
280
|
-
}
|
|
281
|
-
});
|
|
282
|
-
}
|
|
283
|
-
const openSeatingAllowed = searchConditions.openSeatingAllowed;
|
|
284
|
-
if (typeof openSeatingAllowed === 'boolean') {
|
|
285
|
-
matchStages.push({
|
|
286
|
-
$match: {
|
|
287
|
-
openSeatingAllowed: {
|
|
288
|
-
$exists: true,
|
|
289
|
-
$eq: openSeatingAllowed
|
|
290
|
-
}
|
|
291
|
-
}
|
|
292
|
-
});
|
|
293
|
-
}
|
|
294
|
-
const additionalPropertyElemMatch = (_l = searchConditions.additionalProperty) === null || _l === void 0 ? void 0 : _l.$elemMatch;
|
|
295
|
-
if (additionalPropertyElemMatch !== undefined && additionalPropertyElemMatch !== null) {
|
|
296
|
-
matchStages.push({
|
|
297
|
-
$match: {
|
|
298
|
-
additionalProperty: {
|
|
299
|
-
$exists: true,
|
|
300
|
-
$elemMatch: additionalPropertyElemMatch
|
|
301
|
-
}
|
|
302
|
-
}
|
|
303
|
-
});
|
|
304
|
-
}
|
|
308
|
+
var _a, _b;
|
|
305
309
|
const aggregate = this.placeModel.aggregate([
|
|
306
310
|
{ $sort: { branchCode: factory.sortType.Ascending } },
|
|
307
|
-
|
|
308
|
-
...matchStages,
|
|
311
|
+
...ScreeningRoomRepo.CREATE_ROOM_MONGO_CONDITIONS(searchConditions),
|
|
309
312
|
{
|
|
310
313
|
$project: Object.assign(Object.assign({ _id: 0, typeOf: '$typeOf', branchCode: '$branchCode', name: '$name', address: '$address', containedInPlace: {
|
|
311
314
|
id: '$containedInPlace.id',
|
|
312
315
|
typeOf: '$containedInPlace.typeOf',
|
|
313
316
|
branchCode: '$containedInPlace.branchCode',
|
|
314
317
|
name: '$containedInPlace.name'
|
|
315
|
-
}, 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)
|
|
316
319
|
? {
|
|
317
320
|
sectionCount: {
|
|
318
321
|
$cond: {
|
|
@@ -322,7 +325,7 @@ class ScreeningRoomRepo {
|
|
|
322
325
|
}
|
|
323
326
|
}
|
|
324
327
|
}
|
|
325
|
-
: undefined), (((
|
|
328
|
+
: undefined), (((_b = searchConditions.$projection) === null || _b === void 0 ? void 0 : _b.seatCount) === 1)
|
|
326
329
|
? {
|
|
327
330
|
seatCount: {
|
|
328
331
|
$sum: {
|
|
@@ -354,6 +357,34 @@ class ScreeningRoomRepo {
|
|
|
354
357
|
.exec();
|
|
355
358
|
});
|
|
356
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
|
+
}
|
|
357
388
|
/**
|
|
358
389
|
* セクションと座席も含めたひとつのルームを取得する
|
|
359
390
|
*/
|
|
@@ -51,6 +51,7 @@ import type { PaymentServiceProviderRepo } from './repo/paymentServiceProvider';
|
|
|
51
51
|
import type { PendingReservationRepo } from './repo/pendingReservation';
|
|
52
52
|
import type { PermitRepo } from './repo/permit';
|
|
53
53
|
import type { BusStopRepo } from './repo/place/busStop';
|
|
54
|
+
import type { EntranceGateRepo } from './repo/place/entranceGate';
|
|
54
55
|
import type { HasPOSRepo } from './repo/place/hasPOS';
|
|
55
56
|
import type { MovieTheaterRepo } from './repo/place/movieTheater';
|
|
56
57
|
import type { ScreeningRoomRepo } from './repo/place/screeningRoom';
|
|
@@ -316,6 +317,13 @@ export declare namespace place {
|
|
|
316
317
|
namespace BusStop {
|
|
317
318
|
function createInstance(...params: ConstructorParameters<typeof BusStopRepo>): Promise<BusStopRepo>;
|
|
318
319
|
}
|
|
320
|
+
type EntranceGate = EntranceGateRepo;
|
|
321
|
+
/**
|
|
322
|
+
* 施設の入場ゲートリポジトリ
|
|
323
|
+
*/
|
|
324
|
+
namespace EntranceGate {
|
|
325
|
+
function createInstance(...params: ConstructorParameters<typeof EntranceGateRepo>): Promise<EntranceGateRepo>;
|
|
326
|
+
}
|
|
319
327
|
type HasPOS = HasPOSRepo;
|
|
320
328
|
/**
|
|
321
329
|
* 施設PointOfSalesリポジトリ
|
package/lib/chevre/repository.js
CHANGED
|
@@ -721,6 +721,22 @@ var place;
|
|
|
721
721
|
}
|
|
722
722
|
BusStop.createInstance = createInstance;
|
|
723
723
|
})(BusStop = place.BusStop || (place.BusStop = {}));
|
|
724
|
+
/**
|
|
725
|
+
* 施設の入場ゲートリポジトリ
|
|
726
|
+
*/
|
|
727
|
+
let EntranceGate;
|
|
728
|
+
(function (EntranceGate) {
|
|
729
|
+
let repo;
|
|
730
|
+
function createInstance(...params) {
|
|
731
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
732
|
+
if (repo === undefined) {
|
|
733
|
+
repo = (yield Promise.resolve().then(() => require('./repo/place/entranceGate'))).EntranceGateRepo;
|
|
734
|
+
}
|
|
735
|
+
return new repo(...params);
|
|
736
|
+
});
|
|
737
|
+
}
|
|
738
|
+
EntranceGate.createInstance = createInstance;
|
|
739
|
+
})(EntranceGate = place.EntranceGate || (place.EntranceGate = {}));
|
|
724
740
|
/**
|
|
725
741
|
* 施設PointOfSalesリポジトリ
|
|
726
742
|
*/
|
|
@@ -19,6 +19,6 @@ declare function processUpdateMovieTheater(params: IImportFromCOAParams): (repos
|
|
|
19
19
|
id: string;
|
|
20
20
|
};
|
|
21
21
|
movieTheater: IMovieTheater;
|
|
22
|
-
screeningRooms:
|
|
22
|
+
screeningRooms: Pick<factory.place.screeningRoom.IPlace, "additionalProperty" | "address" | "branchCode" | "name" | "openSeatingAllowed">[];
|
|
23
23
|
}>;
|
|
24
24
|
export { processUpdateMovieTheater };
|
|
@@ -65,7 +65,7 @@ function processUpdateMovieTheater(params) {
|
|
|
65
65
|
if (movieTheater === undefined) {
|
|
66
66
|
throw new factory.errors.NotFound(factory.placeType.MovieTheater);
|
|
67
67
|
}
|
|
68
|
-
screeningRooms = yield repos.screeningRoom.
|
|
68
|
+
screeningRooms = yield repos.screeningRoom.findRooms({
|
|
69
69
|
project: { id: { $eq: params.project.id } },
|
|
70
70
|
containedInPlace: { branchCode: { $eq: movieTheater.branchCode } }
|
|
71
71
|
});
|
|
@@ -7,7 +7,7 @@ import * as factory from '../../factory';
|
|
|
7
7
|
type IMovieTheater = Pick<factory.place.movieTheater.IPlace, 'id' | 'typeOf' | 'branchCode' | 'name' | 'kanaName'>;
|
|
8
8
|
declare function saveScreeningEvents(params: {
|
|
9
9
|
movieTheater: IMovieTheater;
|
|
10
|
-
screeningRooms: Pick<factory.place.screeningRoom.IPlace, '
|
|
10
|
+
screeningRooms: Pick<factory.place.screeningRoom.IPlace, 'branchCode' | 'name' | 'maximumAttendeeCapacity'>[];
|
|
11
11
|
screeningEventSerieses?: factory.eventSeries.IEvent[];
|
|
12
12
|
project: {
|
|
13
13
|
id: string;
|
|
@@ -266,7 +266,7 @@ function createScreeningEventFromCOA(params) {
|
|
|
266
266
|
name: params.superEvent.name,
|
|
267
267
|
eventStatus: factory.eventStatusType.EventScheduled,
|
|
268
268
|
location: {
|
|
269
|
-
typeOf:
|
|
269
|
+
typeOf: factory.placeType.ScreeningRoom,
|
|
270
270
|
branchCode: params.screenRoom.branchCode,
|
|
271
271
|
name: params.screenRoom.name
|
|
272
272
|
},
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { ICreatingEvent4ttts } from '../../../../repo/event';
|
|
2
2
|
import type { ICustomerMember } from '../../../../repo/member';
|
|
3
3
|
import * as factory from '../../../../factory';
|
|
4
|
-
declare function tour2creatingEvent(tour: ITourBySchedule, movieTheater: Pick<factory.place.movieTheater.IPlace, 'id' | 'branchCode' | 'parentOrganization'>, screeningRoom:
|
|
4
|
+
declare function tour2creatingEvent(tour: ITourBySchedule, movieTheater: Pick<factory.place.movieTheater.IPlace, 'id' | 'branchCode' | 'parentOrganization'>, screeningRoom: Pick<factory.place.screeningRoom.IPlace, 'additionalProperty' | 'address' | 'branchCode' | 'name' | 'maximumAttendeeCapacity'>, existingApplicationMembers: {
|
|
5
5
|
member: ICustomerMember;
|
|
6
6
|
}[], maxValue: number, eventService: Pick<factory.product.IProduct, 'id' | 'name'> & {
|
|
7
7
|
id: string;
|
|
@@ -83,7 +83,7 @@ function tour2creatingEvent(tour, movieTheater, screeningRoom, existingApplicati
|
|
|
83
83
|
}, typeOf: factory.product.ProductType.EventService, availableChannel: {
|
|
84
84
|
typeOf: 'ServiceChannel',
|
|
85
85
|
serviceLocation: {
|
|
86
|
-
typeOf:
|
|
86
|
+
typeOf: factory.placeType.ScreeningRoom,
|
|
87
87
|
branchCode: screeningRoom.branchCode,
|
|
88
88
|
name: screeningRoom.name,
|
|
89
89
|
containedInPlace: Object.assign({ typeOf: screeningEventSeries.location.typeOf, id: screeningEventSeries.location.id, branchCode: screeningEventSeries.location.branchCode }, (screeningEventSeries.location.name !== undefined)
|
|
@@ -104,7 +104,7 @@ function tour2creatingEvent(tour, movieTheater, screeningRoom, existingApplicati
|
|
|
104
104
|
: undefined), (screeningEventSeries.headline !== undefined)
|
|
105
105
|
? { headline: screeningEventSeries.headline }
|
|
106
106
|
: undefined);
|
|
107
|
-
const location = Object.assign({ typeOf:
|
|
107
|
+
const location = Object.assign({ typeOf: factory.placeType.ScreeningRoom, branchCode: screeningRoom.branchCode, name: screeningRoom.name }, (screeningRoom.address !== undefined) ? { address: screeningRoom.address } : undefined);
|
|
108
108
|
return {
|
|
109
109
|
project: { id: project.id, typeOf: factory.organizationType.Project },
|
|
110
110
|
typeOf: factory.eventType.ScreeningEvent,
|
|
@@ -61,7 +61,7 @@ function schedule2relatedResources(schedule) {
|
|
|
61
61
|
if (movieTheater === undefined) {
|
|
62
62
|
throw new factory.errors.NotFound(factory.placeType.MovieTheater);
|
|
63
63
|
}
|
|
64
|
-
const screeningRoom = (yield repos.screeningRoom.
|
|
64
|
+
const screeningRoom = (yield repos.screeningRoom.findRooms({
|
|
65
65
|
limit: 1,
|
|
66
66
|
page: 1,
|
|
67
67
|
project: { id: { $eq: project.id } },
|
|
@@ -433,14 +433,14 @@ function createInformMovieTheaterTasks(params, setting) {
|
|
|
433
433
|
throw new factory.errors.NotFound(factory.placeType.MovieTheater);
|
|
434
434
|
}
|
|
435
435
|
// ルームを検索
|
|
436
|
-
const screeningRooms = yield repos.screeningRoom.
|
|
436
|
+
const screeningRooms = yield repos.screeningRoom.findRooms({
|
|
437
437
|
containedInPlace: { id: { $eq: movieTheater.id } }
|
|
438
438
|
});
|
|
439
439
|
const movieTheaters4inform = [Object.assign(Object.assign({}, movieTheater), { containsPlace: screeningRooms.map((room) => {
|
|
440
440
|
return {
|
|
441
441
|
branchCode: room.branchCode,
|
|
442
442
|
name: room.name,
|
|
443
|
-
typeOf:
|
|
443
|
+
typeOf: factory.placeType.ScreeningRoom,
|
|
444
444
|
additionalProperty: room.additionalProperty,
|
|
445
445
|
address: room.address
|
|
446
446
|
};
|
|
@@ -216,7 +216,7 @@ function syncEvents(params) {
|
|
|
216
216
|
throw new factory.errors.NotFound(factory.placeType.MovieTheater);
|
|
217
217
|
}
|
|
218
218
|
// console.log('movieTheater:', movieTheater);
|
|
219
|
-
const screeningRoom = (yield repos.screeningRoom.
|
|
219
|
+
const screeningRoom = (yield repos.screeningRoom.findRooms({
|
|
220
220
|
project: { id: { $eq: params.project.id } },
|
|
221
221
|
containedInPlace: { branchCode: { $eq: movieTheater.branchCode } },
|
|
222
222
|
branchCode: { $eq: roomCode }
|
package/package.json
CHANGED