@chevre/domain 20.2.0-alpha.1 → 20.2.0-alpha.10
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/CHANGELOG.md +2030 -0
- package/example/.gitignore +1 -0
- package/example/src/chevre/.gitignore +1 -0
- package/example/src/chevre/migrateEventOffersItemOfferedAvailableChannel.ts +89 -0
- package/example/src/chevre/{migrateEventProjectAttributes.ts → migrateEventOffersItemOfferedTypeOf.ts} +26 -8
- package/lib/chevre/repo/place.js +30 -42
- package/lib/chevre/repo/reservation.js +45 -19
- package/lib/chevre/service/aggregation/event/aggregateScreeningEvent.d.ts +1 -1
- package/lib/chevre/service/aggregation/event/aggregateScreeningEvent.js +22 -7
- package/lib/chevre/service/assetTransaction/pay/potentialActions.js +2 -1
- package/lib/chevre/service/assetTransaction/reserve/factory.js +7 -2
- package/lib/chevre/service/delivery/factory.js +1 -0
- package/lib/chevre/service/offer/event/factory.js +25 -5
- package/lib/chevre/service/offer/event/searchEventTicketOffers.js +120 -4
- package/lib/chevre/service/offer/eventServiceByCOA/factory.js +19 -1
- package/lib/chevre/service/offer.js +28 -20
- package/lib/chevre/service/order/onOrderStatusChanged/factory.js +2 -1
- package/lib/chevre/service/order/onOrderStatusChanged.js +2 -1
- package/lib/chevre/service/order/placeOrder.js +16 -0
- package/lib/chevre/service/reserve/useReservation.js +2 -1
- package/lib/chevre/service/transaction/placeOrderInProgress/result/acceptedOffers.js +42 -27
- package/package.json +3 -3
- package/example/src/chevre/migrateEventOffersSellerMakesOffer.ts +0 -139
|
@@ -0,0 +1 @@
|
|
|
1
|
+
dst
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
*.csv
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
// tslint:disable:no-console
|
|
2
|
+
import * as moment from 'moment';
|
|
3
|
+
import * as mongoose from 'mongoose';
|
|
4
|
+
|
|
5
|
+
import { chevre } from '../../../lib/index';
|
|
6
|
+
|
|
7
|
+
// const project = { id: String(process.env.PROJECT_ID) };
|
|
8
|
+
|
|
9
|
+
const EXCLUDED_PROJECT_ID = process.env.EXCLUDED_PROJECT_ID;
|
|
10
|
+
|
|
11
|
+
// tslint:disable-next-line:max-func-body-length
|
|
12
|
+
async function main() {
|
|
13
|
+
await mongoose.connect(<string>process.env.MONGOLAB_URI);
|
|
14
|
+
|
|
15
|
+
const eventRepo = new chevre.repository.Event(mongoose.connection);
|
|
16
|
+
|
|
17
|
+
const cursor = eventRepo.getCursor(
|
|
18
|
+
{
|
|
19
|
+
// 'project.id': { $eq: project.id },
|
|
20
|
+
'project.id': { $ne: EXCLUDED_PROJECT_ID },
|
|
21
|
+
typeOf: { $eq: chevre.factory.eventType.ScreeningEvent },
|
|
22
|
+
startDate: {
|
|
23
|
+
$gte: moment()
|
|
24
|
+
.add(-1, 'month')
|
|
25
|
+
.toDate()
|
|
26
|
+
}
|
|
27
|
+
// _id: { $eq: 'al6aff83w' }
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
// _id: 1,
|
|
31
|
+
}
|
|
32
|
+
);
|
|
33
|
+
console.log('events found');
|
|
34
|
+
|
|
35
|
+
let i = 0;
|
|
36
|
+
let updateCount = 0;
|
|
37
|
+
await cursor.eachAsync(async (doc) => {
|
|
38
|
+
i += 1;
|
|
39
|
+
const event: chevre.factory.event.screeningEvent.IEvent = doc.toObject();
|
|
40
|
+
|
|
41
|
+
const eventOffers = <chevre.factory.event.screeningEvent.IOffer | undefined>event.offers;
|
|
42
|
+
if (eventOffers === undefined) {
|
|
43
|
+
throw new Error('event.offers undefined');
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
const availableChannel = eventOffers.itemOffered.availableChannel;
|
|
47
|
+
|
|
48
|
+
const alreadyMigrated = availableChannel?.typeOf === 'ServiceChannel';
|
|
49
|
+
|
|
50
|
+
if (alreadyMigrated) {
|
|
51
|
+
console.log(
|
|
52
|
+
'already exist...', event.project.id, event.id, event.startDate, availableChannel.serviceLocation.branchCode, i);
|
|
53
|
+
} else {
|
|
54
|
+
const newAvailableChannel: chevre.factory.reservation.IServiceChannel = {
|
|
55
|
+
typeOf: 'ServiceChannel',
|
|
56
|
+
serviceLocation: {
|
|
57
|
+
typeOf: event.location.typeOf,
|
|
58
|
+
branchCode: event.location.branchCode,
|
|
59
|
+
name: event.location.name,
|
|
60
|
+
containedInPlace: {
|
|
61
|
+
typeOf: event.superEvent.location.typeOf,
|
|
62
|
+
id: event.superEvent.location.id,
|
|
63
|
+
branchCode: event.superEvent.location.branchCode,
|
|
64
|
+
name: event.superEvent.location.name
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
};
|
|
68
|
+
console.log(
|
|
69
|
+
'updating seller...', event.project.id, event.id, event.startDate, newAvailableChannel.serviceLocation.branchCode, i);
|
|
70
|
+
await eventRepo.updatePartiallyById({
|
|
71
|
+
id: event.id,
|
|
72
|
+
attributes: <any>{
|
|
73
|
+
typeOf: event.typeOf,
|
|
74
|
+
'offers.itemOffered.availableChannel': newAvailableChannel
|
|
75
|
+
}
|
|
76
|
+
});
|
|
77
|
+
updateCount += 1;
|
|
78
|
+
console.log(
|
|
79
|
+
'updated...', event.project.id, event.id, event.startDate, i);
|
|
80
|
+
}
|
|
81
|
+
});
|
|
82
|
+
|
|
83
|
+
console.log(i, 'events checked');
|
|
84
|
+
console.log(updateCount, 'events updated');
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
main()
|
|
88
|
+
.then()
|
|
89
|
+
.catch(console.error);
|
|
@@ -18,7 +18,6 @@ async function main() {
|
|
|
18
18
|
// 'project.id': { $eq: project.id },
|
|
19
19
|
'project.id': { $ne: EXCLUDED_PROJECT_ID },
|
|
20
20
|
typeOf: { $eq: chevre.factory.eventType.ScreeningEvent },
|
|
21
|
-
// typeOf: { $eq: chevre.factory.eventType.ScreeningEventSeries },
|
|
22
21
|
startDate: {
|
|
23
22
|
$gte: moment()
|
|
24
23
|
.add(-1, 'month')
|
|
@@ -36,18 +35,37 @@ async function main() {
|
|
|
36
35
|
let updateCount = 0;
|
|
37
36
|
await cursor.eachAsync(async (doc) => {
|
|
38
37
|
i += 1;
|
|
39
|
-
const event: chevre.factory.event.
|
|
38
|
+
const event: chevre.factory.event.screeningEvent.IEvent = doc.toObject();
|
|
40
39
|
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
40
|
+
// IAMメンバー検索
|
|
41
|
+
const eventOffers = <chevre.factory.event.screeningEvent.IOffer | undefined>event.offers;
|
|
42
|
+
if (eventOffers === undefined) {
|
|
43
|
+
throw new Error('event.offers undefined');
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
const itemOfferedTypeOf = eventOffers.itemOffered.typeOf;
|
|
47
|
+
|
|
48
|
+
const alreadyMigrated = itemOfferedTypeOf === chevre.factory.product.ProductType.EventService;
|
|
49
|
+
|
|
50
|
+
if (alreadyMigrated) {
|
|
51
|
+
console.log(
|
|
52
|
+
'already exist...', event.project.id, event.id, event.startDate, itemOfferedTypeOf, i);
|
|
44
53
|
} else {
|
|
54
|
+
console.log(
|
|
55
|
+
'updating seller...', event.project.id, event.id, event.startDate, i);
|
|
56
|
+
await eventRepo.updatePartiallyById({
|
|
57
|
+
id: event.id,
|
|
58
|
+
attributes: <any>{
|
|
59
|
+
typeOf: event.typeOf,
|
|
60
|
+
'offers.itemOffered.typeOf': chevre.factory.product.ProductType.EventService
|
|
61
|
+
}
|
|
62
|
+
});
|
|
45
63
|
updateCount += 1;
|
|
46
|
-
console.log(
|
|
47
|
-
|
|
48
|
-
console.log('project deleted', event.id, event.startDate, event.project.id, i);
|
|
64
|
+
console.log(
|
|
65
|
+
'updated...', event.project.id, event.id, event.startDate, i);
|
|
49
66
|
}
|
|
50
67
|
});
|
|
68
|
+
|
|
51
69
|
console.log(i, 'events checked');
|
|
52
70
|
console.log(updateCount, 'events updated');
|
|
53
71
|
}
|
package/lib/chevre/repo/place.js
CHANGED
|
@@ -38,9 +38,7 @@ class MongoRepository {
|
|
|
38
38
|
const andConditions = [{ typeOf: { $eq: factory.placeType.MovieTheater } }];
|
|
39
39
|
const projectIdEq = (_b = (_a = params.project) === null || _a === void 0 ? void 0 : _a.id) === null || _b === void 0 ? void 0 : _b.$eq;
|
|
40
40
|
if (typeof projectIdEq === 'string') {
|
|
41
|
-
andConditions.push({
|
|
42
|
-
'project.id': { $eq: projectIdEq }
|
|
43
|
-
});
|
|
41
|
+
andConditions.push({ 'project.id': { $eq: projectIdEq } });
|
|
44
42
|
}
|
|
45
43
|
const branchCodeEq = (_c = params.branchCode) === null || _c === void 0 ? void 0 : _c.$eq;
|
|
46
44
|
if (typeof branchCodeEq === 'string') {
|
|
@@ -435,22 +433,17 @@ class MongoRepository {
|
|
|
435
433
|
}
|
|
436
434
|
// tslint:disable-next-line:max-func-body-length
|
|
437
435
|
searchScreeningRoomSections(searchConditions) {
|
|
438
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
436
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
|
|
439
437
|
return __awaiter(this, void 0, void 0, function* () {
|
|
440
|
-
const matchStages = [];
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
'project.id': { $eq: searchConditions.project.id.$eq }
|
|
447
|
-
}
|
|
448
|
-
});
|
|
449
|
-
}
|
|
450
|
-
}
|
|
438
|
+
const matchStages = [{ $match: { typeOf: { $eq: factory.placeType.MovieTheater } } }];
|
|
439
|
+
const projectIdEq = (_b = (_a = searchConditions.project) === null || _a === void 0 ? void 0 : _a.id) === null || _b === void 0 ? void 0 : _b.$eq;
|
|
440
|
+
if (typeof projectIdEq === 'string') {
|
|
441
|
+
matchStages.push({
|
|
442
|
+
$match: { 'project.id': { $eq: projectIdEq } }
|
|
443
|
+
});
|
|
451
444
|
}
|
|
452
445
|
// 施設コード
|
|
453
|
-
const movieTheaterBranchCodeEq = (
|
|
446
|
+
const movieTheaterBranchCodeEq = (_e = (_d = (_c = searchConditions.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;
|
|
454
447
|
if (typeof movieTheaterBranchCodeEq === 'string') {
|
|
455
448
|
matchStages.push({
|
|
456
449
|
$match: {
|
|
@@ -462,7 +455,7 @@ class MongoRepository {
|
|
|
462
455
|
});
|
|
463
456
|
}
|
|
464
457
|
// スクリーンコード
|
|
465
|
-
const containedInPlaceBranchCodeEq = (
|
|
458
|
+
const containedInPlaceBranchCodeEq = (_g = (_f = searchConditions.containedInPlace) === null || _f === void 0 ? void 0 : _f.branchCode) === null || _g === void 0 ? void 0 : _g.$eq;
|
|
466
459
|
if (typeof containedInPlaceBranchCodeEq === 'string') {
|
|
467
460
|
matchStages.push({
|
|
468
461
|
$match: {
|
|
@@ -474,7 +467,7 @@ class MongoRepository {
|
|
|
474
467
|
});
|
|
475
468
|
}
|
|
476
469
|
// セクションコード
|
|
477
|
-
const sectionBranchCodeEq = (
|
|
470
|
+
const sectionBranchCodeEq = (_h = searchConditions === null || searchConditions === void 0 ? void 0 : searchConditions.branchCode) === null || _h === void 0 ? void 0 : _h.$eq;
|
|
478
471
|
if (typeof sectionBranchCodeEq === 'string') {
|
|
479
472
|
matchStages.push({
|
|
480
473
|
$match: {
|
|
@@ -485,7 +478,7 @@ class MongoRepository {
|
|
|
485
478
|
}
|
|
486
479
|
});
|
|
487
480
|
}
|
|
488
|
-
const nameCodeRegex = (
|
|
481
|
+
const nameCodeRegex = (_j = searchConditions.name) === null || _j === void 0 ? void 0 : _j.$regex;
|
|
489
482
|
if (typeof nameCodeRegex === 'string') {
|
|
490
483
|
matchStages.push({
|
|
491
484
|
$match: {
|
|
@@ -506,7 +499,7 @@ class MongoRepository {
|
|
|
506
499
|
}
|
|
507
500
|
});
|
|
508
501
|
}
|
|
509
|
-
const branchCodeRegex = (
|
|
502
|
+
const branchCodeRegex = (_k = searchConditions.branchCode) === null || _k === void 0 ? void 0 : _k.$regex;
|
|
510
503
|
if (typeof branchCodeRegex === 'string') {
|
|
511
504
|
matchStages.push({
|
|
512
505
|
$match: {
|
|
@@ -517,7 +510,7 @@ class MongoRepository {
|
|
|
517
510
|
}
|
|
518
511
|
});
|
|
519
512
|
}
|
|
520
|
-
const additionalPropertyElemMatch = (
|
|
513
|
+
const additionalPropertyElemMatch = (_l = searchConditions.additionalProperty) === null || _l === void 0 ? void 0 : _l.$elemMatch;
|
|
521
514
|
if (additionalPropertyElemMatch !== undefined && additionalPropertyElemMatch !== null) {
|
|
522
515
|
matchStages.push({
|
|
523
516
|
$match: {
|
|
@@ -543,7 +536,7 @@ class MongoRepository {
|
|
|
543
536
|
branchCode: '$branchCode',
|
|
544
537
|
name: '$name'
|
|
545
538
|
}
|
|
546
|
-
}, additionalProperty: '$containsPlace.containsPlace.additionalProperty' }, (((
|
|
539
|
+
}, additionalProperty: '$containsPlace.containsPlace.additionalProperty' }, (((_m = searchConditions.$projection) === null || _m === void 0 ? void 0 : _m.seatCount) === 1)
|
|
547
540
|
? {
|
|
548
541
|
seatCount: {
|
|
549
542
|
$cond: {
|
|
@@ -595,7 +588,7 @@ class MongoRepository {
|
|
|
595
588
|
searchScreeningRooms(searchConditions) {
|
|
596
589
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
597
590
|
return __awaiter(this, void 0, void 0, function* () {
|
|
598
|
-
const matchStages = [];
|
|
591
|
+
const matchStages = [{ $match: { typeOf: { $eq: factory.placeType.MovieTheater } } }];
|
|
599
592
|
const projectIdEq = (_b = (_a = searchConditions.project) === null || _a === void 0 ? void 0 : _a.id) === null || _b === void 0 ? void 0 : _b.$eq;
|
|
600
593
|
if (typeof projectIdEq === 'string') {
|
|
601
594
|
matchStages.push({
|
|
@@ -855,21 +848,16 @@ class MongoRepository {
|
|
|
855
848
|
}
|
|
856
849
|
// tslint:disable-next-line:cyclomatic-complexity max-func-body-length
|
|
857
850
|
searchSeats(params) {
|
|
858
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
851
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
|
|
859
852
|
return __awaiter(this, void 0, void 0, function* () {
|
|
860
|
-
const matchStages = [];
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
'project.id': { $eq: params.project.id.$eq }
|
|
867
|
-
}
|
|
868
|
-
});
|
|
869
|
-
}
|
|
870
|
-
}
|
|
853
|
+
const matchStages = [{ $match: { typeOf: { $eq: factory.placeType.MovieTheater } } }];
|
|
854
|
+
const projectIdEq = (_b = (_a = params.project) === null || _a === void 0 ? void 0 : _a.id) === null || _b === void 0 ? void 0 : _b.$eq;
|
|
855
|
+
if (typeof projectIdEq === 'string') {
|
|
856
|
+
matchStages.push({
|
|
857
|
+
$match: { 'project.id': { $eq: projectIdEq } }
|
|
858
|
+
});
|
|
871
859
|
}
|
|
872
|
-
const containedInPlaceBranchCodeEq = (
|
|
860
|
+
const containedInPlaceBranchCodeEq = (_d = (_c = params.containedInPlace) === null || _c === void 0 ? void 0 : _c.branchCode) === null || _d === void 0 ? void 0 : _d.$eq;
|
|
873
861
|
if (typeof containedInPlaceBranchCodeEq === 'string') {
|
|
874
862
|
matchStages.push({
|
|
875
863
|
$match: {
|
|
@@ -880,7 +868,7 @@ class MongoRepository {
|
|
|
880
868
|
}
|
|
881
869
|
});
|
|
882
870
|
}
|
|
883
|
-
const containedInPlaceBranchCodeIn = (
|
|
871
|
+
const containedInPlaceBranchCodeIn = (_f = (_e = params.containedInPlace) === null || _e === void 0 ? void 0 : _e.branchCode) === null || _f === void 0 ? void 0 : _f.$in;
|
|
884
872
|
if (Array.isArray(containedInPlaceBranchCodeIn)) {
|
|
885
873
|
matchStages.push({
|
|
886
874
|
$match: {
|
|
@@ -934,7 +922,7 @@ class MongoRepository {
|
|
|
934
922
|
});
|
|
935
923
|
}
|
|
936
924
|
}
|
|
937
|
-
const branchCodeIn = (
|
|
925
|
+
const branchCodeIn = (_g = params.branchCode) === null || _g === void 0 ? void 0 : _g.$in;
|
|
938
926
|
if (Array.isArray(branchCodeIn)) {
|
|
939
927
|
matchStages.push({
|
|
940
928
|
$match: {
|
|
@@ -945,7 +933,7 @@ class MongoRepository {
|
|
|
945
933
|
}
|
|
946
934
|
});
|
|
947
935
|
}
|
|
948
|
-
const branchCodeRegex = (
|
|
936
|
+
const branchCodeRegex = (_h = params.branchCode) === null || _h === void 0 ? void 0 : _h.$regex;
|
|
949
937
|
if (typeof branchCodeRegex === 'string' && branchCodeRegex.length > 0) {
|
|
950
938
|
matchStages.push({
|
|
951
939
|
$match: {
|
|
@@ -956,7 +944,7 @@ class MongoRepository {
|
|
|
956
944
|
}
|
|
957
945
|
});
|
|
958
946
|
}
|
|
959
|
-
const nameRegex = (
|
|
947
|
+
const nameRegex = (_j = params.name) === null || _j === void 0 ? void 0 : _j.$regex;
|
|
960
948
|
if (typeof nameRegex === 'string' && nameRegex.length > 0) {
|
|
961
949
|
matchStages.push({
|
|
962
950
|
$match: {
|
|
@@ -977,7 +965,7 @@ class MongoRepository {
|
|
|
977
965
|
}
|
|
978
966
|
});
|
|
979
967
|
}
|
|
980
|
-
const seatingTypeEq = (
|
|
968
|
+
const seatingTypeEq = (_k = params.seatingType) === null || _k === void 0 ? void 0 : _k.$eq;
|
|
981
969
|
if (typeof seatingTypeEq === 'string') {
|
|
982
970
|
matchStages.push({
|
|
983
971
|
$match: {
|
|
@@ -993,7 +981,7 @@ class MongoRepository {
|
|
|
993
981
|
&& params.$projection['containedInPlace.containedInPlace'] === 0) {
|
|
994
982
|
includeScreeningRooms = false;
|
|
995
983
|
}
|
|
996
|
-
const additionalPropertyElemMatch = (
|
|
984
|
+
const additionalPropertyElemMatch = (_l = params.additionalProperty) === null || _l === void 0 ? void 0 : _l.$elemMatch;
|
|
997
985
|
if (additionalPropertyElemMatch !== undefined && additionalPropertyElemMatch !== null) {
|
|
998
986
|
matchStages.push({
|
|
999
987
|
$match: {
|
|
@@ -21,7 +21,7 @@ class MongoRepository {
|
|
|
21
21
|
}
|
|
22
22
|
// tslint:disable-next-line:cyclomatic-complexity max-func-body-length
|
|
23
23
|
static CREATE_MONGO_CONDITIONS(params) {
|
|
24
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11;
|
|
24
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14;
|
|
25
25
|
// MongoDB検索条件
|
|
26
26
|
const andConditions = [
|
|
27
27
|
{ typeOf: params.typeOf }
|
|
@@ -233,7 +233,33 @@ class MongoRepository {
|
|
|
233
233
|
}
|
|
234
234
|
switch (params.typeOf) {
|
|
235
235
|
case factory.reservationType.BusReservation:
|
|
236
|
-
|
|
236
|
+
const reservationForTypeOfEq = (_h = params.reservationFor) === null || _h === void 0 ? void 0 : _h.typeOf;
|
|
237
|
+
if (typeof reservationForTypeOfEq === 'string') {
|
|
238
|
+
andConditions.push({
|
|
239
|
+
'reservationFor.typeOf': {
|
|
240
|
+
$exists: true,
|
|
241
|
+
$eq: reservationForTypeOfEq
|
|
242
|
+
}
|
|
243
|
+
});
|
|
244
|
+
}
|
|
245
|
+
const reservationForIdEq = (_j = params.reservationFor) === null || _j === void 0 ? void 0 : _j.id;
|
|
246
|
+
if (typeof reservationForIdEq === 'string') {
|
|
247
|
+
andConditions.push({
|
|
248
|
+
'reservationFor.id': {
|
|
249
|
+
$exists: true,
|
|
250
|
+
$eq: reservationForIdEq
|
|
251
|
+
}
|
|
252
|
+
});
|
|
253
|
+
}
|
|
254
|
+
const reservationForIdIn = (_k = params.reservationFor) === null || _k === void 0 ? void 0 : _k.ids;
|
|
255
|
+
if (Array.isArray(reservationForIdIn)) {
|
|
256
|
+
andConditions.push({
|
|
257
|
+
'reservationFor.id': {
|
|
258
|
+
$exists: true,
|
|
259
|
+
$in: reservationForIdIn
|
|
260
|
+
}
|
|
261
|
+
});
|
|
262
|
+
}
|
|
237
263
|
break;
|
|
238
264
|
case factory.reservationType.EventReservation:
|
|
239
265
|
// tslint:disable-next-line:no-single-line-block-comment
|
|
@@ -490,7 +516,7 @@ class MongoRepository {
|
|
|
490
516
|
}
|
|
491
517
|
// tslint:disable-next-line:no-single-line-block-comment
|
|
492
518
|
/* istanbul ignore else */
|
|
493
|
-
const ticketedSeatSeatingTypeIn = (
|
|
519
|
+
const ticketedSeatSeatingTypeIn = (_m = (_l = params.reservedTicket.ticketedSeat) === null || _l === void 0 ? void 0 : _l.seatingType) === null || _m === void 0 ? void 0 : _m.$in;
|
|
494
520
|
if (Array.isArray(ticketedSeatSeatingTypeIn)) {
|
|
495
521
|
andConditions.push({
|
|
496
522
|
'reservedTicket.ticketedSeat.seatingType': {
|
|
@@ -501,7 +527,7 @@ class MongoRepository {
|
|
|
501
527
|
}
|
|
502
528
|
}
|
|
503
529
|
}
|
|
504
|
-
const brokerIdRegex = (
|
|
530
|
+
const brokerIdRegex = (_o = params.broker) === null || _o === void 0 ? void 0 : _o.id;
|
|
505
531
|
if (typeof brokerIdRegex === 'string' && brokerIdRegex.length > 0) {
|
|
506
532
|
andConditions.push({
|
|
507
533
|
'broker.id': {
|
|
@@ -510,7 +536,7 @@ class MongoRepository {
|
|
|
510
536
|
}
|
|
511
537
|
});
|
|
512
538
|
}
|
|
513
|
-
const brokerIdentifierAll = (
|
|
539
|
+
const brokerIdentifierAll = (_q = (_p = params.broker) === null || _p === void 0 ? void 0 : _p.identifier) === null || _q === void 0 ? void 0 : _q.$all;
|
|
514
540
|
if (Array.isArray(brokerIdentifierAll)) {
|
|
515
541
|
andConditions.push({
|
|
516
542
|
'broker.identifier': {
|
|
@@ -519,7 +545,7 @@ class MongoRepository {
|
|
|
519
545
|
}
|
|
520
546
|
});
|
|
521
547
|
}
|
|
522
|
-
const brokerIdentifierIn = (
|
|
548
|
+
const brokerIdentifierIn = (_s = (_r = params.broker) === null || _r === void 0 ? void 0 : _r.identifier) === null || _s === void 0 ? void 0 : _s.$in;
|
|
523
549
|
if (Array.isArray(brokerIdentifierIn)) {
|
|
524
550
|
andConditions.push({
|
|
525
551
|
'broker.identifier': {
|
|
@@ -528,7 +554,7 @@ class MongoRepository {
|
|
|
528
554
|
}
|
|
529
555
|
});
|
|
530
556
|
}
|
|
531
|
-
const brokerIdentifierNin = (
|
|
557
|
+
const brokerIdentifierNin = (_u = (_t = params.broker) === null || _t === void 0 ? void 0 : _t.identifier) === null || _u === void 0 ? void 0 : _u.$nin;
|
|
532
558
|
if (Array.isArray(brokerIdentifierNin)) {
|
|
533
559
|
andConditions.push({
|
|
534
560
|
'broker.identifier': {
|
|
@@ -536,7 +562,7 @@ class MongoRepository {
|
|
|
536
562
|
}
|
|
537
563
|
});
|
|
538
564
|
}
|
|
539
|
-
const brokerIdentifierElemMatch = (
|
|
565
|
+
const brokerIdentifierElemMatch = (_w = (_v = params.broker) === null || _v === void 0 ? void 0 : _v.identifier) === null || _w === void 0 ? void 0 : _w.$elemMatch;
|
|
540
566
|
if (brokerIdentifierElemMatch !== undefined && brokerIdentifierElemMatch !== null) {
|
|
541
567
|
andConditions.push({
|
|
542
568
|
'broker.identifier': {
|
|
@@ -571,9 +597,9 @@ class MongoRepository {
|
|
|
571
597
|
}
|
|
572
598
|
}
|
|
573
599
|
else {
|
|
574
|
-
const emailRegex = (
|
|
600
|
+
const emailRegex = (_x = params.underName.email) === null || _x === void 0 ? void 0 : _x.$regex;
|
|
575
601
|
if (typeof emailRegex === 'string' && emailRegex.length > 0) {
|
|
576
|
-
const emailOptions = (
|
|
602
|
+
const emailOptions = (_y = params.underName.email) === null || _y === void 0 ? void 0 : _y.$options;
|
|
577
603
|
andConditions.push({
|
|
578
604
|
'underName.email': Object.assign({ $exists: true, $regex: new RegExp(emailRegex) }, (typeof emailOptions === 'string') ? { $options: emailOptions } : undefined)
|
|
579
605
|
});
|
|
@@ -592,9 +618,9 @@ class MongoRepository {
|
|
|
592
618
|
}
|
|
593
619
|
}
|
|
594
620
|
else {
|
|
595
|
-
const underNameNameRegex = (
|
|
621
|
+
const underNameNameRegex = (_z = params.underName.name) === null || _z === void 0 ? void 0 : _z.$regex;
|
|
596
622
|
if (typeof underNameNameRegex === 'string' && underNameNameRegex.length > 0) {
|
|
597
|
-
const underNameNameOptions = (
|
|
623
|
+
const underNameNameOptions = (_0 = params.underName.name) === null || _0 === void 0 ? void 0 : _0.$options;
|
|
598
624
|
andConditions.push({
|
|
599
625
|
'underName.name': Object.assign({ $exists: true, $regex: new RegExp(underNameNameRegex) }, (typeof underNameNameOptions === 'string') ? { $options: underNameNameOptions } : undefined)
|
|
600
626
|
});
|
|
@@ -623,9 +649,9 @@ class MongoRepository {
|
|
|
623
649
|
}
|
|
624
650
|
}
|
|
625
651
|
else {
|
|
626
|
-
const givenNameRegex = (
|
|
652
|
+
const givenNameRegex = (_1 = params.underName.givenName) === null || _1 === void 0 ? void 0 : _1.$regex;
|
|
627
653
|
if (typeof givenNameRegex === 'string' && givenNameRegex.length > 0) {
|
|
628
|
-
const givenNameOptions = (
|
|
654
|
+
const givenNameOptions = (_2 = params.underName.givenName) === null || _2 === void 0 ? void 0 : _2.$options;
|
|
629
655
|
andConditions.push({
|
|
630
656
|
'underName.givenName': Object.assign({ $exists: true, $regex: new RegExp(givenNameRegex) }, (typeof givenNameOptions === 'string') ? { $options: givenNameOptions } : undefined)
|
|
631
657
|
});
|
|
@@ -644,9 +670,9 @@ class MongoRepository {
|
|
|
644
670
|
}
|
|
645
671
|
}
|
|
646
672
|
else {
|
|
647
|
-
const familyNameRegex = (
|
|
673
|
+
const familyNameRegex = (_3 = params.underName.familyName) === null || _3 === void 0 ? void 0 : _3.$regex;
|
|
648
674
|
if (typeof familyNameRegex === 'string' && familyNameRegex.length > 0) {
|
|
649
|
-
const familyNameOptions = (
|
|
675
|
+
const familyNameOptions = (_4 = params.underName.familyName) === null || _4 === void 0 ? void 0 : _4.$options;
|
|
650
676
|
andConditions.push({
|
|
651
677
|
'underName.familyName': Object.assign({ $exists: true, $regex: new RegExp(familyNameRegex) }, (typeof familyNameOptions === 'string') ? { $options: familyNameOptions } : undefined)
|
|
652
678
|
});
|
|
@@ -747,7 +773,7 @@ class MongoRepository {
|
|
|
747
773
|
});
|
|
748
774
|
}
|
|
749
775
|
}
|
|
750
|
-
const programMembershipUsedIdentifierEq = (
|
|
776
|
+
const programMembershipUsedIdentifierEq = (_6 = (_5 = params.programMembershipUsed) === null || _5 === void 0 ? void 0 : _5.identifier) === null || _6 === void 0 ? void 0 : _6.$eq;
|
|
751
777
|
if (typeof programMembershipUsedIdentifierEq === 'string') {
|
|
752
778
|
andConditions.push({
|
|
753
779
|
'programMembershipUsed.identifier': {
|
|
@@ -756,7 +782,7 @@ class MongoRepository {
|
|
|
756
782
|
}
|
|
757
783
|
});
|
|
758
784
|
}
|
|
759
|
-
const programMembershipUsedIssuedThroughServiceTypeCodeValueEq = (
|
|
785
|
+
const programMembershipUsedIssuedThroughServiceTypeCodeValueEq = (_10 = (_9 = (_8 = (_7 = params.programMembershipUsed) === null || _7 === void 0 ? void 0 : _7.issuedThrough) === null || _8 === void 0 ? void 0 : _8.serviceType) === null || _9 === void 0 ? void 0 : _9.codeValue) === null || _10 === void 0 ? void 0 : _10.$eq;
|
|
760
786
|
if (typeof programMembershipUsedIssuedThroughServiceTypeCodeValueEq === 'string') {
|
|
761
787
|
andConditions.push({
|
|
762
788
|
'programMembershipUsed.issuedThrough.serviceType.codeValue': {
|
|
@@ -765,7 +791,7 @@ class MongoRepository {
|
|
|
765
791
|
}
|
|
766
792
|
});
|
|
767
793
|
}
|
|
768
|
-
const appliesToMovieTicketIdentifierEq = (
|
|
794
|
+
const appliesToMovieTicketIdentifierEq = (_14 = (_13 = (_12 = (_11 = params.price) === null || _11 === void 0 ? void 0 : _11.priceComponent) === null || _12 === void 0 ? void 0 : _12.appliesToMovieTicket) === null || _13 === void 0 ? void 0 : _13.identifier) === null || _14 === void 0 ? void 0 : _14.$eq;
|
|
769
795
|
if (typeof appliesToMovieTicketIdentifierEq === 'string') {
|
|
770
796
|
andConditions.push({
|
|
771
797
|
'price.priceComponent.appliesToMovieTicket.identifier': {
|
|
@@ -26,5 +26,5 @@ export declare function aggregateScreeningEvent(params: {
|
|
|
26
26
|
id: string;
|
|
27
27
|
}): IAggregateScreeningEventOperation<void>;
|
|
28
28
|
export declare function aggregateByEvent(params: {
|
|
29
|
-
event: factory.event.screeningEvent.IEvent;
|
|
29
|
+
event: factory.event.screeningEvent.IEvent | factory.event.event.IEvent;
|
|
30
30
|
}): IAggregateScreeningEventOperation<void>;
|
|
@@ -120,9 +120,16 @@ exports.aggregateByEvent = aggregateByEvent;
|
|
|
120
120
|
*/
|
|
121
121
|
function findLocation(params) {
|
|
122
122
|
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
123
|
+
var _a;
|
|
123
124
|
let movieTheater;
|
|
124
125
|
try {
|
|
125
|
-
|
|
126
|
+
if (params.event.typeOf === factory.eventType.ScreeningEvent) {
|
|
127
|
+
movieTheater = yield repos.place.findById({ id: params.event.superEvent.location.id });
|
|
128
|
+
}
|
|
129
|
+
else {
|
|
130
|
+
const movieTheaterId = String((_a = params.event.offers) === null || _a === void 0 ? void 0 : _a.itemOffered.availableChannel.serviceLocation.containedInPlace.id);
|
|
131
|
+
movieTheater = yield repos.place.findById({ id: movieTheaterId });
|
|
132
|
+
}
|
|
126
133
|
}
|
|
127
134
|
catch (error) {
|
|
128
135
|
let throwsError = true;
|
|
@@ -223,21 +230,25 @@ function aggregateReservationByOffer(params) {
|
|
|
223
230
|
let reservationCount4offer;
|
|
224
231
|
let attendeeCount4offer;
|
|
225
232
|
let checkInCount4offer;
|
|
233
|
+
let reservationType = factory.reservationType.EventReservation;
|
|
234
|
+
if (params.event.typeOf === factory.eventType.Event) {
|
|
235
|
+
reservationType = factory.reservationType.BusReservation;
|
|
236
|
+
}
|
|
226
237
|
reservationCount4offer = yield repos.reservation.count({
|
|
227
|
-
typeOf:
|
|
238
|
+
typeOf: reservationType,
|
|
228
239
|
reservationFor: { ids: [params.event.id] },
|
|
229
240
|
reservationStatuses: [factory.reservationStatusType.ReservationConfirmed],
|
|
230
241
|
reservedTicket: { ticketType: { ids: [params.offer.id] } }
|
|
231
242
|
});
|
|
232
243
|
attendeeCount4offer = yield repos.reservation.count({
|
|
233
|
-
typeOf:
|
|
244
|
+
typeOf: reservationType,
|
|
234
245
|
reservationFor: { ids: [params.event.id] },
|
|
235
246
|
reservationStatuses: [factory.reservationStatusType.ReservationConfirmed],
|
|
236
247
|
reservedTicket: { ticketType: { ids: [params.offer.id] } },
|
|
237
248
|
attended: true
|
|
238
249
|
});
|
|
239
250
|
checkInCount4offer = yield repos.reservation.count({
|
|
240
|
-
typeOf:
|
|
251
|
+
typeOf: reservationType,
|
|
241
252
|
reservationFor: { ids: [params.event.id] },
|
|
242
253
|
reservationStatuses: [factory.reservationStatusType.ReservationConfirmed],
|
|
243
254
|
reservedTicket: { ticketType: { ids: [params.offer.id] } },
|
|
@@ -390,8 +401,12 @@ function aggregateReservationByEvent(params) {
|
|
|
390
401
|
let attendeeCount;
|
|
391
402
|
let checkInCount;
|
|
392
403
|
let reservationCount;
|
|
404
|
+
let reservationType = factory.reservationType.EventReservation;
|
|
405
|
+
if (params.event.typeOf === factory.eventType.Event) {
|
|
406
|
+
reservationType = factory.reservationType.BusReservation;
|
|
407
|
+
}
|
|
393
408
|
reservationCount = yield repos.reservation.count({
|
|
394
|
-
typeOf:
|
|
409
|
+
typeOf: reservationType,
|
|
395
410
|
reservationFor: { ids: [params.event.id] },
|
|
396
411
|
reservationStatuses: [factory.reservationStatusType.ReservationConfirmed]
|
|
397
412
|
});
|
|
@@ -421,13 +436,13 @@ function aggregateReservationByEvent(params) {
|
|
|
421
436
|
}
|
|
422
437
|
}
|
|
423
438
|
attendeeCount = yield repos.reservation.count({
|
|
424
|
-
typeOf:
|
|
439
|
+
typeOf: reservationType,
|
|
425
440
|
reservationFor: { ids: [params.event.id] },
|
|
426
441
|
// reservationStatuses: [factory.reservationStatusType.ReservationConfirmed],
|
|
427
442
|
attended: true
|
|
428
443
|
});
|
|
429
444
|
checkInCount = yield repos.reservation.count({
|
|
430
|
-
typeOf:
|
|
445
|
+
typeOf: reservationType,
|
|
431
446
|
reservationFor: { ids: [params.event.id] },
|
|
432
447
|
// reservationStatuses: [factory.reservationStatusType.ReservationConfirmed],
|
|
433
448
|
checkedIn: true
|
|
@@ -162,7 +162,8 @@ function movieTicket2reservation4invoice(movieTicket, order, paymentMethodType)
|
|
|
162
162
|
}
|
|
163
163
|
});
|
|
164
164
|
}
|
|
165
|
-
return o.itemOffered.typeOf === factory.reservationType.EventReservation
|
|
165
|
+
return (o.itemOffered.typeOf === factory.reservationType.EventReservation
|
|
166
|
+
|| o.itemOffered.typeOf === factory.reservationType.BusReservation)
|
|
166
167
|
&& mvtkUnitPriceSpec !== undefined
|
|
167
168
|
&& o.itemOffered.reservationFor.id === movieTicket.serviceOutput.reservationFor.id
|
|
168
169
|
&& ((_d = o.itemOffered.reservedTicket.ticketedSeat) === null || _d === void 0 ? void 0 : _d.seatNumber) === movieTicket.serviceOutput.reservedTicket.ticketedSeat.seatNumber
|
|
@@ -389,8 +389,11 @@ function createReservation(params) {
|
|
|
389
389
|
typeOf: 'CategoryCode'
|
|
390
390
|
}
|
|
391
391
|
: undefined;
|
|
392
|
+
const availableChannel = eventOffers.itemOffered.availableChannel;
|
|
392
393
|
if (params.reservationFor.typeOf === factory.eventType.ScreeningEvent) {
|
|
393
|
-
const issuedThrough = Object.assign(
|
|
394
|
+
const issuedThrough = Object.assign({ typeOf: factory.product.ProductType.EventService,
|
|
395
|
+
// 興行IDを追加(2022-09-08~)
|
|
396
|
+
id: eventOffers.itemOffered.id, availableChannel }, (typeof (serviceTypeOfIssuedThrough === null || serviceTypeOfIssuedThrough === void 0 ? void 0 : serviceTypeOfIssuedThrough.typeOf) === 'string') ? { serviceType: serviceTypeOfIssuedThrough } : undefined);
|
|
394
397
|
return Object.assign(Object.assign(Object.assign(Object.assign({ project: params.project, typeOf: factory.reservationType.EventReservation, id: params.id, issuedThrough, additionalProperty: params.additionalProperty, bookingTime: params.reserveDate, modifiedTime: params.reserveDate, numSeats: 1, price: price4reservation, priceCurrency: factory.priceCurrency.JPY, reservationNumber: params.reservationNumber, reservationStatus: factory.reservationStatusType.ReservationPending, reservedTicket: params.reservedTicket,
|
|
395
398
|
// 最適化(2022-12-19~)
|
|
396
399
|
underName: {
|
|
@@ -412,7 +415,9 @@ function createReservation(params) {
|
|
|
412
415
|
: undefined);
|
|
413
416
|
}
|
|
414
417
|
else {
|
|
415
|
-
const issuedThrough = Object.assign(
|
|
418
|
+
const issuedThrough = Object.assign({ typeOf: factory.product.ProductType.Transportation,
|
|
419
|
+
// 興行IDを追加(2022-09-08~)
|
|
420
|
+
id: eventOffers.itemOffered.id, availableChannel }, (typeof (serviceTypeOfIssuedThrough === null || serviceTypeOfIssuedThrough === void 0 ? void 0 : serviceTypeOfIssuedThrough.typeOf) === 'string') ? { serviceType: serviceTypeOfIssuedThrough } : undefined);
|
|
416
421
|
return Object.assign(Object.assign(Object.assign(Object.assign({ project: params.project, typeOf: factory.reservationType.BusReservation, id: params.id, issuedThrough, additionalProperty: params.additionalProperty, bookingTime: params.reserveDate, modifiedTime: params.reserveDate, numSeats: 1, price: price4reservation, priceCurrency: factory.priceCurrency.JPY, reservationNumber: params.reservationNumber, reservationStatus: factory.reservationStatusType.ReservationPending, reservedTicket: params.reservedTicket, underName: {
|
|
417
422
|
typeOf: params.agent.typeOf,
|
|
418
423
|
name: params.agent.name
|
|
@@ -22,6 +22,7 @@ function createOwnershipInfosFromOrder(params) {
|
|
|
22
22
|
const ownedBy = createOwnedby(params);
|
|
23
23
|
const itemOfferedType = itemOffered.typeOf;
|
|
24
24
|
switch (itemOfferedType) {
|
|
25
|
+
case factory.reservationType.BusReservation:
|
|
25
26
|
case factory.reservationType.EventReservation:
|
|
26
27
|
ownershipInfo = (0, factory_2.createReservationOwnershipInfo)({
|
|
27
28
|
project: params.order.project,
|