@chevre/domain 21.2.0-alpha.130 → 21.2.0-alpha.132
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/searchHoldReservations.ts +9 -9
- package/example/src/chevre/searchPaymentServiceProviders.ts +38 -0
- package/lib/chevre/repo/mongoose/schemas/holdReservation.js +30 -0
- package/lib/chevre/repo/mongoose/schemas/product.js +6 -0
- package/lib/chevre/repo/product.d.ts +17 -0
- package/lib/chevre/repo/product.js +114 -1
- package/lib/chevre/repo/stockHolder.d.ts +3 -1
- package/lib/chevre/repo/stockHolder.js +61 -19
- package/package.json +2 -2
|
@@ -19,18 +19,18 @@ async function main() {
|
|
|
19
19
|
const stockHolderRepo = new chevre.repository.StockHolder(client, mongoose.connection);
|
|
20
20
|
|
|
21
21
|
const holdReservations = await stockHolderRepo.search({
|
|
22
|
-
limit:
|
|
23
|
-
page:
|
|
22
|
+
limit: 2,
|
|
23
|
+
page: 2,
|
|
24
|
+
sort: { 'reservationFor.startDate': chevre.factory.sortType.Ascending }
|
|
24
25
|
});
|
|
25
|
-
console.log(holdReservations
|
|
26
|
+
console.log(holdReservations);
|
|
26
27
|
console.log(holdReservations.length);
|
|
27
28
|
|
|
28
|
-
const aggregations = await stockHolderRepo.aggregateByReservationFor({
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
console.log(aggregations);
|
|
29
|
+
// const aggregations = await stockHolderRepo.aggregateByReservationFor({
|
|
30
|
+
// limit: 100,
|
|
31
|
+
// page: 1
|
|
32
|
+
// });
|
|
33
|
+
// console.log(aggregations);
|
|
34
34
|
}
|
|
35
35
|
|
|
36
36
|
main()
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
// tslint:disable:no-console
|
|
2
|
+
import * as mongoose from 'mongoose';
|
|
3
|
+
|
|
4
|
+
import { chevre } from '../../../lib/index';
|
|
5
|
+
|
|
6
|
+
const PROJECT_ID = process.env.PROJECT_ID;
|
|
7
|
+
|
|
8
|
+
async function main() {
|
|
9
|
+
await mongoose.connect(<string>process.env.MONGOLAB_URI);
|
|
10
|
+
|
|
11
|
+
const productRepo = new chevre.repository.Product(mongoose.connection);
|
|
12
|
+
|
|
13
|
+
const providers = await productRepo.searchProviders({
|
|
14
|
+
project: { id: { $eq: PROJECT_ID } },
|
|
15
|
+
id: 'xxx'
|
|
16
|
+
});
|
|
17
|
+
console.log(providers);
|
|
18
|
+
console.log(providers[0]?.credentials);
|
|
19
|
+
console.log(providers.length);
|
|
20
|
+
|
|
21
|
+
const paymentServices = await productRepo.searchPaymentServicesByProvider(
|
|
22
|
+
{
|
|
23
|
+
limit: 10,
|
|
24
|
+
page: 1,
|
|
25
|
+
sort: { productID: chevre.factory.sortType.Descending },
|
|
26
|
+
project: { id: { $eq: PROJECT_ID } },
|
|
27
|
+
typeOf: { $eq: chevre.factory.service.paymentService.PaymentServiceType.CreditCard },
|
|
28
|
+
provider: { id: { $eq: 'xxx' } }
|
|
29
|
+
}
|
|
30
|
+
);
|
|
31
|
+
console.log(paymentServices);
|
|
32
|
+
console.log(paymentServices[0]?.provider?.credentials);
|
|
33
|
+
console.log(paymentServices.length);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
main()
|
|
37
|
+
.then(console.log)
|
|
38
|
+
.catch(console.error);
|
|
@@ -60,3 +60,33 @@ schema.index({ 'reservationFor.startDate': -1 }, { name: 'searchByReservationFor
|
|
|
60
60
|
schema.index({ 'reservationFor.id': 1 }, { name: 'uniqueReservationForId', unique: true });
|
|
61
61
|
schema.index({ 'reservationFor.id': 1, 'reservationFor.startDate': -1 }, { name: 'searchByReservationForId' });
|
|
62
62
|
schema.index({ 'project.id': 1, 'reservationFor.startDate': -1 }, { name: 'searchByProjectId' });
|
|
63
|
+
schema.index({ 'reservations.reservationNumber': 1, 'reservationFor.startDate': -1 }, {
|
|
64
|
+
name: 'searchByReservationNumber',
|
|
65
|
+
partialFilterExpression: {
|
|
66
|
+
'reservations.reservationNumber': { $exists: true }
|
|
67
|
+
}
|
|
68
|
+
});
|
|
69
|
+
schema.index({ 'reservations.subReservation.id': 1, 'reservationFor.startDate': -1 }, {
|
|
70
|
+
name: 'searchBySubReservationId',
|
|
71
|
+
partialFilterExpression: {
|
|
72
|
+
'reservations.subReservation.id': { $exists: true }
|
|
73
|
+
}
|
|
74
|
+
});
|
|
75
|
+
schema.index({ 'reservations.subReservation.identifier': 1, 'reservationFor.startDate': -1 }, {
|
|
76
|
+
name: 'searchBySubReservationIdentifier',
|
|
77
|
+
partialFilterExpression: {
|
|
78
|
+
'reservations.subReservation.identifier': { $exists: true }
|
|
79
|
+
}
|
|
80
|
+
});
|
|
81
|
+
schema.index({ 'reservations.subReservation.reservedTicket.ticketedSeat.seatNumber': 1, 'reservationFor.startDate': -1 }, {
|
|
82
|
+
name: 'searchBySubReservationSeatNumber',
|
|
83
|
+
partialFilterExpression: {
|
|
84
|
+
'reservations.subReservation.reservedTicket.ticketedSeat.seatNumber': { $exists: true }
|
|
85
|
+
}
|
|
86
|
+
});
|
|
87
|
+
schema.index({ 'reservations.subReservation.reservedTicket.ticketedSeat.seatSection': 1, 'reservationFor.startDate': -1 }, {
|
|
88
|
+
name: 'searchBySubReservationSeatSection',
|
|
89
|
+
partialFilterExpression: {
|
|
90
|
+
'reservations.subReservation.reservedTicket.ticketedSeat.seatSection': { $exists: true }
|
|
91
|
+
}
|
|
92
|
+
});
|
|
@@ -100,3 +100,9 @@ schema.index({ 'name.en': 1, productID: 1 }, {
|
|
|
100
100
|
'name.en': { $exists: true }
|
|
101
101
|
}
|
|
102
102
|
});
|
|
103
|
+
schema.index({ 'provider.id': 1, productID: 1 }, {
|
|
104
|
+
name: 'searchByProviderId',
|
|
105
|
+
partialFilterExpression: {
|
|
106
|
+
'provider.id': { $exists: true }
|
|
107
|
+
}
|
|
108
|
+
});
|
|
@@ -25,6 +25,9 @@
|
|
|
25
25
|
import { Connection } from 'mongoose';
|
|
26
26
|
import * as factory from '../factory';
|
|
27
27
|
export type IProduct = factory.product.IProduct | factory.service.paymentService.IService;
|
|
28
|
+
export type IPaymentServiceByProvider = Pick<factory.service.paymentService.IService, 'name' | 'description' | 'typeOf' | 'id' | 'productID' | 'serviceType' | 'additionalProperty'> & {
|
|
29
|
+
provider?: Pick<factory.service.paymentService.IProvider, 'credentials'>;
|
|
30
|
+
};
|
|
28
31
|
/**
|
|
29
32
|
* プロダクトリポジトリ
|
|
30
33
|
*/
|
|
@@ -51,6 +54,20 @@ export declare class MongoRepository {
|
|
|
51
54
|
typeOf: factory.service.paymentService.PaymentServiceType;
|
|
52
55
|
id: string;
|
|
53
56
|
}): Promise<factory.product.IAvailableChannel>;
|
|
57
|
+
searchPaymentServicesByProvider(params: Pick<factory.product.ISearchConditions, 'limit' | 'page' | 'sort' | 'project' | 'provider' | 'typeOf'>): Promise<IPaymentServiceByProvider[]>;
|
|
58
|
+
/**
|
|
59
|
+
* 決済サービスのプロバイダー検索
|
|
60
|
+
*/
|
|
61
|
+
searchProviders(params: {
|
|
62
|
+
limit?: number;
|
|
63
|
+
page?: number;
|
|
64
|
+
project?: {
|
|
65
|
+
id?: {
|
|
66
|
+
$eq?: string;
|
|
67
|
+
};
|
|
68
|
+
};
|
|
69
|
+
id: string;
|
|
70
|
+
}): Promise<factory.service.paymentService.IProvider[]>;
|
|
54
71
|
/**
|
|
55
72
|
* プロダクトを保管する
|
|
56
73
|
* 作成 or 更新
|
|
@@ -21,6 +21,7 @@ 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 mongoose_1 = require("mongoose");
|
|
24
25
|
const product_1 = require("./mongoose/schemas/product");
|
|
25
26
|
const factory = require("../factory");
|
|
26
27
|
const settings_1 = require("../settings");
|
|
@@ -33,7 +34,7 @@ class MongoRepository {
|
|
|
33
34
|
}
|
|
34
35
|
// tslint:disable-next-line:max-func-body-length
|
|
35
36
|
static CREATE_MONGO_CONDITIONS(params) {
|
|
36
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v;
|
|
37
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x;
|
|
37
38
|
// MongoDB検索条件
|
|
38
39
|
const andConditions = [];
|
|
39
40
|
const projectIdEq = (_b = (_a = params.project) === null || _a === void 0 ? void 0 : _a.id) === null || _b === void 0 ? void 0 : _b.$eq;
|
|
@@ -144,6 +145,11 @@ class MongoRepository {
|
|
|
144
145
|
]
|
|
145
146
|
});
|
|
146
147
|
}
|
|
148
|
+
// プロバイダー条件を追加(2023-06-21~)
|
|
149
|
+
const providerIdEq = (_x = (_w = params.provider) === null || _w === void 0 ? void 0 : _w.id) === null || _x === void 0 ? void 0 : _x.$eq;
|
|
150
|
+
if (typeof providerIdEq === 'string') {
|
|
151
|
+
andConditions.push({ 'provider.id': { $exists: true, $eq: providerIdEq } });
|
|
152
|
+
}
|
|
147
153
|
return andConditions;
|
|
148
154
|
}
|
|
149
155
|
findById(conditions, projection) {
|
|
@@ -225,6 +231,113 @@ class MongoRepository {
|
|
|
225
231
|
return availableChannel;
|
|
226
232
|
});
|
|
227
233
|
}
|
|
234
|
+
searchPaymentServicesByProvider(params) {
|
|
235
|
+
var _a, _b, _c, _d, _e, _f;
|
|
236
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
237
|
+
const matchStages = [];
|
|
238
|
+
const projectIdEq = (_b = (_a = params.project) === null || _a === void 0 ? void 0 : _a.id) === null || _b === void 0 ? void 0 : _b.$eq;
|
|
239
|
+
if (typeof projectIdEq === 'string') {
|
|
240
|
+
matchStages.push({ $match: { 'project.id': { $eq: projectIdEq } } });
|
|
241
|
+
}
|
|
242
|
+
const typeOfEq = (_c = params.typeOf) === null || _c === void 0 ? void 0 : _c.$eq;
|
|
243
|
+
if (typeof typeOfEq === 'string') {
|
|
244
|
+
matchStages.push({ $match: { typeOf: { $eq: typeOfEq } } });
|
|
245
|
+
}
|
|
246
|
+
const providerIdEq = (_e = (_d = params.provider) === null || _d === void 0 ? void 0 : _d.id) === null || _e === void 0 ? void 0 : _e.$eq;
|
|
247
|
+
if (typeof providerIdEq === 'string') {
|
|
248
|
+
matchStages.push({ $match: { 'provider.id': { $exists: true, $eq: providerIdEq } } });
|
|
249
|
+
}
|
|
250
|
+
const aggregate = this.productModel.aggregate([
|
|
251
|
+
...(typeof ((_f = params.sort) === null || _f === void 0 ? void 0 : _f.productID) === 'number')
|
|
252
|
+
? [{ $sort: { productID: params.sort.productID } }]
|
|
253
|
+
: [],
|
|
254
|
+
{
|
|
255
|
+
$unwind: {
|
|
256
|
+
path: '$provider'
|
|
257
|
+
}
|
|
258
|
+
},
|
|
259
|
+
...matchStages,
|
|
260
|
+
{
|
|
261
|
+
$project: {
|
|
262
|
+
_id: 0,
|
|
263
|
+
typeOf: '$typeOf',
|
|
264
|
+
productID: '$productID',
|
|
265
|
+
description: '$description',
|
|
266
|
+
name: '$name',
|
|
267
|
+
// provider: [ [Object] ],
|
|
268
|
+
additionalProperty: '$additionalProperty',
|
|
269
|
+
serviceType: '$serviceType',
|
|
270
|
+
id: { $toString: '$_id' },
|
|
271
|
+
// ↓セキュアな情報を隠蔽するように
|
|
272
|
+
provider: {
|
|
273
|
+
credentials: {
|
|
274
|
+
shopId: '$provider.credentials.shopId',
|
|
275
|
+
tokenizationCode: '$provider.credentials.tokenizationCode',
|
|
276
|
+
paymentUrl: {
|
|
277
|
+
expiresInSeconds: '$provider.credentials.paymentUrl.expiresInSeconds',
|
|
278
|
+
useCallback: '$provider.credentials.paymentUrl.useCallback',
|
|
279
|
+
useWebhook: '$provider.credentials.paymentUrl.useWebhook'
|
|
280
|
+
}
|
|
281
|
+
}
|
|
282
|
+
}
|
|
283
|
+
}
|
|
284
|
+
}
|
|
285
|
+
]);
|
|
286
|
+
if (typeof params.limit === 'number' && params.limit > 0) {
|
|
287
|
+
const page = (typeof params.page === 'number' && params.page > 0) ? params.page : 1;
|
|
288
|
+
aggregate.limit(params.limit * page)
|
|
289
|
+
.skip(params.limit * (page - 1));
|
|
290
|
+
}
|
|
291
|
+
return aggregate.option({ maxTimeMS: settings_1.MONGO_MAX_TIME_MS })
|
|
292
|
+
.exec();
|
|
293
|
+
});
|
|
294
|
+
}
|
|
295
|
+
/**
|
|
296
|
+
* 決済サービスのプロバイダー検索
|
|
297
|
+
*/
|
|
298
|
+
searchProviders(params) {
|
|
299
|
+
var _a, _b;
|
|
300
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
301
|
+
const matchStages = [];
|
|
302
|
+
const projectIdEq = (_b = (_a = params.project) === null || _a === void 0 ? void 0 : _a.id) === null || _b === void 0 ? void 0 : _b.$eq;
|
|
303
|
+
if (typeof projectIdEq === 'string') {
|
|
304
|
+
matchStages.push({ $match: { 'project.id': { $eq: projectIdEq } } });
|
|
305
|
+
}
|
|
306
|
+
matchStages.push({ $match: { _id: { $eq: new mongoose_1.Types.ObjectId(params.id) } } });
|
|
307
|
+
const aggregate = this.productModel.aggregate([
|
|
308
|
+
{
|
|
309
|
+
$unwind: {
|
|
310
|
+
path: '$provider'
|
|
311
|
+
}
|
|
312
|
+
},
|
|
313
|
+
...matchStages,
|
|
314
|
+
{
|
|
315
|
+
$project: {
|
|
316
|
+
_id: 0,
|
|
317
|
+
// ↓セキュアな情報を隠蔽するように
|
|
318
|
+
credentials: {
|
|
319
|
+
shopId: '$provider.credentials.shopId',
|
|
320
|
+
tokenizationCode: '$provider.credentials.tokenizationCode',
|
|
321
|
+
paymentUrl: {
|
|
322
|
+
expiresInSeconds: '$provider.credentials.paymentUrl.expiresInSeconds',
|
|
323
|
+
useCallback: '$provider.credentials.paymentUrl.useCallback',
|
|
324
|
+
useWebhook: '$provider.credentials.paymentUrl.useWebhook'
|
|
325
|
+
}
|
|
326
|
+
},
|
|
327
|
+
id: '$provider.id',
|
|
328
|
+
name: '$provider.name'
|
|
329
|
+
}
|
|
330
|
+
}
|
|
331
|
+
]);
|
|
332
|
+
if (typeof params.limit === 'number' && params.limit > 0) {
|
|
333
|
+
const page = (typeof params.page === 'number' && params.page > 0) ? params.page : 1;
|
|
334
|
+
aggregate.limit(params.limit * page)
|
|
335
|
+
.skip(params.limit * (page - 1));
|
|
336
|
+
}
|
|
337
|
+
return aggregate.option({ maxTimeMS: settings_1.MONGO_MAX_TIME_MS })
|
|
338
|
+
.exec();
|
|
339
|
+
});
|
|
340
|
+
}
|
|
228
341
|
/**
|
|
229
342
|
* プロダクトを保管する
|
|
230
343
|
* 作成 or 更新
|
|
@@ -43,7 +43,6 @@ export interface ISubReservation {
|
|
|
43
43
|
};
|
|
44
44
|
}
|
|
45
45
|
export interface IReservationPackage {
|
|
46
|
-
typeOf: factory.reservationType.ReservationPackage;
|
|
47
46
|
reservationNumber: string;
|
|
48
47
|
subReservation: ISubReservation[];
|
|
49
48
|
}
|
|
@@ -148,6 +147,9 @@ export declare class StockHolderRepository {
|
|
|
148
147
|
search(params: {
|
|
149
148
|
limit?: number;
|
|
150
149
|
page?: number;
|
|
150
|
+
sort?: {
|
|
151
|
+
'reservationFor.startDate': factory.sortType;
|
|
152
|
+
};
|
|
151
153
|
project?: {
|
|
152
154
|
id?: {
|
|
153
155
|
$eq?: string;
|
|
@@ -123,7 +123,7 @@ class StockHolderRepository {
|
|
|
123
123
|
const reservationCountLte = maximum - addedReservationCount;
|
|
124
124
|
const subReservations = lockKey.offers.map((offer) => StockHolderRepository.offer2subReservation(offer, lockKey.hasTicketedSeat));
|
|
125
125
|
const reservationPackage = {
|
|
126
|
-
typeOf: factory.reservationType.ReservationPackage,
|
|
126
|
+
// typeOf: factory.reservationType.ReservationPackage,
|
|
127
127
|
reservationNumber: lockKey.holder,
|
|
128
128
|
subReservation: subReservations
|
|
129
129
|
};
|
|
@@ -181,7 +181,7 @@ class StockHolderRepository {
|
|
|
181
181
|
const addedReservationCount = lockKey.offers.length;
|
|
182
182
|
const subReservations = lockKey.offers.map((offer) => StockHolderRepository.offer2subReservation(offer, lockKey.hasTicketedSeat));
|
|
183
183
|
const reservationPackage = {
|
|
184
|
-
typeOf: factory.reservationType.ReservationPackage,
|
|
184
|
+
// typeOf: factory.reservationType.ReservationPackage,
|
|
185
185
|
reservationNumber: lockKey.holder,
|
|
186
186
|
subReservation: subReservations
|
|
187
187
|
};
|
|
@@ -264,8 +264,14 @@ class StockHolderRepository {
|
|
|
264
264
|
const reservationNumber = params.holder;
|
|
265
265
|
const updateResult = yield this.holdReservationModel.findOneAndUpdate({
|
|
266
266
|
'reservationFor.id': { $eq: params.eventId },
|
|
267
|
-
'reservations.reservationNumber': {
|
|
268
|
-
|
|
267
|
+
'reservations.reservationNumber': {
|
|
268
|
+
$exists: true,
|
|
269
|
+
$eq: reservationNumber
|
|
270
|
+
},
|
|
271
|
+
'reservations.subReservation.identifier': {
|
|
272
|
+
$exists: true,
|
|
273
|
+
$eq: subReservation.identifier
|
|
274
|
+
}
|
|
269
275
|
}, {
|
|
270
276
|
$inc: { reservationCount: -1 },
|
|
271
277
|
$pull: { 'reservations.$[reservationPackage].subReservation': { identifier: { $eq: subReservation.identifier } } }
|
|
@@ -277,8 +283,23 @@ class StockHolderRepository {
|
|
|
277
283
|
})
|
|
278
284
|
.select({ _id: 1 })
|
|
279
285
|
.exec();
|
|
280
|
-
debug('unlock processed. updateResult:', updateResult, 'reservationNumber:', reservationNumber, 'identifier:', subReservation.identifier);
|
|
281
286
|
// docが存在しなくてもよい
|
|
287
|
+
debug('unlock processed. updateResult:', updateResult, 'reservationNumber:', reservationNumber, 'identifier:', subReservation.identifier);
|
|
288
|
+
// subReservationがemptyのreservationsをpull
|
|
289
|
+
const pullReservationPackageResult = yield this.holdReservationModel.findOneAndUpdate({
|
|
290
|
+
'reservationFor.id': { $eq: params.eventId },
|
|
291
|
+
'reservations.reservationNumber': { $exists: true, $eq: reservationNumber }
|
|
292
|
+
}, {
|
|
293
|
+
$pull: {
|
|
294
|
+
reservations: {
|
|
295
|
+
reservationNumber: { $eq: reservationNumber },
|
|
296
|
+
subReservation: { $size: 0 }
|
|
297
|
+
}
|
|
298
|
+
}
|
|
299
|
+
}, { new: true })
|
|
300
|
+
.select({ _id: 1 })
|
|
301
|
+
.exec();
|
|
302
|
+
debug('unlock processed. pullReservationPackageResult:', pullReservationPackageResult, 'reservationNumber:', reservationNumber, 'identifier:', subReservation.identifier);
|
|
282
303
|
}
|
|
283
304
|
else {
|
|
284
305
|
const field = StockHolderRepository.offer2field(params.offer, params.hasTicketedSeat);
|
|
@@ -359,7 +380,12 @@ class StockHolderRepository {
|
|
|
359
380
|
$match: { 'reservationFor.id': { $eq: params.eventId } }
|
|
360
381
|
},
|
|
361
382
|
{
|
|
362
|
-
$match: {
|
|
383
|
+
$match: {
|
|
384
|
+
'reservations.subReservation.identifier': {
|
|
385
|
+
$exists: true,
|
|
386
|
+
$eq: subReservation.identifier
|
|
387
|
+
}
|
|
388
|
+
}
|
|
363
389
|
}
|
|
364
390
|
];
|
|
365
391
|
const aggregate = this.holdReservationModel.aggregate([
|
|
@@ -436,7 +462,12 @@ class StockHolderRepository {
|
|
|
436
462
|
$match: { 'reservationFor.id': { $eq: params.eventId } }
|
|
437
463
|
},
|
|
438
464
|
{
|
|
439
|
-
$match: {
|
|
465
|
+
$match: {
|
|
466
|
+
'reservations.subReservation.identifier': {
|
|
467
|
+
$exists: true,
|
|
468
|
+
$in: subReservations.map((r) => r.identifier)
|
|
469
|
+
}
|
|
470
|
+
}
|
|
440
471
|
}
|
|
441
472
|
];
|
|
442
473
|
const aggregate = this.holdReservationModel.aggregate([
|
|
@@ -502,8 +533,9 @@ class StockHolderRepository {
|
|
|
502
533
|
/**
|
|
503
534
|
* 汎用的な検索(mongooseのみ対応)
|
|
504
535
|
*/
|
|
536
|
+
// tslint:disable-next-line:max-func-body-length
|
|
505
537
|
search(params) {
|
|
506
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
|
|
538
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
|
|
507
539
|
return __awaiter(this, void 0, void 0, function* () {
|
|
508
540
|
const matchStages = [];
|
|
509
541
|
const projectIdEq = (_b = (_a = params.project) === null || _a === void 0 ? void 0 : _a.id) === null || _b === void 0 ? void 0 : _b.$eq;
|
|
@@ -516,21 +548,16 @@ class StockHolderRepository {
|
|
|
516
548
|
}
|
|
517
549
|
const reservationNumberEq = (_e = params.reservationNumber) === null || _e === void 0 ? void 0 : _e.$eq;
|
|
518
550
|
if (typeof reservationNumberEq === 'string') {
|
|
519
|
-
matchStages.push({ $match: { 'reservations.reservationNumber': { $eq: reservationNumberEq } } });
|
|
551
|
+
matchStages.push({ $match: { 'reservations.reservationNumber': { $exists: true, $eq: reservationNumberEq } } });
|
|
520
552
|
}
|
|
521
553
|
const identifierEq = (_f = params.identifier) === null || _f === void 0 ? void 0 : _f.$eq;
|
|
522
554
|
if (typeof identifierEq === 'string') {
|
|
523
|
-
matchStages.push({ $match: { 'reservations.subReservation.identifier': { $eq: identifierEq } } });
|
|
555
|
+
matchStages.push({ $match: { 'reservations.subReservation.identifier': { $exists: true, $eq: identifierEq } } });
|
|
524
556
|
}
|
|
525
557
|
const idEq = (_g = params.id) === null || _g === void 0 ? void 0 : _g.$eq;
|
|
526
558
|
if (typeof idEq === 'string') {
|
|
527
559
|
matchStages.push({
|
|
528
|
-
$match: {
|
|
529
|
-
'reservations.subReservation.id': {
|
|
530
|
-
$exists: true,
|
|
531
|
-
$eq: idEq
|
|
532
|
-
}
|
|
533
|
-
}
|
|
560
|
+
$match: { 'reservations.subReservation.id': { $exists: true, $eq: idEq } }
|
|
534
561
|
});
|
|
535
562
|
}
|
|
536
563
|
const seatNumberEq = (_k = (_j = (_h = params.reservedTicket) === null || _h === void 0 ? void 0 : _h.ticketedSeat) === null || _j === void 0 ? void 0 : _j.seatNumber) === null || _k === void 0 ? void 0 : _k.$eq;
|
|
@@ -556,8 +583,21 @@ class StockHolderRepository {
|
|
|
556
583
|
});
|
|
557
584
|
}
|
|
558
585
|
const aggregate = this.holdReservationModel.aggregate([
|
|
559
|
-
|
|
560
|
-
|
|
586
|
+
...(typeof ((_p = params.sort) === null || _p === void 0 ? void 0 : _p['reservationFor.startDate']) === 'number')
|
|
587
|
+
? [{ $sort: { 'reservationFor.startDate': params.sort['reservationFor.startDate'] } }]
|
|
588
|
+
: [],
|
|
589
|
+
{
|
|
590
|
+
$unwind: {
|
|
591
|
+
path: '$reservations',
|
|
592
|
+
includeArrayIndex: 'reservationPackageIndex'
|
|
593
|
+
}
|
|
594
|
+
},
|
|
595
|
+
{
|
|
596
|
+
$unwind: {
|
|
597
|
+
path: '$reservations.subReservation',
|
|
598
|
+
includeArrayIndex: 'subReservationIndex'
|
|
599
|
+
}
|
|
600
|
+
},
|
|
561
601
|
...matchStages,
|
|
562
602
|
{
|
|
563
603
|
$project: {
|
|
@@ -573,7 +613,9 @@ class StockHolderRepository {
|
|
|
573
613
|
},
|
|
574
614
|
reservationNumber: '$reservations.reservationNumber',
|
|
575
615
|
reservedTicket: '$reservations.subReservation.reservedTicket',
|
|
576
|
-
objectSize: { $bsonSize: '$$ROOT' }
|
|
616
|
+
objectSize: { $bsonSize: '$$ROOT' },
|
|
617
|
+
reservationPackageIndex: '$reservationPackageIndex',
|
|
618
|
+
subReservationIndex: '$subReservationIndex'
|
|
577
619
|
}
|
|
578
620
|
}
|
|
579
621
|
]);
|
package/package.json
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
}
|
|
10
10
|
],
|
|
11
11
|
"dependencies": {
|
|
12
|
-
"@chevre/factory": "4.313.0-alpha.
|
|
12
|
+
"@chevre/factory": "4.313.0-alpha.40",
|
|
13
13
|
"@cinerino/sdk": "3.157.0-alpha.16",
|
|
14
14
|
"@motionpicture/coa-service": "9.2.0",
|
|
15
15
|
"@motionpicture/gmo-service": "5.2.0",
|
|
@@ -117,5 +117,5 @@
|
|
|
117
117
|
"postversion": "git push origin --tags",
|
|
118
118
|
"prepublishOnly": "npm run clean && npm run build && npm test && npm run doc"
|
|
119
119
|
},
|
|
120
|
-
"version": "21.2.0-alpha.
|
|
120
|
+
"version": "21.2.0-alpha.132"
|
|
121
121
|
}
|