@chevre/domain 22.1.0-alpha.5 → 22.1.0-alpha.7
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.
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
// tslint:disable:no-console
|
|
2
|
+
import * as mongoose from 'mongoose';
|
|
3
|
+
import { chevre } from '../../../../lib/index';
|
|
4
|
+
|
|
5
|
+
const project = { typeOf: chevre.factory.organizationType.Project, id: String(process.env.PROJECT_ID) };
|
|
6
|
+
|
|
7
|
+
async function main() {
|
|
8
|
+
await mongoose.connect(<string>process.env.MONGOLAB_URI, { autoIndex: false });
|
|
9
|
+
|
|
10
|
+
const seatRepo = await chevre.repository.place.Seat.createInstance(mongoose.connection);
|
|
11
|
+
|
|
12
|
+
const seatingTypes = await seatRepo.aggregateSeatingTypes({
|
|
13
|
+
project: { id: { $eq: project.id } },
|
|
14
|
+
branchCode: { $in: ['A-2', 'A-1'] },
|
|
15
|
+
containedInPlace: {
|
|
16
|
+
branchCode: { $in: ['Default'] },
|
|
17
|
+
containedInPlace: {
|
|
18
|
+
branchCode: { $eq: '100' },
|
|
19
|
+
containedInPlace: { branchCode: { $eq: '118' } }
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
});
|
|
23
|
+
console.log(seatingTypes);
|
|
24
|
+
console.log(seatingTypes.length);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
main()
|
|
28
|
+
.then(console.log)
|
|
29
|
+
.catch(console.error);
|
|
@@ -41,6 +41,40 @@ export declare class SeatRepo {
|
|
|
41
41
|
};
|
|
42
42
|
}, $unset: any): Promise<IUpdateSeatResult>;
|
|
43
43
|
searchSeats(params: factory.place.seat.ISearchConditions): Promise<factory.place.seat.IPlace[]>;
|
|
44
|
+
/**
|
|
45
|
+
* 座席区分集計検索
|
|
46
|
+
*/
|
|
47
|
+
aggregateSeatingTypes(params: {
|
|
48
|
+
project: {
|
|
49
|
+
id: {
|
|
50
|
+
$eq: string;
|
|
51
|
+
};
|
|
52
|
+
};
|
|
53
|
+
/**
|
|
54
|
+
* 座席コード
|
|
55
|
+
*/
|
|
56
|
+
branchCode?: {
|
|
57
|
+
$in?: string[];
|
|
58
|
+
};
|
|
59
|
+
containedInPlace?: {
|
|
60
|
+
/**
|
|
61
|
+
* セクションコード
|
|
62
|
+
*/
|
|
63
|
+
branchCode?: {
|
|
64
|
+
$in?: string[];
|
|
65
|
+
};
|
|
66
|
+
containedInPlace?: {
|
|
67
|
+
branchCode?: {
|
|
68
|
+
$eq?: string;
|
|
69
|
+
};
|
|
70
|
+
containedInPlace?: {
|
|
71
|
+
branchCode?: {
|
|
72
|
+
$eq?: string;
|
|
73
|
+
};
|
|
74
|
+
};
|
|
75
|
+
};
|
|
76
|
+
};
|
|
77
|
+
}): Promise<string[]>;
|
|
44
78
|
deleteSeat(seat: {
|
|
45
79
|
project: {
|
|
46
80
|
id: string;
|
|
@@ -340,6 +340,64 @@ class SeatRepo {
|
|
|
340
340
|
.exec();
|
|
341
341
|
});
|
|
342
342
|
}
|
|
343
|
+
/**
|
|
344
|
+
* 座席区分集計検索
|
|
345
|
+
*/
|
|
346
|
+
aggregateSeatingTypes(params) {
|
|
347
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
|
|
348
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
349
|
+
const matchStages = [{ $match: { typeOf: { $eq: factory.placeType.ScreeningRoom } } }];
|
|
350
|
+
const projectIdEq = (_b = (_a = params.project) === null || _a === void 0 ? void 0 : _a.id) === null || _b === void 0 ? void 0 : _b.$eq;
|
|
351
|
+
if (typeof projectIdEq === 'string') {
|
|
352
|
+
matchStages.push({ $match: { 'project.id': { $eq: projectIdEq } } });
|
|
353
|
+
}
|
|
354
|
+
const branchCodeEq = (_e = (_d = (_c = params.containedInPlace) === null || _c === void 0 ? void 0 : _c.containedInPlace) === null || _d === void 0 ? void 0 : _d.branchCode) === null || _e === void 0 ? void 0 : _e.$eq;
|
|
355
|
+
if (typeof branchCodeEq === 'string') {
|
|
356
|
+
matchStages.push({ $match: { branchCode: { $eq: branchCodeEq } } });
|
|
357
|
+
}
|
|
358
|
+
const containedInPlaceBranchCodeEq = (_j = (_h = (_g = (_f = params.containedInPlace) === null || _f === void 0 ? void 0 : _f.containedInPlace) === null || _g === void 0 ? void 0 : _g.containedInPlace) === null || _h === void 0 ? void 0 : _h.branchCode) === null || _j === void 0 ? void 0 : _j.$eq;
|
|
359
|
+
if (typeof containedInPlaceBranchCodeEq === 'string') {
|
|
360
|
+
matchStages.push({
|
|
361
|
+
$match: { 'containedInPlace.branchCode': { $exists: true, $eq: containedInPlaceBranchCodeEq } }
|
|
362
|
+
});
|
|
363
|
+
}
|
|
364
|
+
const seatBranchCodeIn = (_k = params.branchCode) === null || _k === void 0 ? void 0 : _k.$in;
|
|
365
|
+
if (Array.isArray(seatBranchCodeIn)) {
|
|
366
|
+
matchStages.push({
|
|
367
|
+
$match: { 'containsPlace.containsPlace.branchCode': { $exists: true, $in: seatBranchCodeIn } }
|
|
368
|
+
});
|
|
369
|
+
}
|
|
370
|
+
const sectionBranchCodeIn = (_m = (_l = params.containedInPlace) === null || _l === void 0 ? void 0 : _l.branchCode) === null || _m === void 0 ? void 0 : _m.$in;
|
|
371
|
+
if (Array.isArray(sectionBranchCodeIn)) {
|
|
372
|
+
matchStages.push({
|
|
373
|
+
$match: { 'containsPlace.branchCode': { $exists: true, $in: sectionBranchCodeIn } }
|
|
374
|
+
});
|
|
375
|
+
}
|
|
376
|
+
const aggregate = this.placeModel.aggregate([
|
|
377
|
+
{ $unwind: { path: '$containsPlace', preserveNullAndEmptyArrays: false } },
|
|
378
|
+
{ $unwind: { path: '$containsPlace.containsPlace', preserveNullAndEmptyArrays: false } },
|
|
379
|
+
{ $unwind: { path: '$containsPlace.containsPlace.seatingType', preserveNullAndEmptyArrays: false } },
|
|
380
|
+
...matchStages,
|
|
381
|
+
{
|
|
382
|
+
$group: {
|
|
383
|
+
_id: '$containsPlace.containsPlace.seatingType'
|
|
384
|
+
}
|
|
385
|
+
},
|
|
386
|
+
{
|
|
387
|
+
$group: {
|
|
388
|
+
// tslint:disable-next-line:no-null-keyword
|
|
389
|
+
_id: null,
|
|
390
|
+
seatingTypes: { $push: '$_id' }
|
|
391
|
+
}
|
|
392
|
+
}
|
|
393
|
+
]);
|
|
394
|
+
const result = (yield aggregate
|
|
395
|
+
.option({ maxTimeMS: settings_1.MONGO_MAX_TIME_MS })
|
|
396
|
+
.exec()).shift();
|
|
397
|
+
// .then((result) => result.map(({ _id }) => _id));
|
|
398
|
+
return (result !== undefined) ? result.seatingTypes : [];
|
|
399
|
+
});
|
|
400
|
+
}
|
|
343
401
|
deleteSeat(seat) {
|
|
344
402
|
var _a;
|
|
345
403
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -10,6 +10,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
exports.start = void 0;
|
|
13
|
+
const createDebug = require("debug");
|
|
13
14
|
const moment = require("moment");
|
|
14
15
|
const factory = require("../../../factory");
|
|
15
16
|
const pecorinoapi = require("../../../pecorinoapi");
|
|
@@ -20,6 +21,7 @@ const createSubReservations_1 = require("./start/createSubReservations");
|
|
|
20
21
|
const createPointAward_1 = require("./start/factory/createPointAward");
|
|
21
22
|
const createStartParams_1 = require("./start/factory/createStartParams");
|
|
22
23
|
const validateStartRequest_1 = require("./validateStartRequest");
|
|
24
|
+
const debug = createDebug('chevre-domain:service:assetTransaction');
|
|
23
25
|
const ONE_MONTH_IN_DAYS = 31;
|
|
24
26
|
/**
|
|
25
27
|
* 取引開始
|
|
@@ -198,18 +200,17 @@ function addReservations(params) {
|
|
|
198
200
|
transaction: {
|
|
199
201
|
id: params.transaction.id,
|
|
200
202
|
transactionNumber: params.transaction.transactionNumber
|
|
201
|
-
// object: { useHoldStockByTransactionNumber: transaction.object.useHoldStockByTransactionNumber === true }
|
|
202
203
|
},
|
|
203
204
|
stockHoldUntilDaysAfterEventEnd: params.stockHoldUntilDaysAfterEventEnd
|
|
204
205
|
})(repos);
|
|
205
206
|
// ストックホルダー処理(stockHolderで残席数を集計しているので必要)
|
|
206
207
|
yield onReservationsCreated({ event, transaction: { transactionNumber: reservationNumber } })(repos);
|
|
207
|
-
// return { objectSubReservations };
|
|
208
208
|
});
|
|
209
209
|
}
|
|
210
210
|
/**
|
|
211
211
|
* イベントに対する座席オファーを座席コードとセクションコード指定で検索する
|
|
212
212
|
*/
|
|
213
|
+
// tslint:disable-next-line:max-func-body-length
|
|
213
214
|
function searchEventSeatOffers(params) {
|
|
214
215
|
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
215
216
|
var _a, _b, _c, _d, _e, _f;
|
|
@@ -218,14 +219,6 @@ function searchEventSeatOffers(params) {
|
|
|
218
219
|
const eventOffers = params.event.offers;
|
|
219
220
|
const reservedSeatsAvailable = ((_b = (_a = eventOffers === null || eventOffers === void 0 ? void 0 : eventOffers.itemOffered.serviceOutput) === null || _a === void 0 ? void 0 : _a.reservedTicket) === null || _b === void 0 ? void 0 : _b.ticketedSeat) !== undefined;
|
|
220
221
|
if (reservedSeatsAvailable) {
|
|
221
|
-
// 座席タイプ価格仕様を検索
|
|
222
|
-
const priceSpecs = yield repos.priceSpecification.search({
|
|
223
|
-
project: { id: { $eq: params.event.project.id } },
|
|
224
|
-
typeOf: factory.priceSpecificationType.CategoryCodeChargeSpecification,
|
|
225
|
-
appliesToCategoryCode: {
|
|
226
|
-
inCodeSet: { identifier: { $eq: factory.categoryCode.CategorySetIdentifier.SeatingType } }
|
|
227
|
-
}
|
|
228
|
-
});
|
|
229
222
|
const roomBranchCode = String((_d = (_c = eventOffers.itemOffered) === null || _c === void 0 ? void 0 : _c.availableChannel) === null || _d === void 0 ? void 0 : _d.serviceLocation.branchCode);
|
|
230
223
|
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);
|
|
231
224
|
const seats = yield repos.seat.searchSeats({
|
|
@@ -259,6 +252,33 @@ function searchEventSeatOffers(params) {
|
|
|
259
252
|
};
|
|
260
253
|
})
|
|
261
254
|
});
|
|
255
|
+
// ルームに含まれる座席区分のみ加算料金を検索(2024-08-06~)
|
|
256
|
+
const uniqueSeatingTypes = yield repos.seat.aggregateSeatingTypes({
|
|
257
|
+
project: { id: { $eq: params.event.project.id } },
|
|
258
|
+
branchCode: { $in: params.branchCode.$in },
|
|
259
|
+
containedInPlace: {
|
|
260
|
+
branchCode: {
|
|
261
|
+
$in: params.containedInPlace.branchCode.$in
|
|
262
|
+
},
|
|
263
|
+
containedInPlace: {
|
|
264
|
+
branchCode: { $eq: roomBranchCode },
|
|
265
|
+
containedInPlace: { branchCode: { $eq: movieTheaterBranchCode } }
|
|
266
|
+
}
|
|
267
|
+
}
|
|
268
|
+
});
|
|
269
|
+
debug('searchEventSeatOffers: uniqueSeatingTypes:', uniqueSeatingTypes, params.event.project.id, params.branchCode.$in, params.containedInPlace.branchCode.$in, roomBranchCode, movieTheaterBranchCode);
|
|
270
|
+
// 座席タイプ価格仕様を検索
|
|
271
|
+
let priceSpecs = [];
|
|
272
|
+
if (Array.isArray(uniqueSeatingTypes) && uniqueSeatingTypes.length > 0) {
|
|
273
|
+
priceSpecs = yield repos.priceSpecification.search({
|
|
274
|
+
project: { id: { $eq: params.event.project.id } },
|
|
275
|
+
typeOf: factory.priceSpecificationType.CategoryCodeChargeSpecification,
|
|
276
|
+
appliesToCategoryCode: {
|
|
277
|
+
inCodeSet: { identifier: { $eq: factory.categoryCode.CategorySetIdentifier.SeatingType } },
|
|
278
|
+
codeValue: { $in: uniqueSeatingTypes } // ルームに含まれる座席区分のみ加算料金を検索(2024-08-06~)
|
|
279
|
+
}
|
|
280
|
+
});
|
|
281
|
+
}
|
|
262
282
|
offers = seats.map((seat, index) => {
|
|
263
283
|
return OfferService.addOffers2Seat({
|
|
264
284
|
seat,
|
|
@@ -10,6 +10,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
exports.searchEventSeatOffersWithPaging = exports.addOffers2Seat = exports.product = exports.moneyTransfer = exports.eventServiceByCOA = exports.event = void 0;
|
|
13
|
+
const createDebug = require("debug");
|
|
13
14
|
const moment = require("moment");
|
|
14
15
|
const factory = require("../factory");
|
|
15
16
|
const EventOfferService = require("./offer/event");
|
|
@@ -20,6 +21,7 @@ const MoneyTransferOfferService = require("./offer/moneyTransfer");
|
|
|
20
21
|
exports.moneyTransfer = MoneyTransferOfferService;
|
|
21
22
|
const ProductOfferService = require("./offer/product");
|
|
22
23
|
exports.product = ProductOfferService;
|
|
24
|
+
const debug = createDebug('chevre-domain:service:offer');
|
|
23
25
|
/**
|
|
24
26
|
* 座席にオファー情報を付加する
|
|
25
27
|
*/
|
|
@@ -58,6 +60,7 @@ exports.addOffers2Seat = addOffers2Seat;
|
|
|
58
60
|
*/
|
|
59
61
|
// tslint:disable-next-line:max-func-body-length
|
|
60
62
|
function searchEventSeatOffersWithPaging(params) {
|
|
63
|
+
// tslint:disable-next-line:max-func-body-length
|
|
61
64
|
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
62
65
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
63
66
|
let offers = [];
|
|
@@ -97,28 +100,29 @@ function searchEventSeatOffersWithPaging(params) {
|
|
|
97
100
|
};
|
|
98
101
|
})
|
|
99
102
|
});
|
|
100
|
-
//
|
|
101
|
-
|
|
102
|
-
// const uniqueSeatingTypes: string[] = [...new Set(seats.reduce<string[]>(
|
|
103
|
-
// (a, { seatingType }) => {
|
|
104
|
-
// if (Array.isArray(seatingType)) {
|
|
105
|
-
// return [...a, ...seatingType];
|
|
106
|
-
// } else if (typeof seatingType === 'string') {
|
|
107
|
-
// return [...a, seatingType];
|
|
108
|
-
// } else {
|
|
109
|
-
// return a;
|
|
110
|
-
// }
|
|
111
|
-
// },
|
|
112
|
-
// []
|
|
113
|
-
// ))];
|
|
114
|
-
// 座席タイプ価格仕様を検索
|
|
115
|
-
const priceSpecs = yield repos.priceSpecification.search({
|
|
103
|
+
// ルームに含まれる座席区分のみ加算料金を検索(2024-08-05~)
|
|
104
|
+
const uniqueSeatingTypes = yield repos.seat.aggregateSeatingTypes({
|
|
116
105
|
project: { id: { $eq: event.project.id } },
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
106
|
+
containedInPlace: {
|
|
107
|
+
containedInPlace: {
|
|
108
|
+
branchCode: { $eq: roomBranchCode },
|
|
109
|
+
containedInPlace: { branchCode: { $eq: movieTheaterBranchCode } }
|
|
110
|
+
}
|
|
120
111
|
}
|
|
121
112
|
});
|
|
113
|
+
debug('searchEventSeatOffersWithPaging: uniqueSeatingTypes:', uniqueSeatingTypes, event.project.id, roomBranchCode, movieTheaterBranchCode);
|
|
114
|
+
// 座席タイプ価格仕様を検索
|
|
115
|
+
let priceSpecs = [];
|
|
116
|
+
if (Array.isArray(uniqueSeatingTypes) && uniqueSeatingTypes.length > 0) {
|
|
117
|
+
priceSpecs = yield repos.priceSpecification.search({
|
|
118
|
+
project: { id: { $eq: event.project.id } },
|
|
119
|
+
typeOf: factory.priceSpecificationType.CategoryCodeChargeSpecification,
|
|
120
|
+
appliesToCategoryCode: {
|
|
121
|
+
inCodeSet: { identifier: { $eq: factory.categoryCode.CategorySetIdentifier.SeatingType } },
|
|
122
|
+
codeValue: { $in: uniqueSeatingTypes } // ルームに含まれる座席区分のみ加算料金を検索(2024-08-05~)
|
|
123
|
+
}
|
|
124
|
+
});
|
|
125
|
+
}
|
|
122
126
|
offers = seats.map((seat, index) => {
|
|
123
127
|
return addOffers2Seat({
|
|
124
128
|
seat,
|
package/package.json
CHANGED