@chevre/domain 20.1.0-alpha.2 → 20.1.0-alpha.20
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/deleteEvents.ts +9 -1
- package/example/src/chevre/migrateEventOffersSellerMakesOffer.ts +139 -0
- package/example/src/chevre/migrateEventSeriesAdditionalPropertyNames.ts +68 -0
- package/example/src/chevre/migrateSellerMakesOfferTransactionDuration.ts +71 -0
- package/example/src/chevre/searchEvents.ts +36 -16
- package/lib/chevre/repo/action.js +42 -31
- package/lib/chevre/repo/additionalPropertyName.d.ts +35 -0
- package/lib/chevre/repo/additionalPropertyName.js +211 -0
- package/lib/chevre/repo/event.d.ts +9 -4
- package/lib/chevre/repo/event.js +59 -47
- package/lib/chevre/repo/mongoose/model/action.js +9 -1
- package/lib/chevre/repo/mongoose/model/additionalPropertyName.d.ts +7 -0
- package/lib/chevre/repo/mongoose/model/additionalPropertyName.js +81 -0
- package/lib/chevre/repo/mongoose/model/event.js +53 -0
- package/lib/chevre/repo/mongoose/model/place.js +18 -0
- package/lib/chevre/repo/place.d.ts +1 -0
- package/lib/chevre/repo/place.js +5 -0
- package/lib/chevre/repo/transaction.js +20 -5
- package/lib/chevre/repository.d.ts +6 -0
- package/lib/chevre/repository.js +8 -1
- package/lib/chevre/service/account.d.ts +0 -4
- package/lib/chevre/service/account.js +24 -22
- package/lib/chevre/service/accountTransaction/deposit.d.ts +0 -2
- package/lib/chevre/service/accountTransaction/deposit.js +3 -3
- package/lib/chevre/service/accountTransaction/transfer.d.ts +0 -2
- package/lib/chevre/service/accountTransaction/transfer.js +3 -3
- package/lib/chevre/service/accountTransaction/withdraw.d.ts +0 -2
- package/lib/chevre/service/accountTransaction/withdraw.js +3 -3
- package/lib/chevre/service/assetTransaction/pay/potentialActions.js +11 -20
- package/lib/chevre/service/delivery/factory.js +2 -1
- package/lib/chevre/service/event.js +10 -0
- package/lib/chevre/service/offer/event/authorize.d.ts +4 -0
- package/lib/chevre/service/offer/event/authorize.js +46 -10
- package/lib/chevre/service/offer/factory.js +7 -20
- package/lib/chevre/service/offer.js +6 -6
- package/lib/chevre/service/order/onOrderStatusChanged/factory.js +5 -3
- package/lib/chevre/service/order/onOrderStatusChanged.js +5 -4
- package/lib/chevre/service/order/placeOrder.js +17 -7
- package/lib/chevre/service/order/returnOrder.js +2 -1
- package/lib/chevre/service/order/sendOrder.js +4 -2
- package/lib/chevre/service/transaction/orderProgramMembership.js +6 -8
- package/lib/chevre/service/transaction/placeOrder/exportTasks/factory.js +6 -3
- package/lib/chevre/service/transaction/placeOrderInProgress/factory.js +9 -4
- package/lib/chevre/service/transaction/placeOrderInProgress/potentialActions/givePointAward.js +2 -1
- package/lib/chevre/service/transaction/placeOrderInProgress/potentialActions/moneyTransfer.js +2 -1
- package/lib/chevre/service/transaction/placeOrderInProgress/potentialActions/registerService.js +2 -1
- package/lib/chevre/service/transaction/placeOrderInProgress/potentialActions/sendEmailMessage.js +4 -3
- package/lib/chevre/service/transaction/placeOrderInProgress/potentialActions.js +4 -2
- package/lib/chevre/service/transaction/placeOrderInProgress/result.js +2 -4
- package/lib/chevre/service/transaction/placeOrderInProgress/validation/validateSeller.d.ts +3 -1
- package/lib/chevre/service/transaction/placeOrderInProgress/validation/validateSeller.js +3 -2
- package/lib/chevre/service/transaction/placeOrderInProgress.js +16 -2
- package/lib/chevre/service/transaction/returnOrder/potentialActions/returnMoneyTransfer.js +4 -5
- package/lib/chevre/service/transaction/returnOrder/potentialActions/returnPaymentMethod.js +6 -3
- package/lib/chevre/service/transaction/returnOrder/potentialActions/returnPointAward.js +4 -6
- package/lib/chevre/service/transaction/returnOrder/potentialActions/sendEmailMessage.js +2 -1
- package/lib/chevre/service/transaction/returnOrder.js +10 -1
- package/lib/chevre/service/transaction.js +1 -14
- package/package.json +3 -3
- package/example/src/chevre/accountBlanceTest.ts +0 -24
- package/example/src/chevre/checkOffersAppliesToMovieTicket.ts +0 -56
- package/example/src/chevre/createSeats.ts +0 -59
- package/example/src/chevre/manageOwnedByOfOwnershipInfo.ts +0 -35
- package/example/src/chevre/migrateEventOffersItemOfferedName.ts +0 -82
- package/example/src/chevre/migrateMovieTicketChargePriceSpecs.ts +0 -92
- package/example/src/chevre/migrateSellerMakesOffers.ts +0 -84
- package/example/src/chevre/migrateTTTSOldEventId.ts +0 -68
- package/example/src/chevre/publishConfirmationNumber.ts +0 -30
- package/example/src/chevre/publishServiceOutputIdentifier.ts +0 -28
- package/example/src/chevre/publishTransactionNumber.ts +0 -28
- package/example/src/chevre/renameTransaction.ts +0 -22
- package/lib/chevre/service/task/accountMoneyTransfer.d.ts +0 -3
- package/lib/chevre/service/task/accountMoneyTransfer.js +0 -31
- package/lib/chevre/service/task/cancelAccountMoneyTransfer.d.ts +0 -3
- package/lib/chevre/service/task/cancelAccountMoneyTransfer.js +0 -33
- package/lib/chevre/service/transaction/placeOrderInProgress/potentialActions/confirmReservation.d.ts +0 -11
- package/lib/chevre/service/transaction/placeOrderInProgress/potentialActions/confirmReservation.js +0 -187
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
// tslint:disable:no-console
|
|
2
|
+
import * as moment from 'moment';
|
|
2
3
|
import * as mongoose from 'mongoose';
|
|
3
4
|
|
|
4
5
|
import { chevre } from '../../../lib/index';
|
|
@@ -13,7 +14,14 @@ async function main() {
|
|
|
13
14
|
const cursor = eventRepo.getCursor(
|
|
14
15
|
{
|
|
15
16
|
'project.id': { $eq: project.id },
|
|
16
|
-
typeOf: { $eq: chevre.factory.eventType.ScreeningEvent }
|
|
17
|
+
typeOf: { $eq: chevre.factory.eventType.ScreeningEvent },
|
|
18
|
+
// 'superEvent.location.branchCode': { $eq: '118', $exists: true },
|
|
19
|
+
endDate: {
|
|
20
|
+
$exists: true,
|
|
21
|
+
$lt: moment()
|
|
22
|
+
.add(-1, 'month')
|
|
23
|
+
.toDate()
|
|
24
|
+
}
|
|
17
25
|
},
|
|
18
26
|
{
|
|
19
27
|
// _id: 1,
|
|
@@ -0,0 +1,139 @@
|
|
|
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 AVAILABLE_ROLE_NAMES = ['customer', 'pos'];
|
|
10
|
+
const POS_CLIENT_ID = process.env.POS_CLIENT_ID;
|
|
11
|
+
if (typeof POS_CLIENT_ID !== 'string') {
|
|
12
|
+
throw new Error('set POS_CLIENT_ID');
|
|
13
|
+
}
|
|
14
|
+
const MAXIMUM_RESERVATION_GRACE_PERIOD_IN_DAYS = 93;
|
|
15
|
+
const EXCLUDED_PROJECT_ID = process.env.EXCLUDED_PROJECT_ID;
|
|
16
|
+
|
|
17
|
+
// tslint:disable-next-line:max-func-body-length
|
|
18
|
+
async function main() {
|
|
19
|
+
await mongoose.connect(<string>process.env.MONGOLAB_URI);
|
|
20
|
+
|
|
21
|
+
const eventRepo = new chevre.repository.Event(mongoose.connection);
|
|
22
|
+
const memberRepo = new chevre.repository.Member(mongoose.connection);
|
|
23
|
+
|
|
24
|
+
const cursor = eventRepo.getCursor(
|
|
25
|
+
{
|
|
26
|
+
// 'project.id': { $eq: project.id },
|
|
27
|
+
'project.id': { $ne: EXCLUDED_PROJECT_ID },
|
|
28
|
+
typeOf: { $eq: chevre.factory.eventType.ScreeningEvent },
|
|
29
|
+
startDate: {
|
|
30
|
+
$gte: moment()
|
|
31
|
+
.add(-1, 'month')
|
|
32
|
+
.toDate()
|
|
33
|
+
}
|
|
34
|
+
// _id: { $eq: 'al6aff83w' }
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
// _id: 1,
|
|
38
|
+
}
|
|
39
|
+
);
|
|
40
|
+
console.log('events found');
|
|
41
|
+
|
|
42
|
+
let i = 0;
|
|
43
|
+
let updateCount = 0;
|
|
44
|
+
await cursor.eachAsync(async (doc) => {
|
|
45
|
+
i += 1;
|
|
46
|
+
const event: chevre.factory.event.screeningEvent.IEvent = doc.toObject();
|
|
47
|
+
|
|
48
|
+
// IAMメンバー検索
|
|
49
|
+
const eventOffers = <chevre.factory.event.screeningEvent.IOffer | undefined>event.offers;
|
|
50
|
+
if (eventOffers === undefined) {
|
|
51
|
+
throw new Error('event.offers undefined');
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
const makesOfferFromEvent = eventOffers.seller.makesOffer;
|
|
55
|
+
|
|
56
|
+
const alreadyMigrated = Array.isArray(makesOfferFromEvent)
|
|
57
|
+
&& makesOfferFromEvent.length > 0
|
|
58
|
+
&& makesOfferFromEvent.every((offer) => {
|
|
59
|
+
return offer.availabilityEnds instanceof Date
|
|
60
|
+
&& offer.availabilityStarts instanceof Date
|
|
61
|
+
&& offer.validFrom instanceof Date
|
|
62
|
+
&& offer.validThrough instanceof Date
|
|
63
|
+
&& Array.isArray(offer.availableAtOrFrom)
|
|
64
|
+
&& offer.availableAtOrFrom.length === 1;
|
|
65
|
+
});
|
|
66
|
+
|
|
67
|
+
if (alreadyMigrated) {
|
|
68
|
+
console.log(
|
|
69
|
+
'already exist...', event.project.id, event.id, event.startDate, makesOfferFromEvent.length, i);
|
|
70
|
+
} else {
|
|
71
|
+
let existingApplicationMembers = await memberRepo.search({
|
|
72
|
+
limit: 100,
|
|
73
|
+
page: 1,
|
|
74
|
+
project: { id: { $eq: event.project.id } },
|
|
75
|
+
member: { typeOf: { $eq: chevre.factory.creativeWorkType.WebApplication } }
|
|
76
|
+
});
|
|
77
|
+
// ロールで絞る(customer or pos)
|
|
78
|
+
existingApplicationMembers = existingApplicationMembers
|
|
79
|
+
.filter((m) => {
|
|
80
|
+
return Array.isArray(m.member.hasRole) && m.member.hasRole.some((r) => AVAILABLE_ROLE_NAMES.includes(r.roleName));
|
|
81
|
+
});
|
|
82
|
+
console.log(
|
|
83
|
+
existingApplicationMembers.length,
|
|
84
|
+
'existingApplicationMembers found.',
|
|
85
|
+
event.project.id,
|
|
86
|
+
existingApplicationMembers.map((m) => m.member.name)
|
|
87
|
+
.join(',')
|
|
88
|
+
);
|
|
89
|
+
const newMakesOffer: chevre.factory.event.screeningEvent.ISellerMakesOffer[] = existingApplicationMembers.map((a) => {
|
|
90
|
+
// posについては有効期間調整
|
|
91
|
+
if (a.member.id === POS_CLIENT_ID) {
|
|
92
|
+
const validFrom4pos: Date = moment(event.startDate)
|
|
93
|
+
.add(-MAXIMUM_RESERVATION_GRACE_PERIOD_IN_DAYS, 'days')
|
|
94
|
+
.toDate();
|
|
95
|
+
const validThrough4pos: Date = moment(event.endDate)
|
|
96
|
+
.add(1, 'month')
|
|
97
|
+
.toDate();
|
|
98
|
+
|
|
99
|
+
return {
|
|
100
|
+
typeOf: chevre.factory.offerType.Offer,
|
|
101
|
+
availableAtOrFrom: [{ id: a.member.id }],
|
|
102
|
+
availabilityEnds: validThrough4pos, // 1 month later from endDate
|
|
103
|
+
availabilityStarts: validFrom4pos, // startのMAXIMUM_RESERVATION_GRACE_PERIOD_IN_DAYS前
|
|
104
|
+
validFrom: validFrom4pos, // startのMAXIMUM_RESERVATION_GRACE_PERIOD_IN_DAYS前
|
|
105
|
+
validThrough: validThrough4pos // 1 month later from endDate
|
|
106
|
+
};
|
|
107
|
+
} else {
|
|
108
|
+
return {
|
|
109
|
+
typeOf: chevre.factory.offerType.Offer,
|
|
110
|
+
availableAtOrFrom: [{ id: a.member.id }],
|
|
111
|
+
availabilityEnds: eventOffers.availabilityEnds,
|
|
112
|
+
availabilityStarts: eventOffers.availabilityStarts,
|
|
113
|
+
validFrom: eventOffers.validFrom,
|
|
114
|
+
validThrough: eventOffers.validThrough
|
|
115
|
+
};
|
|
116
|
+
}
|
|
117
|
+
});
|
|
118
|
+
console.log(
|
|
119
|
+
'updating seller...', event.project.id, event.id, event.startDate, newMakesOffer.length, i);
|
|
120
|
+
await eventRepo.updatePartiallyById({
|
|
121
|
+
id: event.id,
|
|
122
|
+
attributes: <any>{
|
|
123
|
+
typeOf: event.typeOf,
|
|
124
|
+
'offers.seller.makesOffer': newMakesOffer
|
|
125
|
+
}
|
|
126
|
+
});
|
|
127
|
+
updateCount += 1;
|
|
128
|
+
console.log(
|
|
129
|
+
'updated...', event.project.id, event.id, event.startDate, newMakesOffer.length, i);
|
|
130
|
+
}
|
|
131
|
+
});
|
|
132
|
+
|
|
133
|
+
console.log(i, 'events checked');
|
|
134
|
+
console.log(updateCount, 'events updated');
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
main()
|
|
138
|
+
.then()
|
|
139
|
+
.catch(console.error);
|
|
@@ -0,0 +1,68 @@
|
|
|
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
|
+
const EXCLUDED_PROJECT_ID = process.env.EXCLUDED_PROJECT_ID;
|
|
9
|
+
|
|
10
|
+
// tslint:disable-next-line:max-func-body-length
|
|
11
|
+
async function main() {
|
|
12
|
+
await mongoose.connect(<string>process.env.MONGOLAB_URI);
|
|
13
|
+
|
|
14
|
+
const eventRepo = new chevre.repository.Event(mongoose.connection);
|
|
15
|
+
|
|
16
|
+
const cursor = eventRepo.getCursor(
|
|
17
|
+
{
|
|
18
|
+
// 'project.id': { $eq: project.id },
|
|
19
|
+
'project.id': { $ne: EXCLUDED_PROJECT_ID },
|
|
20
|
+
typeOf: { $eq: chevre.factory.eventType.ScreeningEventSeries }
|
|
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
|
+
const additionalPropertyNames: string[] = [];
|
|
36
|
+
const projectIds: string[] = [];
|
|
37
|
+
|
|
38
|
+
let i = 0;
|
|
39
|
+
const updateCount = 0;
|
|
40
|
+
await cursor.eachAsync(async (doc) => {
|
|
41
|
+
i += 1;
|
|
42
|
+
const event: chevre.factory.event.screeningEventSeries.IEvent = doc.toObject();
|
|
43
|
+
|
|
44
|
+
const additionalPropertyNamesOnEvent = event.additionalProperty?.map((p) => p.name);
|
|
45
|
+
if (Array.isArray(additionalPropertyNamesOnEvent) && additionalPropertyNamesOnEvent.length > 0) {
|
|
46
|
+
console.log(additionalPropertyNamesOnEvent.length, 'additionalPropertyNamesOnEvent found', event.project.id);
|
|
47
|
+
additionalPropertyNames.push(...additionalPropertyNamesOnEvent);
|
|
48
|
+
projectIds.push(event.project.id);
|
|
49
|
+
additionalPropertyNamesOnEvent.forEach((name) => {
|
|
50
|
+
if (!name.match(/^[a-zA-Z]*$/)) {
|
|
51
|
+
throw new Error(`not matched ${event.project.id} ${event.id}`);
|
|
52
|
+
}
|
|
53
|
+
// tslint:disable-next-line:no-magic-numbers
|
|
54
|
+
if (name.length < 8) {
|
|
55
|
+
throw new Error(`length matched ${event.project.id} ${event.id} ${name}`);
|
|
56
|
+
}
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
});
|
|
60
|
+
console.log(i, 'events checked');
|
|
61
|
+
console.log(updateCount, 'events updated');
|
|
62
|
+
console.log([...new Set(additionalPropertyNames)]);
|
|
63
|
+
console.log([...new Set(projectIds)]);
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
main()
|
|
67
|
+
.then()
|
|
68
|
+
.catch(console.error);
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
// tslint:disable:no-console
|
|
2
|
+
import * as mongoose from 'mongoose';
|
|
3
|
+
|
|
4
|
+
import { chevre } from '../../../lib/index';
|
|
5
|
+
|
|
6
|
+
// const project = { id: String(process.env.PROJECT_ID) };
|
|
7
|
+
|
|
8
|
+
const DEFAULT_TRANSACTION_DURATION = 900;
|
|
9
|
+
|
|
10
|
+
async function main() {
|
|
11
|
+
await mongoose.connect(<string>process.env.MONGOLAB_URI);
|
|
12
|
+
|
|
13
|
+
const sellerRepo = new chevre.repository.Seller(mongoose.connection);
|
|
14
|
+
|
|
15
|
+
const cursor = sellerRepo.getCursor(
|
|
16
|
+
{
|
|
17
|
+
// 'project.id': { $eq: project.id }
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
// _id: 1,
|
|
21
|
+
}
|
|
22
|
+
);
|
|
23
|
+
console.log('sellers found');
|
|
24
|
+
|
|
25
|
+
let i = 0;
|
|
26
|
+
let updateCount = 0;
|
|
27
|
+
await cursor.eachAsync(async (doc) => {
|
|
28
|
+
i += 1;
|
|
29
|
+
const seller: chevre.factory.seller.ISeller = doc.toObject();
|
|
30
|
+
|
|
31
|
+
const makesOffer = seller.makesOffer;
|
|
32
|
+
|
|
33
|
+
if (Array.isArray(makesOffer) && makesOffer.length > 0) {
|
|
34
|
+
const everyMakesHasTransactionDuration = makesOffer.every((offer) => {
|
|
35
|
+
const transactionDuration = offer.eligibleTransactionDuration?.maxValue;
|
|
36
|
+
|
|
37
|
+
return typeof transactionDuration === 'number';
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
if (everyMakesHasTransactionDuration) {
|
|
41
|
+
console.log(
|
|
42
|
+
'already migrated...', seller.project.id, seller.id, makesOffer.length, i);
|
|
43
|
+
} else {
|
|
44
|
+
const eligibleTransactionDuration: chevre.factory.seller.IEligibleTransactionDuration = {
|
|
45
|
+
typeOf: 'QuantitativeValue',
|
|
46
|
+
unitCode: chevre.factory.unitCode.Sec,
|
|
47
|
+
// tslint:disable-next-line:no-magic-numbers
|
|
48
|
+
maxValue: (seller.project.id.slice(0, 6) === 'sskts-') ? 600 : DEFAULT_TRANSACTION_DURATION
|
|
49
|
+
};
|
|
50
|
+
console.log(
|
|
51
|
+
'updating seller...', seller.project.id, seller.id, i);
|
|
52
|
+
await sellerRepo.save({
|
|
53
|
+
id: seller.id,
|
|
54
|
+
attributes: <any>{
|
|
55
|
+
'makesOffer.$[].eligibleTransactionDuration': eligibleTransactionDuration
|
|
56
|
+
}
|
|
57
|
+
});
|
|
58
|
+
updateCount += 1;
|
|
59
|
+
console.log(
|
|
60
|
+
'updated...', seller.project.id, seller.id, i);
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
});
|
|
64
|
+
|
|
65
|
+
console.log(i, 'sellers checked');
|
|
66
|
+
console.log(updateCount, 'sellers updated');
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
main()
|
|
70
|
+
.then()
|
|
71
|
+
.catch(console.error);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// tslint:disable:no-console
|
|
2
|
-
|
|
2
|
+
import * as moment from 'moment';
|
|
3
3
|
import * as mongoose from 'mongoose';
|
|
4
4
|
|
|
5
5
|
import { chevre } from '../../../lib/index';
|
|
@@ -15,22 +15,42 @@ async function main() {
|
|
|
15
15
|
limit: 100,
|
|
16
16
|
page: 1,
|
|
17
17
|
sort: { startDate: 1 },
|
|
18
|
-
typeOf: chevre.factory.eventType.
|
|
18
|
+
typeOf: chevre.factory.eventType.ScreeningEvent,
|
|
19
19
|
project: { id: { $eq: PROJECT_ID } },
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
20
|
+
offers: {
|
|
21
|
+
seller: {
|
|
22
|
+
makesOffer: {
|
|
23
|
+
$elemMatch: {
|
|
24
|
+
'availableAtOrFrom.id': { $eq: '5h3gs22mu9j3ok7o63uog9o9i3' },
|
|
25
|
+
availabilityEnds: {
|
|
26
|
+
$gte: moment('2022-11-18T02:20:00.000Z')
|
|
27
|
+
.toDate(),
|
|
28
|
+
$lte: moment('2022-11-18T02:20:00.000Z')
|
|
29
|
+
.toDate()
|
|
30
|
+
},
|
|
31
|
+
availabilityStarts: {
|
|
32
|
+
$gte: moment('2022-11-15T15:00:00.000Z')
|
|
33
|
+
.toDate(),
|
|
34
|
+
$lte: moment('2022-11-15T15:00:00.000Z')
|
|
35
|
+
.toDate()
|
|
36
|
+
},
|
|
37
|
+
validFrom: {
|
|
38
|
+
$gte: moment('2022-11-15T15:00:00.000Z')
|
|
39
|
+
.toDate(),
|
|
40
|
+
$lte: moment('2022-11-15T15:00:00.000Z')
|
|
41
|
+
.toDate()
|
|
42
|
+
},
|
|
43
|
+
validThrough: {
|
|
44
|
+
$gte: moment('2022-11-18T02:20:00.000Z')
|
|
45
|
+
.toDate(),
|
|
46
|
+
$lte: moment('2022-11-18T02:20:00.000Z')
|
|
47
|
+
.toDate()
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
},
|
|
53
|
+
id: { $in: ['al6aff83y'] }
|
|
34
54
|
});
|
|
35
55
|
console.log(events);
|
|
36
56
|
console.log(events.length);
|
|
@@ -22,7 +22,7 @@ class MongoRepository {
|
|
|
22
22
|
}
|
|
23
23
|
// tslint:disable-next-line:cyclomatic-complexity max-func-body-length
|
|
24
24
|
static CREATE_MONGO_CONDITIONS(params) {
|
|
25
|
-
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, _15, _16, _17, _18, _19, _20, _21, _22, _23, _24, _25, _26, _27, _28, _29, _30, _31, _32, _33, _34, _35, _36, _37, _38, _39, _40, _41, _42, _43, _44, _45, _46, _47, _48;
|
|
25
|
+
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, _15, _16, _17, _18, _19, _20, _21, _22, _23, _24, _25, _26, _27, _28, _29, _30, _31, _32, _33, _34, _35, _36, _37, _38, _39, _40, _41, _42, _43, _44, _45, _46, _47, _48, _49, _50;
|
|
26
26
|
const andConditions = [];
|
|
27
27
|
const projectIdEq = (_b = (_a = params.project) === null || _a === void 0 ? void 0 : _a.id) === null || _b === void 0 ? void 0 : _b.$eq;
|
|
28
28
|
// tslint:disable-next-line:no-single-line-block-comment
|
|
@@ -54,7 +54,18 @@ class MongoRepository {
|
|
|
54
54
|
}
|
|
55
55
|
});
|
|
56
56
|
}
|
|
57
|
-
const
|
|
57
|
+
const locationIdEq = (_h = (_g = params.location) === null || _g === void 0 ? void 0 : _g.id) === null || _h === void 0 ? void 0 : _h.$eq;
|
|
58
|
+
// tslint:disable-next-line:no-single-line-block-comment
|
|
59
|
+
/* istanbul ignore else */
|
|
60
|
+
if (typeof locationIdEq === 'string') {
|
|
61
|
+
andConditions.push({
|
|
62
|
+
'location.id': {
|
|
63
|
+
$exists: true,
|
|
64
|
+
$eq: locationIdEq
|
|
65
|
+
}
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
const locationIdentifierEq = (_k = (_j = params.location) === null || _j === void 0 ? void 0 : _j.identifier) === null || _k === void 0 ? void 0 : _k.$eq;
|
|
58
69
|
// tslint:disable-next-line:no-single-line-block-comment
|
|
59
70
|
/* istanbul ignore else */
|
|
60
71
|
if (typeof locationIdentifierEq === 'string') {
|
|
@@ -67,7 +78,7 @@ class MongoRepository {
|
|
|
67
78
|
}
|
|
68
79
|
// tslint:disable-next-line:no-single-line-block-comment
|
|
69
80
|
/* istanbul ignore else */
|
|
70
|
-
const objectPaymentMethodIdEq = (
|
|
81
|
+
const objectPaymentMethodIdEq = (_m = (_l = params.object) === null || _l === void 0 ? void 0 : _l.paymentMethodId) === null || _m === void 0 ? void 0 : _m.$eq;
|
|
71
82
|
if (typeof objectPaymentMethodIdEq === 'string') {
|
|
72
83
|
andConditions.push({
|
|
73
84
|
'object.paymentMethodId': {
|
|
@@ -76,7 +87,7 @@ class MongoRepository {
|
|
|
76
87
|
}
|
|
77
88
|
});
|
|
78
89
|
}
|
|
79
|
-
const objectObjectPaymentMethodIdEq = (
|
|
90
|
+
const objectObjectPaymentMethodIdEq = (_q = (_p = (_o = params.object) === null || _o === void 0 ? void 0 : _o.object) === null || _p === void 0 ? void 0 : _p.paymentMethodId) === null || _q === void 0 ? void 0 : _q.$eq;
|
|
80
91
|
if (typeof objectObjectPaymentMethodIdEq === 'string') {
|
|
81
92
|
andConditions.push({
|
|
82
93
|
'object.object.paymentMethodId': {
|
|
@@ -85,7 +96,7 @@ class MongoRepository {
|
|
|
85
96
|
}
|
|
86
97
|
});
|
|
87
98
|
}
|
|
88
|
-
const objectReservationForIdEq = (
|
|
99
|
+
const objectReservationForIdEq = (_t = (_s = (_r = params.object) === null || _r === void 0 ? void 0 : _r.reservationFor) === null || _s === void 0 ? void 0 : _s.id) === null || _t === void 0 ? void 0 : _t.$eq;
|
|
89
100
|
// tslint:disable-next-line:no-single-line-block-comment
|
|
90
101
|
/* istanbul ignore else */
|
|
91
102
|
if (typeof objectReservationForIdEq === 'string') {
|
|
@@ -96,7 +107,7 @@ class MongoRepository {
|
|
|
96
107
|
}
|
|
97
108
|
});
|
|
98
109
|
}
|
|
99
|
-
const objectPaymentMethodAccountIdEq = (
|
|
110
|
+
const objectPaymentMethodAccountIdEq = (_w = (_v = (_u = params.object) === null || _u === void 0 ? void 0 : _u.paymentMethod) === null || _v === void 0 ? void 0 : _v.accountId) === null || _w === void 0 ? void 0 : _w.$eq;
|
|
100
111
|
// tslint:disable-next-line:no-single-line-block-comment
|
|
101
112
|
/* istanbul ignore else */
|
|
102
113
|
if (typeof objectPaymentMethodAccountIdEq === 'string') {
|
|
@@ -107,7 +118,7 @@ class MongoRepository {
|
|
|
107
118
|
}
|
|
108
119
|
});
|
|
109
120
|
}
|
|
110
|
-
const objectPaymentMethodPaymentMethodIdEq = (
|
|
121
|
+
const objectPaymentMethodPaymentMethodIdEq = (_z = (_y = (_x = params.object) === null || _x === void 0 ? void 0 : _x.paymentMethod) === null || _y === void 0 ? void 0 : _y.paymentMethodId) === null || _z === void 0 ? void 0 : _z.$eq;
|
|
111
122
|
// tslint:disable-next-line:no-single-line-block-comment
|
|
112
123
|
/* istanbul ignore else */
|
|
113
124
|
if (typeof objectPaymentMethodPaymentMethodIdEq === 'string') {
|
|
@@ -118,7 +129,7 @@ class MongoRepository {
|
|
|
118
129
|
}
|
|
119
130
|
});
|
|
120
131
|
}
|
|
121
|
-
const objectPaymentMethodPaymentMethodIdIn = (
|
|
132
|
+
const objectPaymentMethodPaymentMethodIdIn = (_2 = (_1 = (_0 = params.object) === null || _0 === void 0 ? void 0 : _0.paymentMethod) === null || _1 === void 0 ? void 0 : _1.paymentMethodId) === null || _2 === void 0 ? void 0 : _2.$in;
|
|
122
133
|
if (Array.isArray(objectPaymentMethodPaymentMethodIdIn)) {
|
|
123
134
|
andConditions.push({
|
|
124
135
|
'object.paymentMethod.paymentMethodId': {
|
|
@@ -127,7 +138,7 @@ class MongoRepository {
|
|
|
127
138
|
}
|
|
128
139
|
});
|
|
129
140
|
}
|
|
130
|
-
const objectPaymentMethodTypeOfEq = (
|
|
141
|
+
const objectPaymentMethodTypeOfEq = (_5 = (_4 = (_3 = params.object) === null || _3 === void 0 ? void 0 : _3.paymentMethod) === null || _4 === void 0 ? void 0 : _4.typeOf) === null || _5 === void 0 ? void 0 : _5.$eq;
|
|
131
142
|
// tslint:disable-next-line:no-single-line-block-comment
|
|
132
143
|
/* istanbul ignore else */
|
|
133
144
|
if (typeof objectPaymentMethodTypeOfEq === 'string') {
|
|
@@ -138,7 +149,7 @@ class MongoRepository {
|
|
|
138
149
|
}
|
|
139
150
|
});
|
|
140
151
|
}
|
|
141
|
-
const objectTypeOfEq = (
|
|
152
|
+
const objectTypeOfEq = (_7 = (_6 = params.object) === null || _6 === void 0 ? void 0 : _6.typeOf) === null || _7 === void 0 ? void 0 : _7.$eq;
|
|
142
153
|
// tslint:disable-next-line:no-single-line-block-comment
|
|
143
154
|
/* istanbul ignore else */
|
|
144
155
|
if (typeof objectTypeOfEq === 'string') {
|
|
@@ -149,7 +160,7 @@ class MongoRepository {
|
|
|
149
160
|
}
|
|
150
161
|
});
|
|
151
162
|
}
|
|
152
|
-
const objectTypeOfIn = (
|
|
163
|
+
const objectTypeOfIn = (_9 = (_8 = params.object) === null || _8 === void 0 ? void 0 : _8.typeOf) === null || _9 === void 0 ? void 0 : _9.$in;
|
|
153
164
|
if (Array.isArray(objectTypeOfIn)) {
|
|
154
165
|
andConditions.push({
|
|
155
166
|
'object.typeOf': {
|
|
@@ -158,7 +169,7 @@ class MongoRepository {
|
|
|
158
169
|
}
|
|
159
170
|
});
|
|
160
171
|
}
|
|
161
|
-
const objectIdEq = (
|
|
172
|
+
const objectIdEq = (_11 = (_10 = params.object) === null || _10 === void 0 ? void 0 : _10.id) === null || _11 === void 0 ? void 0 : _11.$eq;
|
|
162
173
|
// tslint:disable-next-line:no-single-line-block-comment
|
|
163
174
|
/* istanbul ignore else */
|
|
164
175
|
if (typeof objectIdEq === 'string') {
|
|
@@ -169,7 +180,7 @@ class MongoRepository {
|
|
|
169
180
|
}
|
|
170
181
|
});
|
|
171
182
|
}
|
|
172
|
-
const objectIdIn = (
|
|
183
|
+
const objectIdIn = (_13 = (_12 = params.object) === null || _12 === void 0 ? void 0 : _12.id) === null || _13 === void 0 ? void 0 : _13.$in;
|
|
173
184
|
if (Array.isArray(objectIdIn)) {
|
|
174
185
|
andConditions.push({
|
|
175
186
|
'object.id': {
|
|
@@ -178,7 +189,7 @@ class MongoRepository {
|
|
|
178
189
|
}
|
|
179
190
|
});
|
|
180
191
|
}
|
|
181
|
-
const objectOrderNumberIn = (
|
|
192
|
+
const objectOrderNumberIn = (_15 = (_14 = params.object) === null || _14 === void 0 ? void 0 : _14.orderNumber) === null || _15 === void 0 ? void 0 : _15.$in;
|
|
182
193
|
if (Array.isArray(objectOrderNumberIn)) {
|
|
183
194
|
andConditions.push({
|
|
184
195
|
'object.orderNumber': {
|
|
@@ -187,7 +198,7 @@ class MongoRepository {
|
|
|
187
198
|
}
|
|
188
199
|
});
|
|
189
200
|
}
|
|
190
|
-
const objectEventIdIn = (
|
|
201
|
+
const objectEventIdIn = (_18 = (_17 = (_16 = params.object) === null || _16 === void 0 ? void 0 : _16.event) === null || _17 === void 0 ? void 0 : _17.id) === null || _18 === void 0 ? void 0 : _18.$in;
|
|
191
202
|
if (Array.isArray(objectEventIdIn)) {
|
|
192
203
|
andConditions.push({
|
|
193
204
|
'object.event.id': {
|
|
@@ -196,7 +207,7 @@ class MongoRepository {
|
|
|
196
207
|
}
|
|
197
208
|
});
|
|
198
209
|
}
|
|
199
|
-
const objectAcceptedOfferSeatNumberIn = (
|
|
210
|
+
const objectAcceptedOfferSeatNumberIn = (_22 = (_21 = (_20 = (_19 = params.object) === null || _19 === void 0 ? void 0 : _19.acceptedOffer) === null || _20 === void 0 ? void 0 : _20.ticketedSeat) === null || _21 === void 0 ? void 0 : _21.seatNumber) === null || _22 === void 0 ? void 0 : _22.$in;
|
|
200
211
|
if (Array.isArray(objectAcceptedOfferSeatNumberIn)) {
|
|
201
212
|
andConditions.push({
|
|
202
213
|
'object.acceptedOffer.ticketedSeat.seatNumber': {
|
|
@@ -213,7 +224,7 @@ class MongoRepository {
|
|
|
213
224
|
});
|
|
214
225
|
}
|
|
215
226
|
else {
|
|
216
|
-
const typeOfEq = (
|
|
227
|
+
const typeOfEq = (_23 = params.typeOf) === null || _23 === void 0 ? void 0 : _23.$eq;
|
|
217
228
|
// tslint:disable-next-line:no-single-line-block-comment
|
|
218
229
|
/* istanbul ignore else */
|
|
219
230
|
if (typeof typeOfEq === 'string') {
|
|
@@ -222,7 +233,7 @@ class MongoRepository {
|
|
|
222
233
|
});
|
|
223
234
|
}
|
|
224
235
|
}
|
|
225
|
-
const actionStatusIn = (
|
|
236
|
+
const actionStatusIn = (_24 = params.actionStatus) === null || _24 === void 0 ? void 0 : _24.$in;
|
|
226
237
|
// tslint:disable-next-line:no-single-line-block-comment
|
|
227
238
|
/* istanbul ignore else */
|
|
228
239
|
if (Array.isArray(actionStatusIn)) {
|
|
@@ -253,7 +264,7 @@ class MongoRepository {
|
|
|
253
264
|
startDate: { $lte: startDateLte }
|
|
254
265
|
});
|
|
255
266
|
}
|
|
256
|
-
const fromLocationTypeOfIn = (
|
|
267
|
+
const fromLocationTypeOfIn = (_26 = (_25 = params.fromLocation) === null || _25 === void 0 ? void 0 : _25.typeOf) === null || _26 === void 0 ? void 0 : _26.$in;
|
|
257
268
|
if (Array.isArray(fromLocationTypeOfIn)) {
|
|
258
269
|
andConditions.push({
|
|
259
270
|
'fromLocation.typeOf': {
|
|
@@ -262,7 +273,7 @@ class MongoRepository {
|
|
|
262
273
|
}
|
|
263
274
|
});
|
|
264
275
|
}
|
|
265
|
-
const fromLocationAccountNumberIn = (
|
|
276
|
+
const fromLocationAccountNumberIn = (_28 = (_27 = params.fromLocation) === null || _27 === void 0 ? void 0 : _27.accountNumber) === null || _28 === void 0 ? void 0 : _28.$in;
|
|
266
277
|
if (Array.isArray(fromLocationAccountNumberIn)) {
|
|
267
278
|
andConditions.push({
|
|
268
279
|
'fromLocation.accountNumber': {
|
|
@@ -271,7 +282,7 @@ class MongoRepository {
|
|
|
271
282
|
}
|
|
272
283
|
});
|
|
273
284
|
}
|
|
274
|
-
const fromLocationAccountTypeIn = (
|
|
285
|
+
const fromLocationAccountTypeIn = (_30 = (_29 = params.fromLocation) === null || _29 === void 0 ? void 0 : _29.accountType) === null || _30 === void 0 ? void 0 : _30.$in;
|
|
275
286
|
if (Array.isArray(fromLocationAccountTypeIn)) {
|
|
276
287
|
andConditions.push({
|
|
277
288
|
'fromLocation.accountType': {
|
|
@@ -280,7 +291,7 @@ class MongoRepository {
|
|
|
280
291
|
}
|
|
281
292
|
});
|
|
282
293
|
}
|
|
283
|
-
const toLocationTypeOfIn = (
|
|
294
|
+
const toLocationTypeOfIn = (_32 = (_31 = params.toLocation) === null || _31 === void 0 ? void 0 : _31.typeOf) === null || _32 === void 0 ? void 0 : _32.$in;
|
|
284
295
|
if (Array.isArray(toLocationTypeOfIn)) {
|
|
285
296
|
andConditions.push({
|
|
286
297
|
'toLocation.typeOf': {
|
|
@@ -289,7 +300,7 @@ class MongoRepository {
|
|
|
289
300
|
}
|
|
290
301
|
});
|
|
291
302
|
}
|
|
292
|
-
const toLocationAccountNumberIn = (
|
|
303
|
+
const toLocationAccountNumberIn = (_34 = (_33 = params.toLocation) === null || _33 === void 0 ? void 0 : _33.accountNumber) === null || _34 === void 0 ? void 0 : _34.$in;
|
|
293
304
|
if (Array.isArray(toLocationAccountNumberIn)) {
|
|
294
305
|
andConditions.push({
|
|
295
306
|
'toLocation.accountNumber': {
|
|
@@ -298,7 +309,7 @@ class MongoRepository {
|
|
|
298
309
|
}
|
|
299
310
|
});
|
|
300
311
|
}
|
|
301
|
-
const toLocationAccountTypeIn = (
|
|
312
|
+
const toLocationAccountTypeIn = (_36 = (_35 = params.toLocation) === null || _35 === void 0 ? void 0 : _35.accountType) === null || _36 === void 0 ? void 0 : _36.$in;
|
|
302
313
|
if (Array.isArray(toLocationAccountTypeIn)) {
|
|
303
314
|
andConditions.push({
|
|
304
315
|
'toLocation.accountType': {
|
|
@@ -307,7 +318,7 @@ class MongoRepository {
|
|
|
307
318
|
}
|
|
308
319
|
});
|
|
309
320
|
}
|
|
310
|
-
const purposeTypeOfIn = (
|
|
321
|
+
const purposeTypeOfIn = (_38 = (_37 = params.purpose) === null || _37 === void 0 ? void 0 : _37.typeOf) === null || _38 === void 0 ? void 0 : _38.$in;
|
|
311
322
|
if (Array.isArray(purposeTypeOfIn)) {
|
|
312
323
|
andConditions.push({
|
|
313
324
|
'purpose.typeOf': {
|
|
@@ -316,7 +327,7 @@ class MongoRepository {
|
|
|
316
327
|
}
|
|
317
328
|
});
|
|
318
329
|
}
|
|
319
|
-
const purposeIdIn = (
|
|
330
|
+
const purposeIdIn = (_40 = (_39 = params.purpose) === null || _39 === void 0 ? void 0 : _39.id) === null || _40 === void 0 ? void 0 : _40.$in;
|
|
320
331
|
if (Array.isArray(purposeIdIn)) {
|
|
321
332
|
andConditions.push({
|
|
322
333
|
'purpose.id': {
|
|
@@ -325,7 +336,7 @@ class MongoRepository {
|
|
|
325
336
|
}
|
|
326
337
|
});
|
|
327
338
|
}
|
|
328
|
-
const purposeOrderNumberIn = (
|
|
339
|
+
const purposeOrderNumberIn = (_42 = (_41 = params.purpose) === null || _41 === void 0 ? void 0 : _41.orderNumber) === null || _42 === void 0 ? void 0 : _42.$in;
|
|
329
340
|
if (Array.isArray(purposeOrderNumberIn)) {
|
|
330
341
|
andConditions.push({
|
|
331
342
|
'purpose.orderNumber': {
|
|
@@ -334,7 +345,7 @@ class MongoRepository {
|
|
|
334
345
|
}
|
|
335
346
|
});
|
|
336
347
|
}
|
|
337
|
-
const resultTypeOfIn = (
|
|
348
|
+
const resultTypeOfIn = (_44 = (_43 = params.result) === null || _43 === void 0 ? void 0 : _43.typeOf) === null || _44 === void 0 ? void 0 : _44.$in;
|
|
338
349
|
if (Array.isArray(resultTypeOfIn)) {
|
|
339
350
|
andConditions.push({
|
|
340
351
|
'result.typeOf': {
|
|
@@ -343,7 +354,7 @@ class MongoRepository {
|
|
|
343
354
|
}
|
|
344
355
|
});
|
|
345
356
|
}
|
|
346
|
-
const resultIdIn = (
|
|
357
|
+
const resultIdIn = (_46 = (_45 = params.result) === null || _45 === void 0 ? void 0 : _45.id) === null || _46 === void 0 ? void 0 : _46.$in;
|
|
347
358
|
if (Array.isArray(resultIdIn)) {
|
|
348
359
|
andConditions.push({
|
|
349
360
|
'result.id': {
|
|
@@ -352,7 +363,7 @@ class MongoRepository {
|
|
|
352
363
|
}
|
|
353
364
|
});
|
|
354
365
|
}
|
|
355
|
-
const resultOrderNumberIn = (
|
|
366
|
+
const resultOrderNumberIn = (_48 = (_47 = params.result) === null || _47 === void 0 ? void 0 : _47.orderNumber) === null || _48 === void 0 ? void 0 : _48.$in;
|
|
356
367
|
if (Array.isArray(resultOrderNumberIn)) {
|
|
357
368
|
andConditions.push({
|
|
358
369
|
'result.orderNumber': {
|
|
@@ -361,7 +372,7 @@ class MongoRepository {
|
|
|
361
372
|
}
|
|
362
373
|
});
|
|
363
374
|
}
|
|
364
|
-
const resultCodeIn = (
|
|
375
|
+
const resultCodeIn = (_50 = (_49 = params.result) === null || _49 === void 0 ? void 0 : _49.code) === null || _50 === void 0 ? void 0 : _50.$in;
|
|
365
376
|
if (Array.isArray(resultCodeIn)) {
|
|
366
377
|
andConditions.push({
|
|
367
378
|
'result.code': {
|