@chevre/domain 21.13.0-alpha.9 → 21.14.0
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/aggregateAllEvents.ts +2 -2
- package/example/src/chevre/aggregateAllEvents2.ts +1 -1
- package/example/src/chevre/aggregateEventReservation.ts +11 -11
- package/example/src/chevre/aggregateSellerPaymentAccepted.ts +1 -1
- package/example/src/chevre/aggregation/aggregateSystem.ts +20 -20
- package/example/src/chevre/attendIfNotAttended.ts +1 -1
- package/example/src/chevre/checkEventDuration.ts +59 -0
- package/example/src/chevre/cleanAccountingReports.ts +1 -1
- package/example/src/chevre/cleanActions.ts +1 -1
- package/example/src/chevre/deleteRunsAtPassedCertainPeriod.ts +1 -1
- package/example/src/chevre/deleteTasksByName.ts +1 -1
- package/example/src/chevre/findItemListElementByCatalogId.ts +1 -1
- package/example/src/chevre/giveUpStartDatePassedCertainPeriod.ts +1 -1
- package/example/src/chevre/importCategoryCodesFromCOA.ts +5 -4
- package/example/src/chevre/importEventsFromCOA.ts +11 -8
- package/example/src/chevre/importOffersFromCOA.ts +7 -6
- package/example/src/chevre/lockStockHolder.ts +1 -1
- package/example/src/chevre/migrateCategoryCodeAdditionalProperties.ts +2 -2
- package/example/src/chevre/migrateCognitoUser.ts +3 -3
- package/example/src/chevre/migrateIAMMemberMemberOf.ts +1 -1
- package/example/src/chevre/migrateMovieAvailabilityStarts.ts +1 -1
- package/example/src/chevre/migrateOrderPaymentMethodIdentifier.ts +3 -3
- package/example/src/chevre/migrateOwnershipInfos2newUserPool.ts +2 -2
- package/example/src/chevre/migratePayTransactionPaymentMethodId.ts +1 -1
- package/example/src/chevre/migratePayTransactionPaymentMethodIdentifier.ts +1 -1
- package/example/src/chevre/optimizeCatalogs.ts +1 -1
- package/example/src/chevre/ownershipInfosCsv2peopleJson.ts +3 -3
- package/example/src/chevre/person/globalSignOutAndDisable.ts +1 -1
- package/example/src/chevre/person/search.ts +3 -11
- package/example/src/chevre/person/updateProfile.ts +2 -2
- package/example/src/chevre/place/adminHasPOS.ts +1 -1
- package/example/src/chevre/pullAddOnsFromOffer.ts +1 -1
- package/example/src/chevre/pushIncludedInDataCatalog.ts +1 -1
- package/example/src/chevre/searchActions.ts +1 -1
- package/example/src/chevre/searchAggregateOffers.ts +1 -1
- package/example/src/chevre/searchAvaialbleAppliesToMovieTicketByOfferCatalogId.ts +5 -5
- package/example/src/chevre/searchEventIds.ts +1 -1
- package/example/src/chevre/searchEventSeats.ts +1 -1
- package/example/src/chevre/searchOfferCatalogItemAvailability.ts +5 -5
- package/example/src/chevre/searchOfferCatalogItems.ts +5 -5
- package/example/src/chevre/searchOffers.ts +2 -2
- package/example/src/chevre/searchPermissions.ts +3 -3
- package/example/src/chevre/searchProductOffers.ts +1 -1
- package/example/src/chevre/searchSellers.ts +2 -2
- package/lib/chevre/repo/creativeWork.js +17 -17
- package/lib/chevre/repo/event.d.ts +24 -7
- package/lib/chevre/repo/person.d.ts +6 -6
- package/lib/chevre/repo/person.js +12 -15
- package/lib/chevre/repo/place/hasPOS.d.ts +2 -2
- package/lib/chevre/repo/place.d.ts +11 -9
- package/lib/chevre/repo/place.js +44 -33
- package/lib/chevre/repo/priceSpecification.d.ts +0 -5
- package/lib/chevre/repo/priceSpecification.js +0 -9
- package/lib/chevre/repo/stockHolder.d.ts +0 -11
- package/lib/chevre/repo/stockHolder.js +11 -284
- package/lib/chevre/service/aggregation/event/aggregateUseActionsOnEvent.js +0 -7
- package/lib/chevre/service/assetTransaction/reserve.js +1 -1
- package/lib/chevre/service/event.js +2 -0
- package/lib/chevre/service/offer.d.ts +2 -4
- package/lib/chevre/service/offer.js +1 -1
- package/lib/chevre/service/task/onResourceUpdated/onHasPOSUpdated.d.ts +2 -0
- package/lib/chevre/service/task/onResourceUpdated/onHasPOSUpdated.js +8 -3
- package/lib/chevre/service/task/onResourceUpdated/onResourceDeleted.d.ts +2 -0
- package/lib/chevre/service/task/onResourceUpdated/onResourceDeleted.js +2 -0
- package/lib/chevre/service/task/onResourceUpdated.js +3 -1
- package/lib/chevre/service/transaction/placeOrderInProgress/result.js +4 -11
- package/package.json +7 -5
- package/example/src/chevre/csv2json.ts +0 -57
- package/example/src/chevre/deleteMovieTicketCategoryChargePriceSpecs.ts +0 -21
- package/example/src/chevre/person/createInformTask.ts +0 -77
- package/example/src/chevre/place/migrateHasPOS.ts +0 -76
|
@@ -9,8 +9,8 @@ const project = { typeOf: chevre.factory.organizationType.Project, id: String(pr
|
|
|
9
9
|
async function main() {
|
|
10
10
|
await mongoose.connect(<string>process.env.MONGOLAB_URI);
|
|
11
11
|
|
|
12
|
-
const eventRepo =
|
|
13
|
-
const taskRepo =
|
|
12
|
+
const eventRepo = await chevre.repository.Event.createInstance(mongoose.connection);
|
|
13
|
+
const taskRepo = await chevre.repository.Task.createInstance(mongoose.connection);
|
|
14
14
|
|
|
15
15
|
const now = new Date();
|
|
16
16
|
|
|
@@ -34,7 +34,7 @@ export async function aggregateScreeningEvent() {
|
|
|
34
34
|
|
|
35
35
|
try {
|
|
36
36
|
console.log('executing...', count);
|
|
37
|
-
await chevre.service.task.executeByName({
|
|
37
|
+
await (await chevre.service.task.createService()).executeByName({
|
|
38
38
|
name: chevre.factory.taskName.AggregateScreeningEvent
|
|
39
39
|
})({ connection: mongoose.connection, redisClient: redisClient });
|
|
40
40
|
console.log('executed', count);
|
|
@@ -18,19 +18,19 @@ async function main() {
|
|
|
18
18
|
await client.connect();
|
|
19
19
|
|
|
20
20
|
// const now = new Date();
|
|
21
|
-
await chevre.service.aggregation.event.aggregateScreeningEvent({
|
|
21
|
+
await (await chevre.service.aggregation.createService()).event.aggregateScreeningEvent({
|
|
22
22
|
id: String(process.env.EVENT_ID)
|
|
23
23
|
})({
|
|
24
|
-
event:
|
|
25
|
-
stockHolder:
|
|
26
|
-
offer:
|
|
27
|
-
offerCatalog:
|
|
28
|
-
offerRateLimit:
|
|
29
|
-
place:
|
|
30
|
-
product:
|
|
31
|
-
project:
|
|
32
|
-
reservation:
|
|
33
|
-
task:
|
|
24
|
+
event: await chevre.repository.Event.createInstance(mongoose.connection),
|
|
25
|
+
stockHolder: await chevre.repository.StockHolder.createInstance(client, mongoose.connection),
|
|
26
|
+
offer: await chevre.repository.Offer.createInstance(mongoose.connection),
|
|
27
|
+
offerCatalog: await chevre.repository.OfferCatalog.createInstance(mongoose.connection),
|
|
28
|
+
offerRateLimit: await chevre.repository.rateLimit.Offer.createInstance(client),
|
|
29
|
+
place: await chevre.repository.Place.createInstance(mongoose.connection),
|
|
30
|
+
product: await chevre.repository.Product.createInstance(mongoose.connection),
|
|
31
|
+
project: await chevre.repository.Project.createInstance(mongoose.connection),
|
|
32
|
+
reservation: await chevre.repository.Reservation.createInstance(mongoose.connection),
|
|
33
|
+
task: await chevre.repository.Task.createInstance(mongoose.connection)
|
|
34
34
|
});
|
|
35
35
|
}
|
|
36
36
|
|
|
@@ -9,7 +9,7 @@ const project = { typeOf: chevre.factory.organizationType.Project, id: String(pr
|
|
|
9
9
|
async function main() {
|
|
10
10
|
await mongoose.connect(<string>process.env.MONGOLAB_URI, { autoIndex: false });
|
|
11
11
|
|
|
12
|
-
const sellerRepo =
|
|
12
|
+
const sellerRepo = await chevre.repository.Seller.createInstance(mongoose.connection);
|
|
13
13
|
|
|
14
14
|
const paymentMethodTypes = await sellerRepo.searchPaymentAcceptedById({
|
|
15
15
|
limit: 100,
|
|
@@ -14,16 +14,16 @@ console.log('AGGREGATE_CLIENT_IDS:', AGGREGATE_CLIENT_IDS);
|
|
|
14
14
|
async function main() {
|
|
15
15
|
await mongoose.connect(<string>process.env.MONGOLAB_URI, { autoIndex: false });
|
|
16
16
|
|
|
17
|
-
const aggregationRepo =
|
|
18
|
-
const eventRepo =
|
|
19
|
-
const transactionRepo =
|
|
20
|
-
const assetTransactionRepo =
|
|
21
|
-
const actionRepo =
|
|
22
|
-
const taskRepo =
|
|
17
|
+
const aggregationRepo = await chevre.repository.Aggregation.createInstance(mongoose.connection);
|
|
18
|
+
const eventRepo = await chevre.repository.Event.createInstance(mongoose.connection);
|
|
19
|
+
const transactionRepo = await chevre.repository.Transaction.createInstance(mongoose.connection);
|
|
20
|
+
const assetTransactionRepo = await chevre.repository.AssetTransaction.createInstance(mongoose.connection);
|
|
21
|
+
const actionRepo = await chevre.repository.Action.createInstance(mongoose.connection);
|
|
22
|
+
const taskRepo = await chevre.repository.Task.createInstance(mongoose.connection);
|
|
23
23
|
|
|
24
24
|
let result: { aggregationCount: number; aggregateDuration: string };
|
|
25
25
|
|
|
26
|
-
result = await chevre.service.aggregation.system.aggregateReserveAction({
|
|
26
|
+
result = await (await chevre.service.aggregation.createService()).system.aggregateReserveAction({
|
|
27
27
|
aggregateDurationUnit: AGGREGATE_DURATION_UNIT,
|
|
28
28
|
aggregationCount: (AGGREGATE_DURATION_UNIT === 'hours') ? AGGREGATE_DAYS * ONE_DAY_IN_HOURS : AGGREGATE_DAYS,
|
|
29
29
|
excludedProjectId: EXCLUDED_PROJECT_ID
|
|
@@ -33,7 +33,7 @@ async function main() {
|
|
|
33
33
|
});
|
|
34
34
|
console.log('aggregateReserveAction processed.', result);
|
|
35
35
|
|
|
36
|
-
result = await chevre.service.aggregation.system.aggregateOrderAction({
|
|
36
|
+
result = await (await chevre.service.aggregation.createService()).system.aggregateOrderAction({
|
|
37
37
|
aggregateDurationUnit: AGGREGATE_DURATION_UNIT,
|
|
38
38
|
aggregationCount: (AGGREGATE_DURATION_UNIT === 'hours') ? AGGREGATE_DAYS * ONE_DAY_IN_HOURS : AGGREGATE_DAYS,
|
|
39
39
|
excludedProjectId: EXCLUDED_PROJECT_ID
|
|
@@ -43,7 +43,7 @@ async function main() {
|
|
|
43
43
|
});
|
|
44
44
|
console.log('aggregateReserveAction processed.', result);
|
|
45
45
|
|
|
46
|
-
result = await chevre.service.aggregation.system.aggregateCancelReservationAction({
|
|
46
|
+
result = await (await chevre.service.aggregation.createService()).system.aggregateCancelReservationAction({
|
|
47
47
|
aggregateDurationUnit: AGGREGATE_DURATION_UNIT,
|
|
48
48
|
aggregationCount: (AGGREGATE_DURATION_UNIT === 'hours') ? AGGREGATE_DAYS * ONE_DAY_IN_HOURS : AGGREGATE_DAYS,
|
|
49
49
|
excludedProjectId: EXCLUDED_PROJECT_ID
|
|
@@ -53,7 +53,7 @@ async function main() {
|
|
|
53
53
|
});
|
|
54
54
|
console.log('aggregateCancelReservationAction processed.', result);
|
|
55
55
|
|
|
56
|
-
result = await chevre.service.aggregation.system.aggregatePlaceOrder({
|
|
56
|
+
result = await (await chevre.service.aggregation.createService()).system.aggregatePlaceOrder({
|
|
57
57
|
aggregateDurationUnit: AGGREGATE_DURATION_UNIT,
|
|
58
58
|
aggregationCount: (AGGREGATE_DURATION_UNIT === 'hours') ? AGGREGATE_DAYS * ONE_DAY_IN_HOURS : AGGREGATE_DAYS,
|
|
59
59
|
excludedProjectId: EXCLUDED_PROJECT_ID,
|
|
@@ -65,7 +65,7 @@ async function main() {
|
|
|
65
65
|
console.log('aggregatePlaceOrder processed.', result);
|
|
66
66
|
// return;
|
|
67
67
|
|
|
68
|
-
result = await chevre.service.aggregation.system.aggregateTask({
|
|
68
|
+
result = await (await chevre.service.aggregation.createService()).system.aggregateTask({
|
|
69
69
|
aggregateDurationUnit: AGGREGATE_DURATION_UNIT,
|
|
70
70
|
aggregationCount: (AGGREGATE_DURATION_UNIT === 'hours') ? AGGREGATE_DAYS * ONE_DAY_IN_HOURS : AGGREGATE_DAYS,
|
|
71
71
|
excludedProjectId: EXCLUDED_PROJECT_ID
|
|
@@ -75,7 +75,7 @@ async function main() {
|
|
|
75
75
|
});
|
|
76
76
|
console.log('aggregateTask processed.', result);
|
|
77
77
|
|
|
78
|
-
result = await chevre.service.aggregation.system.aggregatePayMovieTicketAction({
|
|
78
|
+
result = await (await chevre.service.aggregation.createService()).system.aggregatePayMovieTicketAction({
|
|
79
79
|
aggregateDurationUnit: AGGREGATE_DURATION_UNIT,
|
|
80
80
|
aggregationCount: (AGGREGATE_DURATION_UNIT === 'hours') ? AGGREGATE_DAYS * ONE_DAY_IN_HOURS : AGGREGATE_DAYS,
|
|
81
81
|
excludedProjectId: EXCLUDED_PROJECT_ID
|
|
@@ -85,7 +85,7 @@ async function main() {
|
|
|
85
85
|
});
|
|
86
86
|
console.log('aggregatePayMovieTicketAction processed.', result);
|
|
87
87
|
|
|
88
|
-
result = await chevre.service.aggregation.system.aggregatePayTransaction({
|
|
88
|
+
result = await (await chevre.service.aggregation.createService()).system.aggregatePayTransaction({
|
|
89
89
|
aggregateDurationUnit: AGGREGATE_DURATION_UNIT,
|
|
90
90
|
aggregationCount: (AGGREGATE_DURATION_UNIT === 'hours') ? AGGREGATE_DAYS * ONE_DAY_IN_HOURS : AGGREGATE_DAYS,
|
|
91
91
|
excludedProjectId: EXCLUDED_PROJECT_ID
|
|
@@ -95,7 +95,7 @@ async function main() {
|
|
|
95
95
|
});
|
|
96
96
|
console.log('aggregatePayTransaction processed.', result);
|
|
97
97
|
|
|
98
|
-
result = await chevre.service.aggregation.system.aggregateEvent({
|
|
98
|
+
result = await (await chevre.service.aggregation.createService()).system.aggregateEvent({
|
|
99
99
|
aggregateDurationUnit: AGGREGATE_DURATION_UNIT,
|
|
100
100
|
aggregationCount: (AGGREGATE_DURATION_UNIT === 'hours') ? AGGREGATE_DAYS * ONE_DAY_IN_HOURS : AGGREGATE_DAYS,
|
|
101
101
|
excludedProjectId: EXCLUDED_PROJECT_ID
|
|
@@ -105,7 +105,7 @@ async function main() {
|
|
|
105
105
|
});
|
|
106
106
|
console.log('aggregateEvent processed.', result);
|
|
107
107
|
|
|
108
|
-
result = await chevre.service.aggregation.system.aggregateReserveTransaction({
|
|
108
|
+
result = await (await chevre.service.aggregation.createService()).system.aggregateReserveTransaction({
|
|
109
109
|
aggregateDurationUnit: AGGREGATE_DURATION_UNIT,
|
|
110
110
|
aggregationCount: (AGGREGATE_DURATION_UNIT === 'hours') ? AGGREGATE_DAYS * ONE_DAY_IN_HOURS : AGGREGATE_DAYS,
|
|
111
111
|
excludedProjectId: EXCLUDED_PROJECT_ID
|
|
@@ -115,7 +115,7 @@ async function main() {
|
|
|
115
115
|
});
|
|
116
116
|
console.log('aggregateReserveTransaction processed.', result);
|
|
117
117
|
|
|
118
|
-
result = await chevre.service.aggregation.system.aggregateAuthorizeOrderAction({
|
|
118
|
+
result = await (await chevre.service.aggregation.createService()).system.aggregateAuthorizeOrderAction({
|
|
119
119
|
aggregateDurationUnit: AGGREGATE_DURATION_UNIT,
|
|
120
120
|
aggregationCount: (AGGREGATE_DURATION_UNIT === 'hours') ? AGGREGATE_DAYS * ONE_DAY_IN_HOURS : AGGREGATE_DAYS,
|
|
121
121
|
excludedProjectId: EXCLUDED_PROJECT_ID
|
|
@@ -125,7 +125,7 @@ async function main() {
|
|
|
125
125
|
});
|
|
126
126
|
console.log('aggregateAuthorizeOrderAction processed.', result);
|
|
127
127
|
|
|
128
|
-
result = await chevre.service.aggregation.system.aggregateAuthorizeEventServiceOfferAction({
|
|
128
|
+
result = await (await chevre.service.aggregation.createService()).system.aggregateAuthorizeEventServiceOfferAction({
|
|
129
129
|
aggregateDurationUnit: AGGREGATE_DURATION_UNIT,
|
|
130
130
|
aggregationCount: (AGGREGATE_DURATION_UNIT === 'hours') ? AGGREGATE_DAYS * ONE_DAY_IN_HOURS : AGGREGATE_DAYS,
|
|
131
131
|
excludedProjectId: EXCLUDED_PROJECT_ID
|
|
@@ -135,7 +135,7 @@ async function main() {
|
|
|
135
135
|
});
|
|
136
136
|
console.log('aggregateAuthorizeEventServiceOfferAction processed.', result);
|
|
137
137
|
|
|
138
|
-
result = await chevre.service.aggregation.system.aggregateAuthorizePaymentAction({
|
|
138
|
+
result = await (await chevre.service.aggregation.createService()).system.aggregateAuthorizePaymentAction({
|
|
139
139
|
aggregateDurationUnit: AGGREGATE_DURATION_UNIT,
|
|
140
140
|
aggregationCount: (AGGREGATE_DURATION_UNIT === 'hours') ? AGGREGATE_DAYS * ONE_DAY_IN_HOURS : AGGREGATE_DAYS,
|
|
141
141
|
excludedProjectId: EXCLUDED_PROJECT_ID
|
|
@@ -145,7 +145,7 @@ async function main() {
|
|
|
145
145
|
});
|
|
146
146
|
console.log('aggregateAuthorizePaymentAction processed.', result);
|
|
147
147
|
|
|
148
|
-
result = await chevre.service.aggregation.system.aggregateUseAction({
|
|
148
|
+
result = await (await chevre.service.aggregation.createService()).system.aggregateUseAction({
|
|
149
149
|
aggregateDurationUnit: AGGREGATE_DURATION_UNIT,
|
|
150
150
|
aggregationCount: (AGGREGATE_DURATION_UNIT === 'hours') ? AGGREGATE_DAYS * ONE_DAY_IN_HOURS : AGGREGATE_DAYS,
|
|
151
151
|
excludedProjectId: EXCLUDED_PROJECT_ID
|
|
@@ -155,7 +155,7 @@ async function main() {
|
|
|
155
155
|
});
|
|
156
156
|
console.log('aggregateUseAction processed.', result);
|
|
157
157
|
|
|
158
|
-
result = await chevre.service.aggregation.system.aggregateCheckMovieTicketAction({
|
|
158
|
+
result = await (await chevre.service.aggregation.createService()).system.aggregateCheckMovieTicketAction({
|
|
159
159
|
aggregateDurationUnit: AGGREGATE_DURATION_UNIT,
|
|
160
160
|
aggregationCount: (AGGREGATE_DURATION_UNIT === 'hours') ? AGGREGATE_DAYS * ONE_DAY_IN_HOURS : AGGREGATE_DAYS,
|
|
161
161
|
excludedProjectId: EXCLUDED_PROJECT_ID
|
|
@@ -6,7 +6,7 @@ import { chevre } from '../../../lib/index';
|
|
|
6
6
|
async function main() {
|
|
7
7
|
await mongoose.connect(<string>process.env.MONGOLAB_URI);
|
|
8
8
|
|
|
9
|
-
const reservationRepo =
|
|
9
|
+
const reservationRepo = await chevre.repository.Reservation.createInstance(mongoose.connection);
|
|
10
10
|
|
|
11
11
|
const reservation = await reservationRepo.attendIfNotAttended(
|
|
12
12
|
{
|
|
@@ -0,0 +1,59 @@
|
|
|
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 = await chevre.repository.Event.createInstance(mongoose.connection);
|
|
15
|
+
|
|
16
|
+
const cursor = eventRepo.getCursor(
|
|
17
|
+
{
|
|
18
|
+
endDate: { $gte: new Date() },
|
|
19
|
+
typeOf: { $eq: chevre.factory.eventType.ScreeningEvent },
|
|
20
|
+
eventStatus: { $eq: chevre.factory.eventStatusType.EventScheduled }
|
|
21
|
+
// 'project.id': { $eq: project.id },
|
|
22
|
+
// 'project.id': { $ne: EXCLUDED_PROJECT_ID },
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
startDate: 1,
|
|
26
|
+
endDate: 1,
|
|
27
|
+
'project.id': 1,
|
|
28
|
+
_id: 1
|
|
29
|
+
}
|
|
30
|
+
);
|
|
31
|
+
console.log('events found');
|
|
32
|
+
|
|
33
|
+
let i = 0;
|
|
34
|
+
let numLongEvents = 0;
|
|
35
|
+
await cursor.eachAsync(async (doc) => {
|
|
36
|
+
i += 1;
|
|
37
|
+
const event: Pick<
|
|
38
|
+
chevre.factory.event.IEvent<chevre.factory.eventType.ScreeningEvent>,
|
|
39
|
+
'startDate' | 'endDate' | 'project' | 'id'
|
|
40
|
+
> = doc.toObject();
|
|
41
|
+
|
|
42
|
+
const endDateShouldBe = moment(event.startDate)
|
|
43
|
+
// tslint:disable-next-line:no-magic-numbers
|
|
44
|
+
.add(31, 'days');
|
|
45
|
+
// const duration = moment(event.endDate)
|
|
46
|
+
// .diff(moment(event.startDate));
|
|
47
|
+
if (moment(event.endDate)
|
|
48
|
+
.isAfter(endDateShouldBe)) {
|
|
49
|
+
numLongEvents += 1;
|
|
50
|
+
console.log(event.project.id, event.id, 'is long');
|
|
51
|
+
}
|
|
52
|
+
});
|
|
53
|
+
console.log(i, 'events checked');
|
|
54
|
+
console.log(numLongEvents, 'long events found');
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
main()
|
|
58
|
+
.then()
|
|
59
|
+
.catch(console.error);
|
|
@@ -10,7 +10,7 @@ import { chevre } from '../../../lib/index';
|
|
|
10
10
|
async function main() {
|
|
11
11
|
await mongoose.connect(<string>process.env.MONGOLAB_URI);
|
|
12
12
|
|
|
13
|
-
const accountingReportRepo =
|
|
13
|
+
const accountingReportRepo = await chevre.repository.AccountingReport.createInstance(mongoose.connection);
|
|
14
14
|
|
|
15
15
|
const cursor = await accountingReportRepo.accountingReportModel.find(
|
|
16
16
|
{
|
|
@@ -7,7 +7,7 @@ import { chevre } from '../../../lib/index';
|
|
|
7
7
|
async function main() {
|
|
8
8
|
await mongoose.connect(<string>process.env.MONGOLAB_URI, { autoIndex: false });
|
|
9
9
|
|
|
10
|
-
const actionRepo =
|
|
10
|
+
const actionRepo = await chevre.repository.Action.createInstance(mongoose.connection);
|
|
11
11
|
|
|
12
12
|
const result = await actionRepo.deleteStartDatePassedCertainPeriod({
|
|
13
13
|
$lt: moment()
|
|
@@ -10,7 +10,7 @@ async function main() {
|
|
|
10
10
|
const now = new Date();
|
|
11
11
|
await mongoose.connect(<string>process.env.MONGOLAB_URI, { autoIndex: false });
|
|
12
12
|
|
|
13
|
-
const taskRepo =
|
|
13
|
+
const taskRepo = await chevre.repository.Task.createInstance(mongoose.connection);
|
|
14
14
|
|
|
15
15
|
const result = await taskRepo.deleteRunsAtPassedCertainPeriod({
|
|
16
16
|
runsAt: {
|
|
@@ -9,7 +9,7 @@ import { chevre } from '../../../lib/index';
|
|
|
9
9
|
async function main() {
|
|
10
10
|
await mongoose.connect(<string>process.env.MONGOLAB_URI, { autoIndex: false });
|
|
11
11
|
|
|
12
|
-
const taskRepo =
|
|
12
|
+
const taskRepo = await chevre.repository.Task.createInstance(mongoose.connection);
|
|
13
13
|
|
|
14
14
|
const result = await taskRepo.deleteByName({
|
|
15
15
|
name: <any>'orderProgramMembership',
|
|
@@ -6,7 +6,7 @@ import { chevre } from '../../../lib/index';
|
|
|
6
6
|
async function main() {
|
|
7
7
|
await mongoose.connect(<string>process.env.MONGOLAB_URI, { autoIndex: false });
|
|
8
8
|
|
|
9
|
-
const offerCatalogRepo =
|
|
9
|
+
const offerCatalogRepo = await chevre.repository.OfferCatalog.createInstance(mongoose.connection);
|
|
10
10
|
|
|
11
11
|
const catalog = await offerCatalogRepo.findItemListElementById(
|
|
12
12
|
{
|
|
@@ -10,7 +10,7 @@ import { chevre } from '../../../lib/index';
|
|
|
10
10
|
async function main() {
|
|
11
11
|
await mongoose.connect(<string>process.env.MONGOLAB_URI);
|
|
12
12
|
|
|
13
|
-
const actionRepo =
|
|
13
|
+
const actionRepo = await chevre.repository.Action.createInstance(mongoose.connection);
|
|
14
14
|
const startLte = moment()
|
|
15
15
|
.add(-1, 'week')
|
|
16
16
|
.toDate();
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
// tslint:disable:no-console
|
|
2
|
+
import * as COA from '@motionpicture/coa-service';
|
|
2
3
|
// import * as redis from 'redis';
|
|
3
4
|
import * as mongoose from 'mongoose';
|
|
4
5
|
|
|
@@ -6,7 +7,7 @@ import { chevre } from '../../../lib/index';
|
|
|
6
7
|
|
|
7
8
|
const project = { id: String(process.env.PROJECT_ID) };
|
|
8
9
|
|
|
9
|
-
const coaAuthClient = new
|
|
10
|
+
const coaAuthClient = new COA.auth.RefreshToken({
|
|
10
11
|
endpoint: chevre.credentials.coa.endpoint,
|
|
11
12
|
refreshToken: chevre.credentials.coa.refreshToken
|
|
12
13
|
});
|
|
@@ -14,8 +15,8 @@ const coaAuthClient = new chevre.COA.auth.RefreshToken({
|
|
|
14
15
|
async function main() {
|
|
15
16
|
await mongoose.connect(<string>process.env.MONGOLAB_URI);
|
|
16
17
|
|
|
17
|
-
const categoryCodeRepo =
|
|
18
|
-
const masterService = new
|
|
18
|
+
const categoryCodeRepo = await chevre.repository.CategoryCode.createInstance(mongoose.connection);
|
|
19
|
+
const masterService = new COA.service.Master(
|
|
19
20
|
{
|
|
20
21
|
endpoint: chevre.credentials.coa.endpoint,
|
|
21
22
|
auth: coaAuthClient
|
|
@@ -23,7 +24,7 @@ async function main() {
|
|
|
23
24
|
{ timeout: chevre.credentials.coa.timeout }
|
|
24
25
|
);
|
|
25
26
|
|
|
26
|
-
await chevre.service.offer.event.importCategoryCodesFromCOA({
|
|
27
|
+
await (await chevre.service.offer.createService()).event.importCategoryCodesFromCOA({
|
|
27
28
|
project,
|
|
28
29
|
theaterCode: '120'
|
|
29
30
|
})({ categoryCode: categoryCodeRepo, masterService });
|
|
@@ -10,28 +10,31 @@ const project = { id: String(process.env.PROJECT_ID) };
|
|
|
10
10
|
async function main() {
|
|
11
11
|
await mongoose.connect(<string>process.env.MONGOLAB_URI, { autoIndex: false });
|
|
12
12
|
|
|
13
|
-
const actionRepo =
|
|
14
|
-
const categoryCodeRepo =
|
|
15
|
-
const
|
|
16
|
-
const
|
|
17
|
-
const
|
|
13
|
+
const actionRepo = await chevre.repository.Action.createInstance(mongoose.connection);
|
|
14
|
+
const categoryCodeRepo = await chevre.repository.CategoryCode.createInstance(mongoose.connection);
|
|
15
|
+
const creativeWorkRepo = await chevre.repository.CreativeWork.createInstance(mongoose.connection);
|
|
16
|
+
const eventRepo = await chevre.repository.Event.createInstance(mongoose.connection);
|
|
17
|
+
const placeRepo = await chevre.repository.Place.createInstance(mongoose.connection);
|
|
18
|
+
const sellerRepo = await chevre.repository.Seller.createInstance(mongoose.connection);
|
|
18
19
|
|
|
19
|
-
await chevre.service.event.importFromCOA({
|
|
20
|
+
await (await chevre.service.event.createService()).importFromCOA({
|
|
20
21
|
project: {
|
|
21
22
|
id: project.id,
|
|
22
23
|
typeOf: chevre.factory.organizationType.Project
|
|
23
24
|
},
|
|
24
|
-
locationBranchCode: '
|
|
25
|
+
locationBranchCode: '120',
|
|
25
26
|
importFrom: moment()
|
|
26
27
|
.toDate(),
|
|
27
28
|
importThrough: moment()
|
|
28
29
|
.add(1, 'day')
|
|
29
30
|
.toDate(),
|
|
30
31
|
saveMovieTheater: false,
|
|
31
|
-
saveScreeningEventSeries:
|
|
32
|
+
saveScreeningEventSeries: true,
|
|
33
|
+
saveScreeningEventSeriesPeriodInMonth: 24
|
|
32
34
|
})({
|
|
33
35
|
action: actionRepo,
|
|
34
36
|
categoryCode: categoryCodeRepo,
|
|
37
|
+
creativeWork: creativeWorkRepo,
|
|
35
38
|
event: eventRepo,
|
|
36
39
|
place: placeRepo,
|
|
37
40
|
seller: sellerRepo
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
// tslint:disable:no-console
|
|
2
2
|
// import * as redis from 'redis';
|
|
3
|
+
import * as COA from '@motionpicture/coa-service';
|
|
3
4
|
import * as mongoose from 'mongoose';
|
|
4
5
|
|
|
5
6
|
import { chevre } from '../../../lib/index';
|
|
6
7
|
|
|
7
8
|
const project = { id: String(process.env.PROJECT_ID) };
|
|
8
9
|
|
|
9
|
-
const coaAuthClient = new
|
|
10
|
+
const coaAuthClient = new COA.auth.RefreshToken({
|
|
10
11
|
endpoint: chevre.credentials.coa.endpoint,
|
|
11
12
|
refreshToken: chevre.credentials.coa.refreshToken
|
|
12
13
|
});
|
|
@@ -14,10 +15,10 @@ const coaAuthClient = new chevre.COA.auth.RefreshToken({
|
|
|
14
15
|
async function main() {
|
|
15
16
|
await mongoose.connect(<string>process.env.MONGOLAB_URI);
|
|
16
17
|
|
|
17
|
-
const categoryCodeRepo =
|
|
18
|
-
const offerRepo =
|
|
19
|
-
const taskRepo =
|
|
20
|
-
const masterService = new
|
|
18
|
+
const categoryCodeRepo = await chevre.repository.CategoryCode.createInstance(mongoose.connection);
|
|
19
|
+
const offerRepo = await chevre.repository.Offer.createInstance(mongoose.connection);
|
|
20
|
+
const taskRepo = await chevre.repository.Task.createInstance(mongoose.connection);
|
|
21
|
+
const masterService = new COA.service.Master(
|
|
21
22
|
{
|
|
22
23
|
endpoint: chevre.credentials.coa.endpoint,
|
|
23
24
|
auth: coaAuthClient
|
|
@@ -25,7 +26,7 @@ async function main() {
|
|
|
25
26
|
{ timeout: chevre.credentials.coa.timeout }
|
|
26
27
|
);
|
|
27
28
|
|
|
28
|
-
await chevre.service.offer.event.importFromCOA({
|
|
29
|
+
await (await chevre.service.offer.createService()).event.importFromCOA({
|
|
29
30
|
project,
|
|
30
31
|
theaterCode: '120'
|
|
31
32
|
})({
|
|
@@ -20,7 +20,7 @@ async function main() {
|
|
|
20
20
|
|
|
21
21
|
const startDate = moment('2023-04-18T00:00:00Z');
|
|
22
22
|
|
|
23
|
-
const stockHolderRepo =
|
|
23
|
+
const stockHolderRepo = await chevre.repository.StockHolder.createInstance(client, mongoose.connection);
|
|
24
24
|
await stockHolderRepo.lock({
|
|
25
25
|
project,
|
|
26
26
|
eventId: 'sampleEventId',
|
|
@@ -11,8 +11,8 @@ import { chevre } from '../../../lib/index';
|
|
|
11
11
|
async function main() {
|
|
12
12
|
await mongoose.connect(<string>process.env.MONGOLAB_URI, { autoIndex: false });
|
|
13
13
|
|
|
14
|
-
const additionalPropertyRepo =
|
|
15
|
-
const categoryCodeRepo =
|
|
14
|
+
const additionalPropertyRepo = await chevre.repository.AdditionalProperty.createInstance(mongoose.connection);
|
|
15
|
+
const categoryCodeRepo = await chevre.repository.CategoryCode.createInstance(mongoose.connection);
|
|
16
16
|
|
|
17
17
|
const cursor = categoryCodeRepo.getCursor(
|
|
18
18
|
{
|
|
@@ -13,7 +13,7 @@ export async function migrateUser(params: {
|
|
|
13
13
|
let oldPerson: chevre.factory.person.IPerson | undefined;
|
|
14
14
|
|
|
15
15
|
try {
|
|
16
|
-
const oldPersonRepo =
|
|
16
|
+
const oldPersonRepo = await chevre.repository.Person.createInstance({ userPoolId: USERPOOL_ID_OLD });
|
|
17
17
|
oldPerson = await oldPersonRepo.findById({ userId: params.id });
|
|
18
18
|
console.log('oldPerson found', oldPerson.id, oldPerson.givenName, oldPerson.familyName);
|
|
19
19
|
} catch (error) {
|
|
@@ -33,7 +33,7 @@ export async function migrateUser(params: {
|
|
|
33
33
|
}
|
|
34
34
|
|
|
35
35
|
// create user
|
|
36
|
-
const newPersonRepo =
|
|
36
|
+
const newPersonRepo = await chevre.repository.Person.createInstance({ userPoolId: USERPOOL_ID_NEW });
|
|
37
37
|
const newUsername = `${NEW_USERPOOL_PROVIDER_NAME}_${oldPerson.id}`;
|
|
38
38
|
const newUserId = await new Promise<string>((resolve, reject) => {
|
|
39
39
|
newPersonRepo.cognitoIdentityServiceProvider.adminCreateUser(
|
|
@@ -60,7 +60,7 @@ export async function migrateUser(params: {
|
|
|
60
60
|
console.error('user not created.', err);
|
|
61
61
|
reject(err);
|
|
62
62
|
} else {
|
|
63
|
-
resolve(String(data
|
|
63
|
+
resolve(String(data?.User?.Attributes?.find((a) => a.Name === 'sub')?.Value));
|
|
64
64
|
}
|
|
65
65
|
}
|
|
66
66
|
);
|
|
@@ -11,7 +11,7 @@ import { chevre } from '../../../lib/index';
|
|
|
11
11
|
async function main() {
|
|
12
12
|
await mongoose.connect(<string>process.env.MONGOLAB_URI, { autoIndex: false });
|
|
13
13
|
|
|
14
|
-
const memberRepo =
|
|
14
|
+
const memberRepo = await chevre.repository.Member.createInstance(mongoose.connection);
|
|
15
15
|
|
|
16
16
|
const cursor = memberRepo.getCursor(
|
|
17
17
|
{},
|
|
@@ -11,7 +11,7 @@ import { chevre } from '../../../lib/index';
|
|
|
11
11
|
async function main() {
|
|
12
12
|
await mongoose.connect(<string>process.env.MONGOLAB_URI, { autoIndex: false });
|
|
13
13
|
|
|
14
|
-
const creativeWorkRepo =
|
|
14
|
+
const creativeWorkRepo = await chevre.repository.CreativeWork.createInstance(mongoose.connection);
|
|
15
15
|
|
|
16
16
|
const cursor = creativeWorkRepo.getCursor(
|
|
17
17
|
{
|
|
@@ -10,7 +10,7 @@ import { chevre } from '../../../lib/index';
|
|
|
10
10
|
async function main() {
|
|
11
11
|
await mongoose.connect(<string>process.env.MONGOLAB_URI, { autoIndex: false });
|
|
12
12
|
|
|
13
|
-
const orderRepo =
|
|
13
|
+
const orderRepo = await chevre.repository.Order.createInstance(mongoose.connection);
|
|
14
14
|
|
|
15
15
|
const cursor = orderRepo.getCursor(
|
|
16
16
|
{
|
|
@@ -48,7 +48,7 @@ async function main() {
|
|
|
48
48
|
const noPayment = order.paymentMethods.length === 0;
|
|
49
49
|
const alreadyMigrated = order.paymentMethods.every((invoice) => {
|
|
50
50
|
return typeof invoice.paymentMethod?.identifier === 'string'
|
|
51
|
-
&& invoice.paymentMethod.identifier === invoice.typeOf;
|
|
51
|
+
&& invoice.paymentMethod.identifier === (<any>invoice).typeOf;
|
|
52
52
|
});
|
|
53
53
|
|
|
54
54
|
if (noPayment) {
|
|
@@ -63,7 +63,7 @@ async function main() {
|
|
|
63
63
|
orderNumber: order.orderNumber,
|
|
64
64
|
invoice: {
|
|
65
65
|
paymentMethodId: invoice.paymentMethodId,
|
|
66
|
-
paymentMethod: { identifier: invoice.typeOf }
|
|
66
|
+
paymentMethod: { identifier: (<any>invoice).typeOf }
|
|
67
67
|
}
|
|
68
68
|
});
|
|
69
69
|
}
|
|
@@ -16,7 +16,7 @@ const PRODUCT_TYPE = chevre.factory.product.ProductType.EventService;
|
|
|
16
16
|
async function main() {
|
|
17
17
|
await mongoose.connect(<string>process.env.MONGOLAB_URI);
|
|
18
18
|
|
|
19
|
-
const ownershipInfoRepo =
|
|
19
|
+
const ownershipInfoRepo = await chevre.repository.OwnershipInfo.createInstance(mongoose.connection);
|
|
20
20
|
|
|
21
21
|
const now = new Date();
|
|
22
22
|
const cursor = ownershipInfoRepo.getCursor(
|
|
@@ -78,7 +78,7 @@ async function main() {
|
|
|
78
78
|
ownershipInfo.typeOfGood.identifier,
|
|
79
79
|
ownershipInfo.ownedFrom,
|
|
80
80
|
owner.id, owner.memberOf?.membershipNumber, i, notFoundCount);
|
|
81
|
-
const personRepo =
|
|
81
|
+
const personRepo = await chevre.repository.Person.createInstance({ userPoolId: USERPOOL_ID_NEW });
|
|
82
82
|
|
|
83
83
|
try {
|
|
84
84
|
const newUserAttributes = await personRepo.getUserAttributes({ username: `SSKTS_${owner.id}` });
|
|
@@ -10,7 +10,7 @@ import { chevre } from '../../../lib/index';
|
|
|
10
10
|
async function main() {
|
|
11
11
|
await mongoose.connect(<string>process.env.MONGOLAB_URI, { autoIndex: false });
|
|
12
12
|
|
|
13
|
-
const assetTransactionRepo =
|
|
13
|
+
const assetTransactionRepo = await chevre.repository.AssetTransaction.createInstance(mongoose.connection);
|
|
14
14
|
|
|
15
15
|
const cursor = assetTransactionRepo.getCursor(
|
|
16
16
|
{
|
|
@@ -10,7 +10,7 @@ import { chevre } from '../../../lib/index';
|
|
|
10
10
|
async function main() {
|
|
11
11
|
await mongoose.connect(<string>process.env.MONGOLAB_URI, { autoIndex: false });
|
|
12
12
|
|
|
13
|
-
const assetTransactionRepo =
|
|
13
|
+
const assetTransactionRepo = await chevre.repository.AssetTransaction.createInstance(mongoose.connection);
|
|
14
14
|
|
|
15
15
|
const cursor = assetTransactionRepo.getCursor(
|
|
16
16
|
{
|
|
@@ -9,7 +9,7 @@ import { chevre } from '../../../lib/index';
|
|
|
9
9
|
async function main() {
|
|
10
10
|
await mongoose.connect(<string>process.env.MONGOLAB_URI, { autoIndex: false });
|
|
11
11
|
|
|
12
|
-
const offerCatalogRepo =
|
|
12
|
+
const offerCatalogRepo = await chevre.repository.OfferCatalog.createInstance(mongoose.connection);
|
|
13
13
|
|
|
14
14
|
const cursor = offerCatalogRepo.getCursor(
|
|
15
15
|
{
|
|
@@ -32,10 +32,10 @@ async function main() {
|
|
|
32
32
|
autoIndex: false
|
|
33
33
|
});
|
|
34
34
|
|
|
35
|
-
const sellerRepo =
|
|
35
|
+
const sellerRepo = await chevre.repository.Seller.createInstance(mongoose.connection);
|
|
36
36
|
const sellers = <Pick<chevre.factory.seller.ISeller, 'id' | 'name'>[]>await sellerRepo.search({}, ['_id', 'name'], []);
|
|
37
37
|
|
|
38
|
-
const personRepo =
|
|
38
|
+
const personRepo = await chevre.repository.Person.createInstance({
|
|
39
39
|
userPoolId: <string>process.env.COGNITO_USER_POOL_ID
|
|
40
40
|
});
|
|
41
41
|
|
|
@@ -132,7 +132,7 @@ function findAccount(params: {
|
|
|
132
132
|
now: Date;
|
|
133
133
|
}) {
|
|
134
134
|
return async (): Promise<chevre.factory.ownershipInfo.IPermitAsGood | undefined> => {
|
|
135
|
-
const ownershipInfoRepo =
|
|
135
|
+
const ownershipInfoRepo = await chevre.repository.OwnershipInfo.createInstance(mongoose.connection);
|
|
136
136
|
|
|
137
137
|
// let accountOwnershipInfos = await search({
|
|
138
138
|
// project: { typeOf: factory.organizationType.Project, id: params.project.id },
|