@chevre/domain 21.27.0 → 21.28.0-alpha.0
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/lib/chevre/repo/place/seat.d.ts +75 -0
- package/lib/chevre/repo/place/seat.js +361 -0
- package/lib/chevre/repo/place.d.ts +0 -74
- package/lib/chevre/repo/place.js +1 -299
- package/lib/chevre/repository.d.ts +11 -0
- package/lib/chevre/repository.js +19 -0
- package/lib/chevre/service/assetTransaction/reserve.d.ts +3 -3
- package/lib/chevre/service/assetTransaction/reserve.js +1 -1
- package/lib/chevre/service/offer/event/authorize.d.ts +2 -2
- package/lib/chevre/service/offer/event/processStartReserve4chevre.d.ts +2 -2
- package/lib/chevre/service/offer.d.ts +2 -2
- package/lib/chevre/service/offer.js +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import type { AnyExpression, Connection } from 'mongoose';
|
|
2
|
+
import * as factory from '../../factory';
|
|
3
|
+
/**
|
|
4
|
+
* 座席編集時レスポンス
|
|
5
|
+
*/
|
|
6
|
+
interface IUpdateSeatResult {
|
|
7
|
+
containedInPlace: {
|
|
8
|
+
/**
|
|
9
|
+
* 施設ID
|
|
10
|
+
*/
|
|
11
|
+
id: string;
|
|
12
|
+
};
|
|
13
|
+
typeOf: factory.placeType.ScreeningRoom;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* 座席リポジトリ
|
|
17
|
+
*/
|
|
18
|
+
export declare class MongoRepository {
|
|
19
|
+
private readonly placeModel;
|
|
20
|
+
constructor(connection: Connection);
|
|
21
|
+
static CREATE_SEARCH_SEATS_PROJECTION(params: factory.place.seat.IProjection): {
|
|
22
|
+
[field: string]: AnyExpression;
|
|
23
|
+
};
|
|
24
|
+
createSeat(seat: factory.place.seat.IPlace & {
|
|
25
|
+
parentOrganization?: {
|
|
26
|
+
id?: string;
|
|
27
|
+
};
|
|
28
|
+
}): Promise<IUpdateSeatResult>;
|
|
29
|
+
updateSeat(seat: Omit<factory.place.seat.IPlace, 'containedInPlace'> & {
|
|
30
|
+
containedInPlace: {
|
|
31
|
+
branchCode: string;
|
|
32
|
+
containedInPlace: {
|
|
33
|
+
branchCode: string;
|
|
34
|
+
containedInPlace: {
|
|
35
|
+
branchCode: string;
|
|
36
|
+
};
|
|
37
|
+
};
|
|
38
|
+
};
|
|
39
|
+
parentOrganization?: {
|
|
40
|
+
id?: string;
|
|
41
|
+
};
|
|
42
|
+
}, $unset: any): Promise<IUpdateSeatResult>;
|
|
43
|
+
searchSeats(params: factory.place.seat.ISearchConditions): Promise<factory.place.seat.IPlace[]>;
|
|
44
|
+
deleteSeat(seat: {
|
|
45
|
+
project: {
|
|
46
|
+
id: string;
|
|
47
|
+
};
|
|
48
|
+
parentOrganization?: {
|
|
49
|
+
id?: string;
|
|
50
|
+
};
|
|
51
|
+
/**
|
|
52
|
+
* 座席コード
|
|
53
|
+
*/
|
|
54
|
+
branchCode: string;
|
|
55
|
+
containedInPlace: {
|
|
56
|
+
/**
|
|
57
|
+
* セクションコード
|
|
58
|
+
*/
|
|
59
|
+
branchCode: string;
|
|
60
|
+
containedInPlace: {
|
|
61
|
+
/**
|
|
62
|
+
* ルームコード
|
|
63
|
+
*/
|
|
64
|
+
branchCode: string;
|
|
65
|
+
containedInPlace: {
|
|
66
|
+
/**
|
|
67
|
+
* 施設コード
|
|
68
|
+
*/
|
|
69
|
+
branchCode: string;
|
|
70
|
+
};
|
|
71
|
+
};
|
|
72
|
+
};
|
|
73
|
+
}): Promise<IUpdateSeatResult>;
|
|
74
|
+
}
|
|
75
|
+
export {};
|
|
@@ -0,0 +1,361 @@
|
|
|
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.MongoRepository = void 0;
|
|
13
|
+
const factory = require("../../factory");
|
|
14
|
+
const settings_1 = require("../../settings");
|
|
15
|
+
const place_1 = require("../mongoose/schemas/place");
|
|
16
|
+
/**
|
|
17
|
+
* 座席リポジトリ
|
|
18
|
+
*/
|
|
19
|
+
class MongoRepository {
|
|
20
|
+
constructor(connection) {
|
|
21
|
+
this.placeModel = connection.model(place_1.modelName, (0, place_1.createSchema)());
|
|
22
|
+
}
|
|
23
|
+
static CREATE_SEARCH_SEATS_PROJECTION(params) {
|
|
24
|
+
const includeSectionBranchCode = params['containedInPlace.branchCode'] !== 0;
|
|
25
|
+
const includeSectionName = params['containedInPlace.name'] !== 0;
|
|
26
|
+
const includeSectionTypeOf = params['containedInPlace.typeOf'] !== 0;
|
|
27
|
+
const includeScreeningRooms = params['containedInPlace.containedInPlace'] !== 0;
|
|
28
|
+
const projectStage = {
|
|
29
|
+
_id: 0,
|
|
30
|
+
typeOf: '$containsPlace.containsPlace.typeOf',
|
|
31
|
+
branchCode: '$containsPlace.containsPlace.branchCode',
|
|
32
|
+
name: '$containsPlace.containsPlace.name',
|
|
33
|
+
seatingType: '$containsPlace.containsPlace.seatingType',
|
|
34
|
+
containedInPlace: Object.assign(Object.assign(Object.assign(Object.assign({}, (includeSectionBranchCode) ? { branchCode: '$containsPlace.branchCode' } : undefined), (includeSectionName) ? { name: '$containsPlace.name' } : undefined), (includeSectionTypeOf) ? { typeOf: '$containsPlace.typeOf' } : undefined), (includeScreeningRooms)
|
|
35
|
+
? {
|
|
36
|
+
containedInPlace: {
|
|
37
|
+
typeOf: '$typeOf',
|
|
38
|
+
branchCode: '$branchCode',
|
|
39
|
+
name: '$name',
|
|
40
|
+
containedInPlace: {
|
|
41
|
+
id: '$containedInPlace.id',
|
|
42
|
+
typeOf: '$containedInPlace.typeOf',
|
|
43
|
+
branchCode: '$containedInPlace.branchCode',
|
|
44
|
+
name: '$containedInPlace.name'
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
: undefined),
|
|
49
|
+
additionalProperty: '$containsPlace.containsPlace.additionalProperty'
|
|
50
|
+
};
|
|
51
|
+
Object.keys(params)
|
|
52
|
+
.forEach((field) => {
|
|
53
|
+
if (typeof projectStage[field] === 'string') {
|
|
54
|
+
// tslint:disable-next-line:no-dynamic-delete
|
|
55
|
+
delete projectStage[field];
|
|
56
|
+
}
|
|
57
|
+
});
|
|
58
|
+
return projectStage;
|
|
59
|
+
}
|
|
60
|
+
// tslint:disable-next-line:max-func-body-length
|
|
61
|
+
createSeat(seat) {
|
|
62
|
+
var _a, _b, _c;
|
|
63
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
64
|
+
const screeningRoomSection = seat.containedInPlace;
|
|
65
|
+
if (typeof (screeningRoomSection === null || screeningRoomSection === void 0 ? void 0 : screeningRoomSection.branchCode) !== 'string') {
|
|
66
|
+
throw new factory.errors.ArgumentNull('containedInPlace.branchCode');
|
|
67
|
+
}
|
|
68
|
+
const screeningRoom = screeningRoomSection.containedInPlace;
|
|
69
|
+
if (typeof (screeningRoom === null || screeningRoom === void 0 ? void 0 : screeningRoom.branchCode) !== 'string') {
|
|
70
|
+
throw new factory.errors.ArgumentNull('containedInPlace.containedInPlace.branchCode');
|
|
71
|
+
}
|
|
72
|
+
const movieTheater = screeningRoom.containedInPlace;
|
|
73
|
+
if (typeof (movieTheater === null || movieTheater === void 0 ? void 0 : movieTheater.branchCode) !== 'string') {
|
|
74
|
+
throw new factory.errors.ArgumentNull('containedInPlace.containedInPlace.containedInPlace.branchCode');
|
|
75
|
+
}
|
|
76
|
+
// 施設存在確認
|
|
77
|
+
const movieTheaterDoc = yield this.placeModel.findOne(Object.assign({ typeOf: { $eq: factory.placeType.MovieTheater }, 'project.id': { $eq: seat.project.id }, branchCode: { $eq: movieTheater.branchCode } }, (typeof ((_a = seat.parentOrganization) === null || _a === void 0 ? void 0 : _a.id) === 'string')
|
|
78
|
+
? { 'parentOrganization.id': { $exists: true, $eq: seat.parentOrganization.id } }
|
|
79
|
+
: undefined), { _id: 1 })
|
|
80
|
+
.exec();
|
|
81
|
+
if (movieTheaterDoc === null) {
|
|
82
|
+
throw new factory.errors.NotFound(factory.placeType.MovieTheater);
|
|
83
|
+
}
|
|
84
|
+
const doc = yield this.placeModel.findOneAndUpdate({
|
|
85
|
+
typeOf: { $eq: factory.placeType.ScreeningRoom },
|
|
86
|
+
'project.id': { $eq: seat.project.id },
|
|
87
|
+
'containedInPlace.branchCode': { $exists: true, $eq: movieTheater.branchCode },
|
|
88
|
+
branchCode: { $eq: screeningRoom.branchCode },
|
|
89
|
+
'containsPlace.branchCode': { $eq: screeningRoomSection.branchCode }
|
|
90
|
+
}, {
|
|
91
|
+
$push: {
|
|
92
|
+
'containsPlace.$[screeningRoomSection].containsPlace': Object.assign(Object.assign({ typeOf: seat.typeOf, branchCode: seat.branchCode, additionalProperty: seat.additionalProperty }, (typeof ((_b = seat.name) === null || _b === void 0 ? void 0 : _b.ja) === 'string' || typeof ((_c = seat.name) === null || _c === void 0 ? void 0 : _c.en) === 'string') ? { name: seat.name } : undefined), (Array.isArray(seat.seatingType)) ? { seatingType: seat.seatingType } : undefined)
|
|
93
|
+
}
|
|
94
|
+
}, {
|
|
95
|
+
new: true,
|
|
96
|
+
arrayFilters: [
|
|
97
|
+
{
|
|
98
|
+
'screeningRoomSection.branchCode': { $eq: screeningRoomSection.branchCode },
|
|
99
|
+
'screeningRoomSection.containsPlace.branchCode': { $ne: seat.branchCode }
|
|
100
|
+
}
|
|
101
|
+
],
|
|
102
|
+
projection: { 'containedInPlace.id': 1, typeOf: 1 }
|
|
103
|
+
})
|
|
104
|
+
.exec();
|
|
105
|
+
// 存在しなければコード重複
|
|
106
|
+
if (doc === null) {
|
|
107
|
+
throw new factory.errors.AlreadyInUse(factory.placeType.Seat, ['branchCode']);
|
|
108
|
+
}
|
|
109
|
+
return doc.toObject();
|
|
110
|
+
});
|
|
111
|
+
}
|
|
112
|
+
// tslint:disable-next-line:cyclomatic-complexity max-func-body-length
|
|
113
|
+
updateSeat(seat, $unset) {
|
|
114
|
+
var _a, _b, _c;
|
|
115
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
116
|
+
const screeningRoomSection = seat.containedInPlace;
|
|
117
|
+
if (typeof (screeningRoomSection === null || screeningRoomSection === void 0 ? void 0 : screeningRoomSection.branchCode) !== 'string') {
|
|
118
|
+
throw new factory.errors.ArgumentNull('containedInPlace.branchCode');
|
|
119
|
+
}
|
|
120
|
+
const screeningRoom = screeningRoomSection.containedInPlace;
|
|
121
|
+
if (typeof (screeningRoom === null || screeningRoom === void 0 ? void 0 : screeningRoom.branchCode) !== 'string') {
|
|
122
|
+
throw new factory.errors.ArgumentNull('containedInPlace.containedInPlace.branchCode');
|
|
123
|
+
}
|
|
124
|
+
const movieTheater = screeningRoom.containedInPlace;
|
|
125
|
+
if (typeof (movieTheater === null || movieTheater === void 0 ? void 0 : movieTheater.branchCode) !== 'string') {
|
|
126
|
+
throw new factory.errors.ArgumentNull('containedInPlace.containedInPlace.containedInPlace.branchCode');
|
|
127
|
+
}
|
|
128
|
+
const doc = yield this.placeModel.findOneAndUpdate(Object.assign({ typeOf: { $eq: factory.placeType.ScreeningRoom }, 'project.id': { $eq: seat.project.id }, 'containedInPlace.branchCode': { $exists: true, $eq: movieTheater.branchCode }, branchCode: { $eq: screeningRoom.branchCode }, 'containsPlace.branchCode': { $eq: screeningRoomSection.branchCode }, 'containsPlace.containsPlace.branchCode': { $eq: seat.branchCode } }, (typeof ((_a = seat.parentOrganization) === null || _a === void 0 ? void 0 : _a.id) === 'string')
|
|
129
|
+
? { 'parentOrganization.id': { $exists: true, $eq: seat.parentOrganization.id } }
|
|
130
|
+
: undefined), Object.assign(Object.assign(Object.assign(Object.assign({ 'containsPlace.$[screeningRoomSection].containsPlace.$[seat].branchCode': seat.branchCode }, (typeof ((_b = seat.name) === null || _b === void 0 ? void 0 : _b.ja) === 'string' || typeof ((_c = seat.name) === null || _c === void 0 ? void 0 : _c.en) === 'string')
|
|
131
|
+
? {
|
|
132
|
+
'containsPlace.$[screeningRoomSection].containsPlace.$[seat].name': seat.name
|
|
133
|
+
}
|
|
134
|
+
: undefined), (Array.isArray(seat.seatingType))
|
|
135
|
+
? {
|
|
136
|
+
'containsPlace.$[screeningRoomSection].containsPlace.$[seat].seatingType': seat.seatingType
|
|
137
|
+
}
|
|
138
|
+
: undefined), (Array.isArray(seat.additionalProperty))
|
|
139
|
+
? {
|
|
140
|
+
'containsPlace.$[screeningRoomSection].containsPlace.$[seat].additionalProperty': seat.additionalProperty
|
|
141
|
+
}
|
|
142
|
+
: undefined), { $unset: Object.assign(Object.assign({ noExistingAttributeName: 1 }, (($unset === null || $unset === void 0 ? void 0 : $unset['containsPlace.$[screeningRoom].containsPlace.$[screeningRoomSection].containsPlace.$[seat].name'])
|
|
143
|
+
=== 1
|
|
144
|
+
|| ($unset === null || $unset === void 0 ? void 0 : $unset['containsPlace.$[screeningRoomSection].containsPlace.$[seat].name']) === 1)
|
|
145
|
+
? {
|
|
146
|
+
'containsPlace.$[screeningRoomSection].containsPlace.$[seat].name': 1
|
|
147
|
+
}
|
|
148
|
+
: undefined), (($unset === null || $unset === void 0 ? void 0 : $unset['containsPlace.$[screeningRoom].containsPlace.$[screeningRoomSection].containsPlace.$[seat].seatingType'])
|
|
149
|
+
=== 1
|
|
150
|
+
|| ($unset === null || $unset === void 0 ? void 0 : $unset['containsPlace.$[screeningRoomSection].containsPlace.$[seat].seatingType']) === 1)
|
|
151
|
+
? {
|
|
152
|
+
'containsPlace.$[screeningRoomSection].containsPlace.$[seat].seatingType': 1
|
|
153
|
+
}
|
|
154
|
+
: undefined) }), {
|
|
155
|
+
new: true,
|
|
156
|
+
arrayFilters: [
|
|
157
|
+
{ 'screeningRoomSection.branchCode': { $eq: screeningRoomSection.branchCode } },
|
|
158
|
+
{ 'seat.branchCode': { $eq: seat.branchCode } }
|
|
159
|
+
],
|
|
160
|
+
projection: { 'containedInPlace.id': 1, typeOf: 1 }
|
|
161
|
+
})
|
|
162
|
+
.exec();
|
|
163
|
+
if (doc === null) {
|
|
164
|
+
throw new factory.errors.NotFound(factory.placeType.Seat);
|
|
165
|
+
}
|
|
166
|
+
return doc.toObject();
|
|
167
|
+
});
|
|
168
|
+
}
|
|
169
|
+
// tslint:disable-next-line:cyclomatic-complexity max-func-body-length
|
|
170
|
+
searchSeats(params) {
|
|
171
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
|
|
172
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
173
|
+
const matchStages = [{ $match: { typeOf: { $eq: factory.placeType.ScreeningRoom } } }];
|
|
174
|
+
const projectIdEq = (_b = (_a = params.project) === null || _a === void 0 ? void 0 : _a.id) === null || _b === void 0 ? void 0 : _b.$eq;
|
|
175
|
+
if (typeof projectIdEq === 'string') {
|
|
176
|
+
matchStages.push({
|
|
177
|
+
$match: { 'project.id': { $eq: projectIdEq } }
|
|
178
|
+
});
|
|
179
|
+
}
|
|
180
|
+
const parentOrganizationIdEq = (_d = (_c = params.parentOrganization) === null || _c === void 0 ? void 0 : _c.id) === null || _d === void 0 ? void 0 : _d.$eq;
|
|
181
|
+
if (typeof parentOrganizationIdEq === 'string') {
|
|
182
|
+
matchStages.push({
|
|
183
|
+
$match: { 'parentOrganization.id': { $exists: true, $eq: parentOrganizationIdEq } }
|
|
184
|
+
});
|
|
185
|
+
}
|
|
186
|
+
const containedInPlaceBranchCodeEq = (_f = (_e = params.containedInPlace) === null || _e === void 0 ? void 0 : _e.branchCode) === null || _f === void 0 ? void 0 : _f.$eq;
|
|
187
|
+
if (typeof containedInPlaceBranchCodeEq === 'string') {
|
|
188
|
+
matchStages.push({
|
|
189
|
+
$match: {
|
|
190
|
+
'containsPlace.branchCode': {
|
|
191
|
+
$exists: true,
|
|
192
|
+
$eq: containedInPlaceBranchCodeEq
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
});
|
|
196
|
+
}
|
|
197
|
+
const containedInPlaceBranchCodeIn = (_h = (_g = params.containedInPlace) === null || _g === void 0 ? void 0 : _g.branchCode) === null || _h === void 0 ? void 0 : _h.$in;
|
|
198
|
+
if (Array.isArray(containedInPlaceBranchCodeIn)) {
|
|
199
|
+
matchStages.push({
|
|
200
|
+
$match: {
|
|
201
|
+
'containsPlace.branchCode': {
|
|
202
|
+
$exists: true,
|
|
203
|
+
$in: containedInPlaceBranchCodeIn
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
});
|
|
207
|
+
}
|
|
208
|
+
if (params.containedInPlace !== undefined) {
|
|
209
|
+
if (params.containedInPlace.containedInPlace !== undefined) {
|
|
210
|
+
if (params.containedInPlace.containedInPlace.branchCode !== undefined) {
|
|
211
|
+
if (typeof params.containedInPlace.containedInPlace.branchCode.$eq === 'string') {
|
|
212
|
+
matchStages.push({
|
|
213
|
+
$match: {
|
|
214
|
+
branchCode: {
|
|
215
|
+
$eq: params.containedInPlace.containedInPlace.branchCode.$eq
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
});
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
if (params.containedInPlace.containedInPlace.containedInPlace !== undefined) {
|
|
222
|
+
if (params.containedInPlace.containedInPlace.containedInPlace.branchCode !== undefined) {
|
|
223
|
+
if (typeof params.containedInPlace.containedInPlace.containedInPlace.branchCode.$eq === 'string') {
|
|
224
|
+
matchStages.push({
|
|
225
|
+
$match: {
|
|
226
|
+
'containedInPlace.branchCode': {
|
|
227
|
+
$exists: true,
|
|
228
|
+
$eq: params.containedInPlace.containedInPlace.containedInPlace.branchCode.$eq
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
});
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
// 座席コード
|
|
238
|
+
if (params.branchCode !== undefined) {
|
|
239
|
+
if (typeof params.branchCode.$eq === 'string') {
|
|
240
|
+
matchStages.push({
|
|
241
|
+
$match: {
|
|
242
|
+
'containsPlace.containsPlace.branchCode': {
|
|
243
|
+
$exists: true,
|
|
244
|
+
$eq: params.branchCode.$eq
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
});
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
const branchCodeIn = (_j = params.branchCode) === null || _j === void 0 ? void 0 : _j.$in;
|
|
251
|
+
if (Array.isArray(branchCodeIn)) {
|
|
252
|
+
matchStages.push({
|
|
253
|
+
$match: {
|
|
254
|
+
'containsPlace.containsPlace.branchCode': {
|
|
255
|
+
$exists: true,
|
|
256
|
+
$in: branchCodeIn
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
});
|
|
260
|
+
}
|
|
261
|
+
const branchCodeRegex = (_k = params.branchCode) === null || _k === void 0 ? void 0 : _k.$regex;
|
|
262
|
+
if (typeof branchCodeRegex === 'string' && branchCodeRegex.length > 0) {
|
|
263
|
+
matchStages.push({
|
|
264
|
+
$match: {
|
|
265
|
+
'containsPlace.containsPlace.branchCode': {
|
|
266
|
+
$exists: true,
|
|
267
|
+
$regex: new RegExp(branchCodeRegex)
|
|
268
|
+
}
|
|
269
|
+
}
|
|
270
|
+
});
|
|
271
|
+
}
|
|
272
|
+
const nameRegex = (_l = params.name) === null || _l === void 0 ? void 0 : _l.$regex;
|
|
273
|
+
if (typeof nameRegex === 'string' && nameRegex.length > 0) {
|
|
274
|
+
matchStages.push({
|
|
275
|
+
$match: {
|
|
276
|
+
$or: [
|
|
277
|
+
{
|
|
278
|
+
'containsPlace.containsPlace.name.ja': {
|
|
279
|
+
$exists: true,
|
|
280
|
+
$regex: new RegExp(nameRegex)
|
|
281
|
+
}
|
|
282
|
+
},
|
|
283
|
+
{
|
|
284
|
+
'containsPlace.containsPlace.name.en': {
|
|
285
|
+
$exists: true,
|
|
286
|
+
$regex: new RegExp(nameRegex)
|
|
287
|
+
}
|
|
288
|
+
}
|
|
289
|
+
]
|
|
290
|
+
}
|
|
291
|
+
});
|
|
292
|
+
}
|
|
293
|
+
const seatingTypeEq = (_m = params.seatingType) === null || _m === void 0 ? void 0 : _m.$eq;
|
|
294
|
+
if (typeof seatingTypeEq === 'string') {
|
|
295
|
+
matchStages.push({
|
|
296
|
+
$match: {
|
|
297
|
+
'containsPlace.containsPlace.seatingType': {
|
|
298
|
+
$exists: true,
|
|
299
|
+
$eq: seatingTypeEq
|
|
300
|
+
}
|
|
301
|
+
}
|
|
302
|
+
});
|
|
303
|
+
}
|
|
304
|
+
const additionalPropertyElemMatch = (_o = params.additionalProperty) === null || _o === void 0 ? void 0 : _o.$elemMatch;
|
|
305
|
+
if (additionalPropertyElemMatch !== undefined && additionalPropertyElemMatch !== null) {
|
|
306
|
+
matchStages.push({
|
|
307
|
+
$match: {
|
|
308
|
+
'containsPlace.containsPlace.additionalProperty': {
|
|
309
|
+
$exists: true,
|
|
310
|
+
$elemMatch: additionalPropertyElemMatch
|
|
311
|
+
}
|
|
312
|
+
}
|
|
313
|
+
});
|
|
314
|
+
}
|
|
315
|
+
const projectStage = MongoRepository.CREATE_SEARCH_SEATS_PROJECTION(Object.assign({}, params.$projection));
|
|
316
|
+
const aggregate = this.placeModel.aggregate([
|
|
317
|
+
{ $unwind: '$containsPlace' },
|
|
318
|
+
{ $unwind: '$containsPlace.containsPlace' },
|
|
319
|
+
...matchStages,
|
|
320
|
+
{ $project: projectStage }
|
|
321
|
+
]);
|
|
322
|
+
if (typeof params.limit === 'number' && params.limit > 0) {
|
|
323
|
+
const page = (typeof params.page === 'number' && params.page > 0) ? params.page : 1;
|
|
324
|
+
aggregate.limit(params.limit * page)
|
|
325
|
+
.skip(params.limit * (page - 1));
|
|
326
|
+
}
|
|
327
|
+
return aggregate
|
|
328
|
+
.option({ maxTimeMS: settings_1.MONGO_MAX_TIME_MS })
|
|
329
|
+
.exec();
|
|
330
|
+
});
|
|
331
|
+
}
|
|
332
|
+
deleteSeat(seat) {
|
|
333
|
+
var _a;
|
|
334
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
335
|
+
const doc = yield this.placeModel.findOneAndUpdate(Object.assign({ typeOf: { $eq: factory.placeType.ScreeningRoom }, 'project.id': { $eq: seat.project.id }, 'containedInPlace.branchCode': {
|
|
336
|
+
$exists: true,
|
|
337
|
+
$eq: seat.containedInPlace.containedInPlace.containedInPlace.branchCode
|
|
338
|
+
}, branchCode: { $eq: seat.containedInPlace.containedInPlace.branchCode }, 'containsPlace.branchCode': { $eq: seat.containedInPlace.branchCode }, 'containsPlace.containsPlace.branchCode': { $eq: seat.branchCode } }, (typeof ((_a = seat.parentOrganization) === null || _a === void 0 ? void 0 : _a.id) === 'string')
|
|
339
|
+
? { 'parentOrganization.id': { $exists: true, $eq: seat.parentOrganization.id } }
|
|
340
|
+
: undefined), {
|
|
341
|
+
$pull: {
|
|
342
|
+
'containsPlace.$[screeningRoomSection].containsPlace': {
|
|
343
|
+
branchCode: seat.branchCode
|
|
344
|
+
}
|
|
345
|
+
}
|
|
346
|
+
}, {
|
|
347
|
+
new: true,
|
|
348
|
+
arrayFilters: [
|
|
349
|
+
{ 'screeningRoomSection.branchCode': { $eq: seat.containedInPlace.branchCode } }
|
|
350
|
+
],
|
|
351
|
+
projection: { 'containedInPlace.id': 1, typeOf: 1 }
|
|
352
|
+
})
|
|
353
|
+
.exec();
|
|
354
|
+
if (doc === null) {
|
|
355
|
+
throw new factory.errors.NotFound(factory.placeType.Seat);
|
|
356
|
+
}
|
|
357
|
+
return doc.toObject();
|
|
358
|
+
});
|
|
359
|
+
}
|
|
360
|
+
}
|
|
361
|
+
exports.MongoRepository = MongoRepository;
|
|
@@ -210,80 +210,6 @@ export declare class MongoRepository {
|
|
|
210
210
|
};
|
|
211
211
|
};
|
|
212
212
|
}): Promise<IScreeningRoomFoundByBranchCode>;
|
|
213
|
-
createSeat(seat: factory.place.seat.IPlace & {
|
|
214
|
-
parentOrganization?: {
|
|
215
|
-
id?: string;
|
|
216
|
-
};
|
|
217
|
-
}): Promise<{
|
|
218
|
-
containedInPlace: {
|
|
219
|
-
/**
|
|
220
|
-
* 施設ID
|
|
221
|
-
*/
|
|
222
|
-
id: string;
|
|
223
|
-
};
|
|
224
|
-
typeOf: factory.placeType.ScreeningRoom;
|
|
225
|
-
}>;
|
|
226
|
-
updateSeat(seat: Omit<factory.place.seat.IPlace, 'containedInPlace'> & {
|
|
227
|
-
containedInPlace: {
|
|
228
|
-
branchCode: string;
|
|
229
|
-
containedInPlace: {
|
|
230
|
-
branchCode: string;
|
|
231
|
-
containedInPlace: {
|
|
232
|
-
branchCode: string;
|
|
233
|
-
};
|
|
234
|
-
};
|
|
235
|
-
};
|
|
236
|
-
parentOrganization?: {
|
|
237
|
-
id?: string;
|
|
238
|
-
};
|
|
239
|
-
}, $unset: any): Promise<{
|
|
240
|
-
containedInPlace: {
|
|
241
|
-
/**
|
|
242
|
-
* 施設ID
|
|
243
|
-
*/
|
|
244
|
-
id: string;
|
|
245
|
-
};
|
|
246
|
-
typeOf: factory.placeType.ScreeningRoom;
|
|
247
|
-
}>;
|
|
248
|
-
searchSeats(params: factory.place.seat.ISearchConditions): Promise<factory.place.seat.IPlace[]>;
|
|
249
|
-
deleteSeat(seat: {
|
|
250
|
-
project: {
|
|
251
|
-
id: string;
|
|
252
|
-
};
|
|
253
|
-
parentOrganization?: {
|
|
254
|
-
id?: string;
|
|
255
|
-
};
|
|
256
|
-
/**
|
|
257
|
-
* 座席コード
|
|
258
|
-
*/
|
|
259
|
-
branchCode: string;
|
|
260
|
-
containedInPlace: {
|
|
261
|
-
/**
|
|
262
|
-
* セクションコード
|
|
263
|
-
*/
|
|
264
|
-
branchCode: string;
|
|
265
|
-
containedInPlace: {
|
|
266
|
-
/**
|
|
267
|
-
* ルームコード
|
|
268
|
-
*/
|
|
269
|
-
branchCode: string;
|
|
270
|
-
containedInPlace: {
|
|
271
|
-
/**
|
|
272
|
-
* 施設コード
|
|
273
|
-
*/
|
|
274
|
-
branchCode: string;
|
|
275
|
-
};
|
|
276
|
-
};
|
|
277
|
-
};
|
|
278
|
-
}): Promise<{
|
|
279
|
-
containedInPlace: {
|
|
280
|
-
/**
|
|
281
|
-
* 施設ID
|
|
282
|
-
*/
|
|
283
|
-
id: string;
|
|
284
|
-
};
|
|
285
|
-
typeOf: factory.placeType.ScreeningRoom;
|
|
286
|
-
}>;
|
|
287
213
|
unsetUnnecessaryFieldsFromMovieTheater(params: {
|
|
288
214
|
filter: FilterQuery<any>;
|
|
289
215
|
$unset: any;
|
package/lib/chevre/repo/place.js
CHANGED
|
@@ -21,9 +21,9 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
21
21
|
};
|
|
22
22
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
23
23
|
exports.MongoRepository = void 0;
|
|
24
|
-
const place_1 = require("./mongoose/schemas/place");
|
|
25
24
|
const factory = require("../factory");
|
|
26
25
|
const settings_1 = require("../settings");
|
|
26
|
+
const place_1 = require("./mongoose/schemas/place");
|
|
27
27
|
/**
|
|
28
28
|
* 施設リポジトリ
|
|
29
29
|
*/
|
|
@@ -990,304 +990,6 @@ class MongoRepository {
|
|
|
990
990
|
return docs[0];
|
|
991
991
|
});
|
|
992
992
|
}
|
|
993
|
-
// tslint:disable-next-line:max-func-body-length
|
|
994
|
-
createSeat(seat) {
|
|
995
|
-
var _a, _b, _c;
|
|
996
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
997
|
-
const screeningRoomSection = seat.containedInPlace;
|
|
998
|
-
if (typeof (screeningRoomSection === null || screeningRoomSection === void 0 ? void 0 : screeningRoomSection.branchCode) !== 'string') {
|
|
999
|
-
throw new factory.errors.ArgumentNull('containedInPlace.branchCode');
|
|
1000
|
-
}
|
|
1001
|
-
const screeningRoom = screeningRoomSection.containedInPlace;
|
|
1002
|
-
if (typeof (screeningRoom === null || screeningRoom === void 0 ? void 0 : screeningRoom.branchCode) !== 'string') {
|
|
1003
|
-
throw new factory.errors.ArgumentNull('containedInPlace.containedInPlace.branchCode');
|
|
1004
|
-
}
|
|
1005
|
-
const movieTheater = screeningRoom.containedInPlace;
|
|
1006
|
-
if (typeof (movieTheater === null || movieTheater === void 0 ? void 0 : movieTheater.branchCode) !== 'string') {
|
|
1007
|
-
throw new factory.errors.ArgumentNull('containedInPlace.containedInPlace.containedInPlace.branchCode');
|
|
1008
|
-
}
|
|
1009
|
-
// 施設存在確認
|
|
1010
|
-
let doc = yield this.placeModel.findOne(Object.assign({ typeOf: { $eq: factory.placeType.MovieTheater }, 'project.id': { $eq: seat.project.id }, branchCode: { $eq: movieTheater.branchCode } }, (typeof ((_a = seat.parentOrganization) === null || _a === void 0 ? void 0 : _a.id) === 'string')
|
|
1011
|
-
? { 'parentOrganization.id': { $exists: true, $eq: seat.parentOrganization.id } }
|
|
1012
|
-
: undefined), { _id: 1 })
|
|
1013
|
-
.exec();
|
|
1014
|
-
if (doc === null) {
|
|
1015
|
-
throw new factory.errors.NotFound(factory.placeType.MovieTheater);
|
|
1016
|
-
}
|
|
1017
|
-
doc = yield this.placeModel.findOneAndUpdate({
|
|
1018
|
-
typeOf: { $eq: factory.placeType.ScreeningRoom },
|
|
1019
|
-
'project.id': { $eq: seat.project.id },
|
|
1020
|
-
'containedInPlace.branchCode': { $exists: true, $eq: movieTheater.branchCode },
|
|
1021
|
-
branchCode: { $eq: screeningRoom.branchCode },
|
|
1022
|
-
'containsPlace.branchCode': { $eq: screeningRoomSection.branchCode }
|
|
1023
|
-
}, {
|
|
1024
|
-
$push: {
|
|
1025
|
-
'containsPlace.$[screeningRoomSection].containsPlace': Object.assign(Object.assign({ typeOf: seat.typeOf, branchCode: seat.branchCode, additionalProperty: seat.additionalProperty }, (typeof ((_b = seat.name) === null || _b === void 0 ? void 0 : _b.ja) === 'string' || typeof ((_c = seat.name) === null || _c === void 0 ? void 0 : _c.en) === 'string') ? { name: seat.name } : undefined), (Array.isArray(seat.seatingType)) ? { seatingType: seat.seatingType } : undefined)
|
|
1026
|
-
}
|
|
1027
|
-
}, {
|
|
1028
|
-
new: true,
|
|
1029
|
-
arrayFilters: [
|
|
1030
|
-
{
|
|
1031
|
-
'screeningRoomSection.branchCode': { $eq: screeningRoomSection.branchCode },
|
|
1032
|
-
'screeningRoomSection.containsPlace.branchCode': { $ne: seat.branchCode }
|
|
1033
|
-
}
|
|
1034
|
-
],
|
|
1035
|
-
projection: { 'containedInPlace.id': 1, typeOf: 1 }
|
|
1036
|
-
})
|
|
1037
|
-
.exec();
|
|
1038
|
-
// 存在しなければコード重複
|
|
1039
|
-
if (doc === null) {
|
|
1040
|
-
throw new factory.errors.AlreadyInUse(factory.placeType.Seat, ['branchCode']);
|
|
1041
|
-
}
|
|
1042
|
-
return doc.toObject();
|
|
1043
|
-
});
|
|
1044
|
-
}
|
|
1045
|
-
// tslint:disable-next-line:cyclomatic-complexity max-func-body-length
|
|
1046
|
-
updateSeat(seat, $unset) {
|
|
1047
|
-
var _a, _b, _c;
|
|
1048
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
1049
|
-
const screeningRoomSection = seat.containedInPlace;
|
|
1050
|
-
if (typeof (screeningRoomSection === null || screeningRoomSection === void 0 ? void 0 : screeningRoomSection.branchCode) !== 'string') {
|
|
1051
|
-
throw new factory.errors.ArgumentNull('containedInPlace.branchCode');
|
|
1052
|
-
}
|
|
1053
|
-
const screeningRoom = screeningRoomSection.containedInPlace;
|
|
1054
|
-
if (typeof (screeningRoom === null || screeningRoom === void 0 ? void 0 : screeningRoom.branchCode) !== 'string') {
|
|
1055
|
-
throw new factory.errors.ArgumentNull('containedInPlace.containedInPlace.branchCode');
|
|
1056
|
-
}
|
|
1057
|
-
const movieTheater = screeningRoom.containedInPlace;
|
|
1058
|
-
if (typeof (movieTheater === null || movieTheater === void 0 ? void 0 : movieTheater.branchCode) !== 'string') {
|
|
1059
|
-
throw new factory.errors.ArgumentNull('containedInPlace.containedInPlace.containedInPlace.branchCode');
|
|
1060
|
-
}
|
|
1061
|
-
const doc = yield this.placeModel.findOneAndUpdate(Object.assign({ typeOf: { $eq: factory.placeType.ScreeningRoom }, 'project.id': { $eq: seat.project.id }, 'containedInPlace.branchCode': { $exists: true, $eq: movieTheater.branchCode }, branchCode: { $eq: screeningRoom.branchCode }, 'containsPlace.branchCode': { $eq: screeningRoomSection.branchCode }, 'containsPlace.containsPlace.branchCode': { $eq: seat.branchCode } }, (typeof ((_a = seat.parentOrganization) === null || _a === void 0 ? void 0 : _a.id) === 'string')
|
|
1062
|
-
? { 'parentOrganization.id': { $exists: true, $eq: seat.parentOrganization.id } }
|
|
1063
|
-
: undefined), Object.assign(Object.assign(Object.assign(Object.assign({ 'containsPlace.$[screeningRoomSection].containsPlace.$[seat].branchCode': seat.branchCode }, (typeof ((_b = seat.name) === null || _b === void 0 ? void 0 : _b.ja) === 'string' || typeof ((_c = seat.name) === null || _c === void 0 ? void 0 : _c.en) === 'string')
|
|
1064
|
-
? {
|
|
1065
|
-
'containsPlace.$[screeningRoomSection].containsPlace.$[seat].name': seat.name
|
|
1066
|
-
}
|
|
1067
|
-
: undefined), (Array.isArray(seat.seatingType))
|
|
1068
|
-
? {
|
|
1069
|
-
'containsPlace.$[screeningRoomSection].containsPlace.$[seat].seatingType': seat.seatingType
|
|
1070
|
-
}
|
|
1071
|
-
: undefined), (Array.isArray(seat.additionalProperty))
|
|
1072
|
-
? {
|
|
1073
|
-
'containsPlace.$[screeningRoomSection].containsPlace.$[seat].additionalProperty': seat.additionalProperty
|
|
1074
|
-
}
|
|
1075
|
-
: undefined), { $unset: Object.assign(Object.assign({ noExistingAttributeName: 1 }, (($unset === null || $unset === void 0 ? void 0 : $unset['containsPlace.$[screeningRoom].containsPlace.$[screeningRoomSection].containsPlace.$[seat].name'])
|
|
1076
|
-
=== 1
|
|
1077
|
-
|| ($unset === null || $unset === void 0 ? void 0 : $unset['containsPlace.$[screeningRoomSection].containsPlace.$[seat].name']) === 1)
|
|
1078
|
-
? {
|
|
1079
|
-
'containsPlace.$[screeningRoomSection].containsPlace.$[seat].name': 1
|
|
1080
|
-
}
|
|
1081
|
-
: undefined), (($unset === null || $unset === void 0 ? void 0 : $unset['containsPlace.$[screeningRoom].containsPlace.$[screeningRoomSection].containsPlace.$[seat].seatingType'])
|
|
1082
|
-
=== 1
|
|
1083
|
-
|| ($unset === null || $unset === void 0 ? void 0 : $unset['containsPlace.$[screeningRoomSection].containsPlace.$[seat].seatingType']) === 1)
|
|
1084
|
-
? {
|
|
1085
|
-
'containsPlace.$[screeningRoomSection].containsPlace.$[seat].seatingType': 1
|
|
1086
|
-
}
|
|
1087
|
-
: undefined) }), {
|
|
1088
|
-
new: true,
|
|
1089
|
-
arrayFilters: [
|
|
1090
|
-
{ 'screeningRoomSection.branchCode': { $eq: screeningRoomSection.branchCode } },
|
|
1091
|
-
{ 'seat.branchCode': { $eq: seat.branchCode } }
|
|
1092
|
-
],
|
|
1093
|
-
projection: { 'containedInPlace.id': 1, typeOf: 1 }
|
|
1094
|
-
})
|
|
1095
|
-
.exec();
|
|
1096
|
-
if (doc === null) {
|
|
1097
|
-
throw new factory.errors.NotFound(factory.placeType.Seat);
|
|
1098
|
-
}
|
|
1099
|
-
return doc.toObject();
|
|
1100
|
-
});
|
|
1101
|
-
}
|
|
1102
|
-
// tslint:disable-next-line:cyclomatic-complexity max-func-body-length
|
|
1103
|
-
searchSeats(params) {
|
|
1104
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
|
|
1105
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
1106
|
-
const matchStages = [{ $match: { typeOf: { $eq: factory.placeType.ScreeningRoom } } }];
|
|
1107
|
-
const projectIdEq = (_b = (_a = params.project) === null || _a === void 0 ? void 0 : _a.id) === null || _b === void 0 ? void 0 : _b.$eq;
|
|
1108
|
-
if (typeof projectIdEq === 'string') {
|
|
1109
|
-
matchStages.push({
|
|
1110
|
-
$match: { 'project.id': { $eq: projectIdEq } }
|
|
1111
|
-
});
|
|
1112
|
-
}
|
|
1113
|
-
const parentOrganizationIdEq = (_d = (_c = params.parentOrganization) === null || _c === void 0 ? void 0 : _c.id) === null || _d === void 0 ? void 0 : _d.$eq;
|
|
1114
|
-
if (typeof parentOrganizationIdEq === 'string') {
|
|
1115
|
-
matchStages.push({
|
|
1116
|
-
$match: { 'parentOrganization.id': { $exists: true, $eq: parentOrganizationIdEq } }
|
|
1117
|
-
});
|
|
1118
|
-
}
|
|
1119
|
-
const containedInPlaceBranchCodeEq = (_f = (_e = params.containedInPlace) === null || _e === void 0 ? void 0 : _e.branchCode) === null || _f === void 0 ? void 0 : _f.$eq;
|
|
1120
|
-
if (typeof containedInPlaceBranchCodeEq === 'string') {
|
|
1121
|
-
matchStages.push({
|
|
1122
|
-
$match: {
|
|
1123
|
-
'containsPlace.branchCode': {
|
|
1124
|
-
$exists: true,
|
|
1125
|
-
$eq: containedInPlaceBranchCodeEq
|
|
1126
|
-
}
|
|
1127
|
-
}
|
|
1128
|
-
});
|
|
1129
|
-
}
|
|
1130
|
-
const containedInPlaceBranchCodeIn = (_h = (_g = params.containedInPlace) === null || _g === void 0 ? void 0 : _g.branchCode) === null || _h === void 0 ? void 0 : _h.$in;
|
|
1131
|
-
if (Array.isArray(containedInPlaceBranchCodeIn)) {
|
|
1132
|
-
matchStages.push({
|
|
1133
|
-
$match: {
|
|
1134
|
-
'containsPlace.branchCode': {
|
|
1135
|
-
$exists: true,
|
|
1136
|
-
$in: containedInPlaceBranchCodeIn
|
|
1137
|
-
}
|
|
1138
|
-
}
|
|
1139
|
-
});
|
|
1140
|
-
}
|
|
1141
|
-
if (params.containedInPlace !== undefined) {
|
|
1142
|
-
if (params.containedInPlace.containedInPlace !== undefined) {
|
|
1143
|
-
if (params.containedInPlace.containedInPlace.branchCode !== undefined) {
|
|
1144
|
-
if (typeof params.containedInPlace.containedInPlace.branchCode.$eq === 'string') {
|
|
1145
|
-
matchStages.push({
|
|
1146
|
-
$match: {
|
|
1147
|
-
branchCode: {
|
|
1148
|
-
$eq: params.containedInPlace.containedInPlace.branchCode.$eq
|
|
1149
|
-
}
|
|
1150
|
-
}
|
|
1151
|
-
});
|
|
1152
|
-
}
|
|
1153
|
-
}
|
|
1154
|
-
if (params.containedInPlace.containedInPlace.containedInPlace !== undefined) {
|
|
1155
|
-
if (params.containedInPlace.containedInPlace.containedInPlace.branchCode !== undefined) {
|
|
1156
|
-
if (typeof params.containedInPlace.containedInPlace.containedInPlace.branchCode.$eq === 'string') {
|
|
1157
|
-
matchStages.push({
|
|
1158
|
-
$match: {
|
|
1159
|
-
'containedInPlace.branchCode': {
|
|
1160
|
-
$exists: true,
|
|
1161
|
-
$eq: params.containedInPlace.containedInPlace.containedInPlace.branchCode.$eq
|
|
1162
|
-
}
|
|
1163
|
-
}
|
|
1164
|
-
});
|
|
1165
|
-
}
|
|
1166
|
-
}
|
|
1167
|
-
}
|
|
1168
|
-
}
|
|
1169
|
-
}
|
|
1170
|
-
// 座席コード
|
|
1171
|
-
if (params.branchCode !== undefined) {
|
|
1172
|
-
if (typeof params.branchCode.$eq === 'string') {
|
|
1173
|
-
matchStages.push({
|
|
1174
|
-
$match: {
|
|
1175
|
-
'containsPlace.containsPlace.branchCode': {
|
|
1176
|
-
$exists: true,
|
|
1177
|
-
$eq: params.branchCode.$eq
|
|
1178
|
-
}
|
|
1179
|
-
}
|
|
1180
|
-
});
|
|
1181
|
-
}
|
|
1182
|
-
}
|
|
1183
|
-
const branchCodeIn = (_j = params.branchCode) === null || _j === void 0 ? void 0 : _j.$in;
|
|
1184
|
-
if (Array.isArray(branchCodeIn)) {
|
|
1185
|
-
matchStages.push({
|
|
1186
|
-
$match: {
|
|
1187
|
-
'containsPlace.containsPlace.branchCode': {
|
|
1188
|
-
$exists: true,
|
|
1189
|
-
$in: branchCodeIn
|
|
1190
|
-
}
|
|
1191
|
-
}
|
|
1192
|
-
});
|
|
1193
|
-
}
|
|
1194
|
-
const branchCodeRegex = (_k = params.branchCode) === null || _k === void 0 ? void 0 : _k.$regex;
|
|
1195
|
-
if (typeof branchCodeRegex === 'string' && branchCodeRegex.length > 0) {
|
|
1196
|
-
matchStages.push({
|
|
1197
|
-
$match: {
|
|
1198
|
-
'containsPlace.containsPlace.branchCode': {
|
|
1199
|
-
$exists: true,
|
|
1200
|
-
$regex: new RegExp(branchCodeRegex)
|
|
1201
|
-
}
|
|
1202
|
-
}
|
|
1203
|
-
});
|
|
1204
|
-
}
|
|
1205
|
-
const nameRegex = (_l = params.name) === null || _l === void 0 ? void 0 : _l.$regex;
|
|
1206
|
-
if (typeof nameRegex === 'string' && nameRegex.length > 0) {
|
|
1207
|
-
matchStages.push({
|
|
1208
|
-
$match: {
|
|
1209
|
-
$or: [
|
|
1210
|
-
{
|
|
1211
|
-
'containsPlace.containsPlace.name.ja': {
|
|
1212
|
-
$exists: true,
|
|
1213
|
-
$regex: new RegExp(nameRegex)
|
|
1214
|
-
}
|
|
1215
|
-
},
|
|
1216
|
-
{
|
|
1217
|
-
'containsPlace.containsPlace.name.en': {
|
|
1218
|
-
$exists: true,
|
|
1219
|
-
$regex: new RegExp(nameRegex)
|
|
1220
|
-
}
|
|
1221
|
-
}
|
|
1222
|
-
]
|
|
1223
|
-
}
|
|
1224
|
-
});
|
|
1225
|
-
}
|
|
1226
|
-
const seatingTypeEq = (_m = params.seatingType) === null || _m === void 0 ? void 0 : _m.$eq;
|
|
1227
|
-
if (typeof seatingTypeEq === 'string') {
|
|
1228
|
-
matchStages.push({
|
|
1229
|
-
$match: {
|
|
1230
|
-
'containsPlace.containsPlace.seatingType': {
|
|
1231
|
-
$exists: true,
|
|
1232
|
-
$eq: seatingTypeEq
|
|
1233
|
-
}
|
|
1234
|
-
}
|
|
1235
|
-
});
|
|
1236
|
-
}
|
|
1237
|
-
const additionalPropertyElemMatch = (_o = params.additionalProperty) === null || _o === void 0 ? void 0 : _o.$elemMatch;
|
|
1238
|
-
if (additionalPropertyElemMatch !== undefined && additionalPropertyElemMatch !== null) {
|
|
1239
|
-
matchStages.push({
|
|
1240
|
-
$match: {
|
|
1241
|
-
'containsPlace.containsPlace.additionalProperty': {
|
|
1242
|
-
$exists: true,
|
|
1243
|
-
$elemMatch: additionalPropertyElemMatch
|
|
1244
|
-
}
|
|
1245
|
-
}
|
|
1246
|
-
});
|
|
1247
|
-
}
|
|
1248
|
-
const projectStage = MongoRepository.CREATE_SEARCH_SEATS_PROJECTION(Object.assign({}, params.$projection));
|
|
1249
|
-
const aggregate = this.placeModel.aggregate([
|
|
1250
|
-
{ $unwind: '$containsPlace' },
|
|
1251
|
-
{ $unwind: '$containsPlace.containsPlace' },
|
|
1252
|
-
...matchStages,
|
|
1253
|
-
{ $project: projectStage }
|
|
1254
|
-
]);
|
|
1255
|
-
if (typeof params.limit === 'number' && params.limit > 0) {
|
|
1256
|
-
const page = (typeof params.page === 'number' && params.page > 0) ? params.page : 1;
|
|
1257
|
-
aggregate.limit(params.limit * page)
|
|
1258
|
-
.skip(params.limit * (page - 1));
|
|
1259
|
-
}
|
|
1260
|
-
return aggregate.exec();
|
|
1261
|
-
});
|
|
1262
|
-
}
|
|
1263
|
-
deleteSeat(seat) {
|
|
1264
|
-
var _a;
|
|
1265
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
1266
|
-
const doc = yield this.placeModel.findOneAndUpdate(Object.assign({ typeOf: { $eq: factory.placeType.ScreeningRoom }, 'project.id': { $eq: seat.project.id }, 'containedInPlace.branchCode': {
|
|
1267
|
-
$exists: true,
|
|
1268
|
-
$eq: seat.containedInPlace.containedInPlace.containedInPlace.branchCode
|
|
1269
|
-
}, branchCode: { $eq: seat.containedInPlace.containedInPlace.branchCode }, 'containsPlace.branchCode': { $eq: seat.containedInPlace.branchCode }, 'containsPlace.containsPlace.branchCode': { $eq: seat.branchCode } }, (typeof ((_a = seat.parentOrganization) === null || _a === void 0 ? void 0 : _a.id) === 'string')
|
|
1270
|
-
? { 'parentOrganization.id': { $exists: true, $eq: seat.parentOrganization.id } }
|
|
1271
|
-
: undefined), {
|
|
1272
|
-
$pull: {
|
|
1273
|
-
'containsPlace.$[screeningRoomSection].containsPlace': {
|
|
1274
|
-
branchCode: seat.branchCode
|
|
1275
|
-
}
|
|
1276
|
-
}
|
|
1277
|
-
}, {
|
|
1278
|
-
new: true,
|
|
1279
|
-
arrayFilters: [
|
|
1280
|
-
{ 'screeningRoomSection.branchCode': { $eq: seat.containedInPlace.branchCode } }
|
|
1281
|
-
],
|
|
1282
|
-
projection: { 'containedInPlace.id': 1, typeOf: 1 }
|
|
1283
|
-
})
|
|
1284
|
-
.exec();
|
|
1285
|
-
if (doc === null) {
|
|
1286
|
-
throw new factory.errors.NotFound(factory.placeType.Seat);
|
|
1287
|
-
}
|
|
1288
|
-
return doc.toObject();
|
|
1289
|
-
});
|
|
1290
|
-
}
|
|
1291
993
|
unsetUnnecessaryFieldsFromMovieTheater(params) {
|
|
1292
994
|
return __awaiter(this, void 0, void 0, function* () {
|
|
1293
995
|
return this.placeModel.updateMany(params.filter, { $unset: params.$unset })
|
|
@@ -34,6 +34,7 @@ import type { MongoRepository as PaymentServiceProviderRepo } from './repo/payme
|
|
|
34
34
|
import type { MongoRepository as PermitRepo } from './repo/permit';
|
|
35
35
|
import type { MongoRepository as PlaceRepo } from './repo/place';
|
|
36
36
|
import type { MongoRepository as HasPOSRepo } from './repo/place/hasPOS';
|
|
37
|
+
import type { MongoRepository as SeatRepo } from './repo/place/seat';
|
|
37
38
|
import type { MongoRepository as PriceSpecificationRepo } from './repo/priceSpecification';
|
|
38
39
|
import type { MongoRepository as ProductRepo } from './repo/product';
|
|
39
40
|
import type { MongoRepository as ProductOfferRepo } from './repo/productOffer';
|
|
@@ -207,9 +208,19 @@ export declare namespace Place {
|
|
|
207
208
|
}
|
|
208
209
|
export declare namespace place {
|
|
209
210
|
type HasPOS = HasPOSRepo;
|
|
211
|
+
/**
|
|
212
|
+
* 施設PointOfSalesリポジトリ
|
|
213
|
+
*/
|
|
210
214
|
namespace HasPOS {
|
|
211
215
|
function createInstance(...params: ConstructorParameters<typeof HasPOSRepo>): Promise<HasPOSRepo>;
|
|
212
216
|
}
|
|
217
|
+
type Seat = SeatRepo;
|
|
218
|
+
/**
|
|
219
|
+
* 座席リポジトリ
|
|
220
|
+
*/
|
|
221
|
+
namespace Seat {
|
|
222
|
+
function createInstance(...params: ConstructorParameters<typeof SeatRepo>): Promise<SeatRepo>;
|
|
223
|
+
}
|
|
213
224
|
}
|
|
214
225
|
export type PriceSpecification = PriceSpecificationRepo;
|
|
215
226
|
export declare namespace PriceSpecification {
|
package/lib/chevre/repository.js
CHANGED
|
@@ -484,6 +484,9 @@ var Place;
|
|
|
484
484
|
})(Place = exports.Place || (exports.Place = {}));
|
|
485
485
|
var place;
|
|
486
486
|
(function (place) {
|
|
487
|
+
/**
|
|
488
|
+
* 施設PointOfSalesリポジトリ
|
|
489
|
+
*/
|
|
487
490
|
let HasPOS;
|
|
488
491
|
(function (HasPOS) {
|
|
489
492
|
let repo;
|
|
@@ -497,6 +500,22 @@ var place;
|
|
|
497
500
|
}
|
|
498
501
|
HasPOS.createInstance = createInstance;
|
|
499
502
|
})(HasPOS = place.HasPOS || (place.HasPOS = {}));
|
|
503
|
+
/**
|
|
504
|
+
* 座席リポジトリ
|
|
505
|
+
*/
|
|
506
|
+
let Seat;
|
|
507
|
+
(function (Seat) {
|
|
508
|
+
let repo;
|
|
509
|
+
function createInstance(...params) {
|
|
510
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
511
|
+
if (repo === undefined) {
|
|
512
|
+
repo = (yield Promise.resolve().then(() => require('./repo/place/seat'))).MongoRepository;
|
|
513
|
+
}
|
|
514
|
+
return new repo(...params);
|
|
515
|
+
});
|
|
516
|
+
}
|
|
517
|
+
Seat.createInstance = createInstance;
|
|
518
|
+
})(Seat = place.Seat || (place.Seat = {}));
|
|
500
519
|
})(place = exports.place || (exports.place = {}));
|
|
501
520
|
var PriceSpecification;
|
|
502
521
|
(function (PriceSpecification) {
|
|
@@ -7,7 +7,7 @@ import type { MongoRepository as OfferCatalogRepo } from '../../repo/offerCatalo
|
|
|
7
7
|
import type { MongoRepository as OfferCatalogItemRepo } from '../../repo/offerCatalogItem';
|
|
8
8
|
import type { MongoRepository as OrderRepo } from '../../repo/order';
|
|
9
9
|
import type { MongoRepository as PaymentServiceRepo } from '../../repo/paymentService';
|
|
10
|
-
import type { MongoRepository as
|
|
10
|
+
import type { MongoRepository as SeatRepo } from '../../repo/place/seat';
|
|
11
11
|
import type { MongoRepository as PriceSpecificationRepo } from '../../repo/priceSpecification';
|
|
12
12
|
import type { MongoRepository as ProductRepo } from '../../repo/product';
|
|
13
13
|
import type { MongoRepository as ProductOfferRepo } from '../../repo/productOffer';
|
|
@@ -26,10 +26,10 @@ export interface IStartOperationRepos {
|
|
|
26
26
|
paymentService: PaymentServiceRepo;
|
|
27
27
|
product: ProductRepo;
|
|
28
28
|
productOffer: ProductOfferRepo;
|
|
29
|
-
place: PlaceRepo;
|
|
30
29
|
priceSpecification: PriceSpecificationRepo;
|
|
31
30
|
project: ProjectRepo;
|
|
32
31
|
reservation: ReservationRepo;
|
|
32
|
+
seat: SeatRepo;
|
|
33
33
|
task: TaskRepo;
|
|
34
34
|
assetTransaction: AssetTransactionRepo;
|
|
35
35
|
}
|
|
@@ -44,9 +44,9 @@ export interface IAddReservationsOperationRepos {
|
|
|
44
44
|
paymentService: PaymentServiceRepo;
|
|
45
45
|
product: ProductRepo;
|
|
46
46
|
productOffer: ProductOfferRepo;
|
|
47
|
-
place: PlaceRepo;
|
|
48
47
|
priceSpecification: PriceSpecificationRepo;
|
|
49
48
|
reservation: ReservationRepo;
|
|
49
|
+
seat: SeatRepo;
|
|
50
50
|
task: TaskRepo;
|
|
51
51
|
assetTransaction: AssetTransactionRepo;
|
|
52
52
|
}
|
|
@@ -207,7 +207,7 @@ function searchEventSeatOffers(params) {
|
|
|
207
207
|
});
|
|
208
208
|
const roomBranchCode = String((_d = (_c = eventOffers.itemOffered) === null || _c === void 0 ? void 0 : _c.availableChannel) === null || _d === void 0 ? void 0 : _d.serviceLocation.branchCode);
|
|
209
209
|
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);
|
|
210
|
-
const seats = yield repos.
|
|
210
|
+
const seats = yield repos.seat.searchSeats({
|
|
211
211
|
project: { id: { $eq: params.event.project.id } },
|
|
212
212
|
branchCode: { $in: params.branchCode.$in },
|
|
213
213
|
containedInPlace: {
|
|
@@ -8,7 +8,7 @@ import type { MongoRepository as OfferCatalogItemRepo } from '../../../repo/offe
|
|
|
8
8
|
import type { MongoRepository as OrderInTransactionRepo } from '../../../repo/orderInTransaction';
|
|
9
9
|
import type { RedisRepository as OrderNumberRepo } from '../../../repo/orderNumber';
|
|
10
10
|
import type { MongoRepository as PaymentServiceRepo } from '../../../repo/paymentService';
|
|
11
|
-
import type { MongoRepository as
|
|
11
|
+
import type { MongoRepository as SeatRepo } from '../../../repo/place/seat';
|
|
12
12
|
import type { MongoRepository as PriceSpecificationRepo } from '../../../repo/priceSpecification';
|
|
13
13
|
import type { MongoRepository as ProductRepo } from '../../../repo/product';
|
|
14
14
|
import type { MongoRepository as ProductOfferRepo } from '../../../repo/productOffer';
|
|
@@ -31,12 +31,12 @@ interface IAuthorizeRepos {
|
|
|
31
31
|
orderInTransaction: OrderInTransactionRepo;
|
|
32
32
|
orderNumber: OrderNumberRepo;
|
|
33
33
|
paymentService: PaymentServiceRepo;
|
|
34
|
-
place: PlaceRepo;
|
|
35
34
|
priceSpecification: PriceSpecificationRepo;
|
|
36
35
|
product: ProductRepo;
|
|
37
36
|
productOffer: ProductOfferRepo;
|
|
38
37
|
project: ProjectRepo;
|
|
39
38
|
reservation: ReservationRepo;
|
|
39
|
+
seat: SeatRepo;
|
|
40
40
|
task: TaskRepo;
|
|
41
41
|
transaction: TransactionRepo;
|
|
42
42
|
transactionNumber: TransactionNumberRepo;
|
|
@@ -6,7 +6,7 @@ import type { MongoRepository as OfferRepo } from '../../../repo/offer';
|
|
|
6
6
|
import type { MongoRepository as OfferCatalogRepo } from '../../../repo/offerCatalog';
|
|
7
7
|
import type { MongoRepository as OfferCatalogItemRepo } from '../../../repo/offerCatalogItem';
|
|
8
8
|
import type { MongoRepository as PaymentServiceRepo } from '../../../repo/paymentService';
|
|
9
|
-
import type { MongoRepository as
|
|
9
|
+
import type { MongoRepository as SeatRepo } from '../../../repo/place/seat';
|
|
10
10
|
import type { MongoRepository as PriceSpecificationRepo } from '../../../repo/priceSpecification';
|
|
11
11
|
import type { MongoRepository as ProductRepo } from '../../../repo/product';
|
|
12
12
|
import type { MongoRepository as ProductOfferRepo } from '../../../repo/productOffer';
|
|
@@ -41,10 +41,10 @@ declare function processStartReserve4chevre(params: {
|
|
|
41
41
|
paymentService: PaymentServiceRepo;
|
|
42
42
|
product: ProductRepo;
|
|
43
43
|
productOffer: ProductOfferRepo;
|
|
44
|
-
place: PlaceRepo;
|
|
45
44
|
priceSpecification: PriceSpecificationRepo;
|
|
46
45
|
project: ProjectRepo;
|
|
47
46
|
reservation: ReservationRepo;
|
|
47
|
+
seat: SeatRepo;
|
|
48
48
|
task: TaskRepo;
|
|
49
49
|
assetTransaction: AssetTransactionRepo;
|
|
50
50
|
}) => Promise<{
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { MongoRepository as EventRepo } from '../repo/event';
|
|
2
|
-
import type { MongoRepository as
|
|
2
|
+
import type { MongoRepository as SeatRepo } from '../repo/place/seat';
|
|
3
3
|
import type { MongoRepository as PriceSpecificationRepo } from '../repo/priceSpecification';
|
|
4
4
|
import type { StockHolderRepository as StockHolderRepo } from '../repo/stockHolder';
|
|
5
5
|
import * as factory from '../factory';
|
|
@@ -42,5 +42,5 @@ export declare function searchEventSeatOffersWithPaging(params: {
|
|
|
42
42
|
event: EventRepo;
|
|
43
43
|
priceSpecification: PriceSpecificationRepo;
|
|
44
44
|
stockHolder: StockHolderRepo;
|
|
45
|
-
|
|
45
|
+
seat: SeatRepo;
|
|
46
46
|
}) => Promise<Pick<factory.place.seat.IPlaceWithOffer, 'branchCode' | 'containedInPlace' | 'offers' | 'seatingType' | 'typeOf'>[]>;
|
|
@@ -80,7 +80,7 @@ function searchEventSeatOffersWithPaging(params) {
|
|
|
80
80
|
});
|
|
81
81
|
const roomBranchCode = String((_d = (_c = eventOffers.itemOffered) === null || _c === void 0 ? void 0 : _c.availableChannel) === null || _d === void 0 ? void 0 : _d.serviceLocation.branchCode);
|
|
82
82
|
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);
|
|
83
|
-
const seats = yield repos.
|
|
83
|
+
const seats = yield repos.seat.searchSeats(Object.assign(Object.assign({}, params), { project: { id: { $eq: event.project.id } }, containedInPlace: {
|
|
84
84
|
branchCode: {
|
|
85
85
|
$eq: (typeof ((_h = (_g = params.containedInPlace) === null || _g === void 0 ? void 0 : _g.branchCode) === null || _h === void 0 ? void 0 : _h.$eq) === 'string')
|
|
86
86
|
? (_k = (_j = params.containedInPlace) === null || _j === void 0 ? void 0 : _j.branchCode) === null || _k === void 0 ? void 0 : _k.$eq
|
package/package.json
CHANGED