@chevre/domain 20.1.0-alpha.2 → 20.1.0-alpha.21
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/migrateEventSeriesAdditionalProperties.ts +96 -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/additionalProperty.d.ts +35 -0
- package/lib/chevre/repo/additionalProperty.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/additionalProperty.d.ts +7 -0
- package/lib/chevre/repo/mongoose/model/additionalProperty.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,96 @@
|
|
|
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
|
+
const additionalPropertyRepo = new chevre.repository.AdditionalProperty(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.ScreeningEventSeries }
|
|
22
|
+
// typeOf: { $eq: chevre.factory.eventType.ScreeningEvent },
|
|
23
|
+
// startDate: {
|
|
24
|
+
// $gte: moment()
|
|
25
|
+
// .add(-1, 'month')
|
|
26
|
+
// .toDate()
|
|
27
|
+
// }
|
|
28
|
+
// _id: { $eq: 'al6aff83w' }
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
// _id: 1,
|
|
32
|
+
}
|
|
33
|
+
);
|
|
34
|
+
console.log('events found');
|
|
35
|
+
|
|
36
|
+
const additionalPropertyNames: string[] = [];
|
|
37
|
+
const projectIds: string[] = [];
|
|
38
|
+
|
|
39
|
+
let i = 0;
|
|
40
|
+
let updateCount = 0;
|
|
41
|
+
await cursor.eachAsync(async (doc) => {
|
|
42
|
+
i += 1;
|
|
43
|
+
const event: chevre.factory.event.screeningEventSeries.IEvent = doc.toObject();
|
|
44
|
+
|
|
45
|
+
const additionalPropertyNamesOnEvent = event.additionalProperty?.map((p) => p.name);
|
|
46
|
+
if (Array.isArray(additionalPropertyNamesOnEvent) && additionalPropertyNamesOnEvent.length > 0) {
|
|
47
|
+
console.log(additionalPropertyNamesOnEvent.length, 'additionalPropertyNamesOnEvent found', event.project.id);
|
|
48
|
+
additionalPropertyNames.push(...additionalPropertyNamesOnEvent);
|
|
49
|
+
projectIds.push(event.project.id);
|
|
50
|
+
additionalPropertyNamesOnEvent.forEach((name) => {
|
|
51
|
+
if (!name.match(/^[a-zA-Z]*$/)) {
|
|
52
|
+
throw new Error(`not matched ${event.project.id} ${event.id}`);
|
|
53
|
+
}
|
|
54
|
+
// tslint:disable-next-line:no-magic-numbers
|
|
55
|
+
if (name.length < 8) {
|
|
56
|
+
throw new Error(`length matched ${event.project.id} ${event.id} ${name}`);
|
|
57
|
+
}
|
|
58
|
+
});
|
|
59
|
+
|
|
60
|
+
for (const additionalPropertyNameOnEvent of additionalPropertyNamesOnEvent) {
|
|
61
|
+
const existings = await additionalPropertyRepo.search({
|
|
62
|
+
project: { id: { $eq: event.project.id } },
|
|
63
|
+
limit: 1,
|
|
64
|
+
page: 1,
|
|
65
|
+
name: { $regex: `^${additionalPropertyNameOnEvent}$` }
|
|
66
|
+
});
|
|
67
|
+
if (existings.length > 0) {
|
|
68
|
+
console.log('already existed', additionalPropertyNameOnEvent, event.id, event.project.id);
|
|
69
|
+
} else {
|
|
70
|
+
updateCount += 1;
|
|
71
|
+
await additionalPropertyRepo.save({
|
|
72
|
+
attributes: {
|
|
73
|
+
project: event.project,
|
|
74
|
+
typeOf: 'CategoryCode',
|
|
75
|
+
codeValue: additionalPropertyNameOnEvent,
|
|
76
|
+
inCodeSet: {
|
|
77
|
+
typeOf: 'CategoryCodeSet',
|
|
78
|
+
identifier: <any>event.typeOf
|
|
79
|
+
},
|
|
80
|
+
name: { ja: additionalPropertyNameOnEvent }
|
|
81
|
+
}
|
|
82
|
+
});
|
|
83
|
+
console.log('created', additionalPropertyNameOnEvent, event.id, event.project.id);
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
});
|
|
88
|
+
console.log(i, 'events checked');
|
|
89
|
+
console.log(updateCount, 'events updated');
|
|
90
|
+
console.log([...new Set(additionalPropertyNames)]);
|
|
91
|
+
console.log([...new Set(projectIds)]);
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
main()
|
|
95
|
+
.then()
|
|
96
|
+
.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);
|