@chevre/domain 23.2.0 → 24.0.0-alpha.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/lib/chevre/index.d.ts +2 -1
- package/lib/chevre/index.js +3 -1
- package/lib/chevre/repo/assetTransaction.d.ts +1 -1
- package/lib/chevre/repo/identityProvider.d.ts +4 -4
- package/lib/chevre/repo/potentialAction.d.ts +4 -4
- package/lib/chevre/repo/seller.d.ts +8 -8
- package/lib/chevre/repo/task.d.ts +25 -28
- package/lib/chevre/repo/transaction.d.ts +5 -5
- package/lib/chevre/service/assetTransaction/reserve/start/createSubReservations.js +3 -2
- package/lib/chevre/service/assetTransaction/reserve/start/factory/addOffers2seat.d.ts +14 -0
- package/lib/chevre/service/assetTransaction/reserve/start/factory/addOffers2seat.js +63 -0
- package/lib/chevre/service/assetTransaction/reserve/start.js +2 -2
- package/lib/chevre/service/offer.d.ts +0 -12
- package/lib/chevre/service/offer.js +0 -37
- package/lib/chevre/service/task.d.ts +1 -1
- package/lib/chevre/service/taskHandler/onOperationFailed/informTaskIfNeeded.d.ts +2 -1
- package/lib/chevre/service/taskHandler/onOperationFailed.d.ts +2 -1
- package/lib/chevre/service/taskHandler.d.ts +2 -20
- package/lib/chevre/settings.d.ts +1 -2
- package/lib/chevre/settings.js +1 -3
- package/lib/chevre/taskSettings.d.ts +58 -0
- package/package.json +14 -16
- package/example/src/chevre/acceptedPaymentMethodOffer/adminAcceptedPaymentMethodOffers.ts +0 -76
- package/example/src/chevre/actions/checkAcceptPayActions.ts +0 -60
- package/example/src/chevre/actions/checkAuthorizePaymentActions.ts +0 -55
- package/example/src/chevre/activateOptionalAggregationSettings.ts +0 -19
- package/example/src/chevre/adminIdentities.ts +0 -71
- package/example/src/chevre/aggreateOwnershipInfosByOrder.ts +0 -24
- package/example/src/chevre/aggregateEventPublicFields.ts +0 -47
- package/example/src/chevre/aggregateOfferCatalogItemList.ts +0 -36
- package/example/src/chevre/aggregateScreeningEventMaxVersion.ts +0 -36
- package/example/src/chevre/aggregation/aggregateOffersOnEvent.ts +0 -86
- package/example/src/chevre/aggregation/aggregateOrderOfCustomer.ts +0 -138
- package/example/src/chevre/aggregation/aggregateOrderOfCustomerGlobally.ts +0 -34
- package/example/src/chevre/aggregation/aggregateOrderOfSeatByRoyalCustomers.ts +0 -172
- package/example/src/chevre/aggregation/aggregateOrderOnSystem.ts +0 -40
- package/example/src/chevre/aggregation/aggregateReservationByProject.ts +0 -79
- package/example/src/chevre/aggregation/aggregateSystem.ts +0 -201
- package/example/src/chevre/aggregation/aggregateTasks.ts +0 -41
- package/example/src/chevre/aggregation/createAggregateEventTasks.ts +0 -71
- package/example/src/chevre/aggregation/searchAggregateReservations.ts +0 -33
- package/example/src/chevre/assetTransaction/checkPayTransactionsTicketToken.ts +0 -67
- package/example/src/chevre/assetTransaction/processReserve.ts +0 -149
- package/example/src/chevre/attendIfNotAttended.ts +0 -31
- package/example/src/chevre/authorizeEventServiceOffer.ts +0 -122
- package/example/src/chevre/categoryCode/checkUniqueness.ts +0 -69
- package/example/src/chevre/changeOrderStatus.ts +0 -29
- package/example/src/chevre/checkCustomerAttributesLength.ts +0 -109
- package/example/src/chevre/checkEventDuration.ts +0 -59
- package/example/src/chevre/checkPaymentServiceUniqueness.ts +0 -79
- package/example/src/chevre/checkProjectMembers.ts +0 -55
- package/example/src/chevre/checkReserveTransactionSizes.ts +0 -46
- package/example/src/chevre/cleanActions.ts +0 -23
- package/example/src/chevre/cleanReservations.ts +0 -69
- package/example/src/chevre/cleanTransactions.ts +0 -39
- package/example/src/chevre/concurrentLock/lockOfferRateLimit.ts +0 -64
- package/example/src/chevre/concurrentLock/lockTransactionProcess.ts +0 -44
- package/example/src/chevre/confirmationNumber/testRandomness.ts +0 -49
- package/example/src/chevre/countPotentiallyExportTasks.ts +0 -42
- package/example/src/chevre/countTransactions.ts +0 -30
- package/example/src/chevre/createProject.ts +0 -19
- package/example/src/chevre/createTaskIfNotExistByAlternateName.ts +0 -57
- package/example/src/chevre/db/stats.ts +0 -35
- package/example/src/chevre/deleteDiscontinuedPeople.ts +0 -153
- package/example/src/chevre/deleteDiscontinuedPeopleByFetch.ts +0 -38
- package/example/src/chevre/deleteOwnershipInfosByOwnedThrough.ts +0 -79
- package/example/src/chevre/deleteStartDatePassedCertainPeriod.ts +0 -27
- package/example/src/chevre/deleteTasksByName.ts +0 -30
- package/example/src/chevre/emailMessage/createEmailMessageText.ts +0 -63
- package/example/src/chevre/event/checkEventAdditionalPropertyUniqueness.ts +0 -108
- package/example/src/chevre/event/importEventSeriesFromCOAByTitle.ts +0 -83
- package/example/src/chevre/event/importEventsFromCOAByTitle.ts +0 -148
- package/example/src/chevre/event/migrateEventAdditionalProperty2identifier.ts +0 -121
- package/example/src/chevre/event/migrateEventMaximumPhysicalAttendeeCapacity.ts +0 -76
- package/example/src/chevre/event/unsetSuperEventVideoFormat.ts +0 -30
- package/example/src/chevre/event/updateSellerMakesOffersByIdentifier.ts +0 -106
- package/example/src/chevre/eventSeries/unsetVideoFormat.ts +0 -31
- package/example/src/chevre/eventSeries/upsertScreeningEventSeriesByVersion.ts +0 -106
- package/example/src/chevre/findAnyEventById.ts +0 -24
- package/example/src/chevre/findAuthorizePaymentAction.ts +0 -34
- package/example/src/chevre/findAvailableChannelMovieTicket.ts +0 -25
- package/example/src/chevre/findCheckAction.ts +0 -34
- package/example/src/chevre/findCustomerByOrderNumber.ts +0 -19
- package/example/src/chevre/findItemListElementByCatalogId.ts +0 -30
- package/example/src/chevre/findItemListElementById.ts +0 -23
- package/example/src/chevre/findJWTSetting.ts +0 -19
- package/example/src/chevre/findOneAvailableHours.ts +0 -39
- package/example/src/chevre/findReservationByCode.ts +0 -64
- package/example/src/chevre/findSchedule.ts +0 -43
- package/example/src/chevre/giveUpStartDatePassedCertainPeriod.ts +0 -56
- package/example/src/chevre/identity/getCommonClients.ts +0 -126
- package/example/src/chevre/identity/migrateClients2oauth.ts +0 -200
- package/example/src/chevre/importCategoryCodesFromCOA.ts +0 -34
- package/example/src/chevre/importEventsFromCOA.ts +0 -66
- package/example/src/chevre/investigateEvents.ts +0 -86
- package/example/src/chevre/investigateTransaction.ts +0 -66
- package/example/src/chevre/isPaymentAcceptedBySeller.ts +0 -24
- package/example/src/chevre/issuer/adminMemberProgramTiers.ts +0 -55
- package/example/src/chevre/issuer/migrateIssuerUrls.ts +0 -62
- package/example/src/chevre/issuer/renameIssuerIdentifier.ts +0 -61
- package/example/src/chevre/maintenance/checkTransactionStatuses.ts +0 -105
- package/example/src/chevre/makeExpiredManyTasks.ts +0 -27
- package/example/src/chevre/makeTransactionExpired.ts +0 -28
- package/example/src/chevre/member/migrateMemberIdentifier.ts +0 -99
- package/example/src/chevre/migrateAuthorizeEventServiceOfferChevre.ts +0 -84
- package/example/src/chevre/migrateCancelReservationObject.ts +0 -71
- package/example/src/chevre/migrateCognitoUser.ts +0 -153
- package/example/src/chevre/migrateCustomerAdditionalProperties.ts +0 -116
- package/example/src/chevre/migrateEventSellerMakesOfferAvailableAt.ts +0 -101
- package/example/src/chevre/migrateIdentities.ts +0 -69
- package/example/src/chevre/migrateProjectSettings.ts +0 -64
- package/example/src/chevre/migrateRoomAdditionalProperties.ts +0 -118
- package/example/src/chevre/migrateRoomSectionAdditionalProperties.ts +0 -121
- package/example/src/chevre/note/findNotes.ts +0 -34
- package/example/src/chevre/note/upsertNotesByIdentifier.ts +0 -63
- package/example/src/chevre/notifyAbortedTasksByEmail.ts +0 -56
- package/example/src/chevre/notifyByEmail.ts +0 -43
- package/example/src/chevre/offerCatalog/updateManyOfferCatalogsByIds.ts +0 -49
- package/example/src/chevre/offerCatalog/upsertOfferCatalogItemsByIdentifier.ts +0 -49
- package/example/src/chevre/offerCatalog/upsertOfferCatalogsByIdentifier.ts +0 -51
- package/example/src/chevre/offers/checkIncludedInCatalogCount.ts +0 -47
- package/example/src/chevre/offers/projectItemListElement.ts +0 -54
- package/example/src/chevre/offers/searchAvaialbleAppliesToMovieTicketByOfferCatalogId.ts +0 -51
- package/example/src/chevre/offers/searchByOfferCatalogIdWithSortIndex.ts +0 -44
- package/example/src/chevre/offers/searchOfferCatalogItemAvailability.ts +0 -68
- package/example/src/chevre/offers/upsertOffersByIdentifier.ts +0 -63
- package/example/src/chevre/optimizeActions.ts +0 -61
- package/example/src/chevre/orderNumber/testRandomness.ts +0 -54
- package/example/src/chevre/orders/searchOrders.ts +0 -28
- package/example/src/chevre/orders/searchWithUnwoundAcceptedOffers.ts +0 -73
- package/example/src/chevre/paymentServices/findPaymentServices.ts +0 -37
- package/example/src/chevre/pendingReservation/findEventSeatOffersBySection.ts +0 -46
- package/example/src/chevre/person/checkUserPoolClients.ts +0 -120
- package/example/src/chevre/person/cleanUpCognitoUsers.ts +0 -140
- package/example/src/chevre/person/cleanUpCognitoUsersByFetch.ts +0 -162
- package/example/src/chevre/person/cleanUpCreditCard.ts +0 -113
- package/example/src/chevre/person/updateProfile.ts +0 -56
- package/example/src/chevre/place/adminEntranceGates.ts +0 -69
- package/example/src/chevre/place/adminHasPOS.ts +0 -44
- package/example/src/chevre/place/aggregateSeatingTypes.ts +0 -29
- package/example/src/chevre/place/checkEntranceGatesCount.ts +0 -82
- package/example/src/chevre/place/checkSectionCount.ts +0 -27
- package/example/src/chevre/place/findRooms.ts +0 -24
- package/example/src/chevre/place/findSections.ts +0 -28
- package/example/src/chevre/place/findSectionsByRoom.ts +0 -50
- package/example/src/chevre/place/migrateSectionIdentifier.ts +0 -92
- package/example/src/chevre/place/seatsJson2csv.ts +0 -63
- package/example/src/chevre/place/upsertMovieTheatersByBranchCode.ts +0 -41
- package/example/src/chevre/place/upsertRoomsByBranchCode.ts +0 -40
- package/example/src/chevre/place/upsertSeatSectionsByBranchCode.ts +0 -56
- package/example/src/chevre/processAction.ts +0 -44
- package/example/src/chevre/processOrder.ts +0 -90
- package/example/src/chevre/product/findHasOfferCatalog.ts +0 -31
- package/example/src/chevre/productOffer/publishMemberTierToken.ts +0 -92
- package/example/src/chevre/project/unsetProjectSettings.ts +0 -73
- package/example/src/chevre/projectEventFieldsById.ts +0 -23
- package/example/src/chevre/projectFields.ts +0 -28
- package/example/src/chevre/projectFieldsById.ts +0 -30
- package/example/src/chevre/projectOwnershipInfoFieldsById.ts +0 -24
- package/example/src/chevre/pushIncludedInDataCatalog.ts +0 -47
- package/example/src/chevre/reExportAction.ts +0 -40
- package/example/src/chevre/reIndex.ts +0 -20
- package/example/src/chevre/recreateRefundTasks.ts +0 -187
- package/example/src/chevre/roles/addAdminAcceptedPaymentMethodReadPermissionIfNotExists.ts +0 -33
- package/example/src/chevre/roles/addAdminAcceptedPaymentMethodWritePermissionIfNotExists.ts +0 -33
- package/example/src/chevre/roles/addAdminEventSeriesReadPermissionIfNotExists.ts +0 -49
- package/example/src/chevre/roles/addAdminMovieReadPermissionIfNotExists.ts +0 -49
- package/example/src/chevre/roles/addAdminNotePermissionIfNotExists.ts +0 -48
- package/example/src/chevre/roles/addAdminPaymentServiceReadPermissionIfNotExists.ts +0 -49
- package/example/src/chevre/roles/addAdminProductHasOfferCatalogReadPermissionIfNotExists.ts +0 -33
- package/example/src/chevre/roles/addAdminRoomReadPermissionIfNotExists.ts +0 -34
- package/example/src/chevre/roles/addAdminRoomWritePermissionIfNotExists.ts +0 -34
- package/example/src/chevre/roles/addAdminSellerEventOfferIfNotExists.ts +0 -48
- package/example/src/chevre/roles/addProjectCreatorRole.ts +0 -48
- package/example/src/chevre/roles/assignGlobalRoles.ts +0 -72
- package/example/src/chevre/roles/findPermissions.ts +0 -84
- package/example/src/chevre/roles/findRoleNames.ts +0 -117
- package/example/src/chevre/roles/removeConsolePermissionIfExists.ts +0 -34
- package/example/src/chevre/roles/removePermissionFromAPIRoles.ts +0 -46
- package/example/src/chevre/roles/removePermissionIfExists.ts +0 -34
- package/example/src/chevre/saveOfferCatalogItem.ts +0 -40
- package/example/src/chevre/saveWebSite.ts +0 -56
- package/example/src/chevre/searchAcceptedOfferIds.ts +0 -57
- package/example/src/chevre/searchActionsByOrderNumber.ts +0 -29
- package/example/src/chevre/searchActionsByPurpose.ts +0 -38
- package/example/src/chevre/searchActionsBySameAs.ts +0 -27
- package/example/src/chevre/searchAggregateOffers.ts +0 -51
- package/example/src/chevre/searchAggregations.ts +0 -50
- package/example/src/chevre/searchAuthorizations.ts +0 -36
- package/example/src/chevre/searchCheckMovieTicketResultYkknInfo.ts +0 -56
- package/example/src/chevre/searchEventHasOfferCatalog.ts +0 -43
- package/example/src/chevre/searchEventSeats.ts +0 -45
- package/example/src/chevre/searchIdsByReservationNumber.ts +0 -16
- package/example/src/chevre/searchMembers.ts +0 -55
- package/example/src/chevre/searchOfferCatalogItemListElement.ts +0 -26
- package/example/src/chevre/searchOffers.ts +0 -68
- package/example/src/chevre/searchProducts.ts +0 -28
- package/example/src/chevre/searchProjects.ts +0 -36
- package/example/src/chevre/searchReservationsByOrder.ts +0 -42
- package/example/src/chevre/searchSellersByAggregate.ts +0 -33
- package/example/src/chevre/searchSlicedAcceptedOffersByOrderNumber.ts +0 -31
- package/example/src/chevre/seller/adminMakesOffer.ts +0 -113
- package/example/src/chevre/sendEmailMessage.ts +0 -60
- package/example/src/chevre/sendGrid/filterEmailActivity.ts +0 -31
- package/example/src/chevre/settings/addOrderNumberSetting.ts +0 -44
- package/example/src/chevre/settings/addTransactionNumberSetting.ts +0 -40
- package/example/src/chevre/stockHolder/findSeatsBySection.ts +0 -59
- package/example/src/chevre/stockHolder/getSize.ts +0 -97
- package/example/src/chevre/stockHolder/projectPendingReservation.ts +0 -43
- package/example/src/chevre/stockHolder/searchSeats.ts +0 -61
- package/example/src/chevre/task/countPotentiallyRunning.ts +0 -41
- package/example/src/chevre/task/countTasks.ts +0 -51
- package/example/src/chevre/task/deleteRunsAtPassedCertainPeriod.ts +0 -43
- package/example/src/chevre/task/deleteUnexpectedTasks.ts +0 -23
- package/example/src/chevre/task/emitRunning.ts +0 -89
- package/example/src/chevre/transaction/processPlaceOrder.ts +0 -57
- package/example/src/chevre/transaction/processReturnOrder.ts +0 -43
- package/example/src/chevre/transaction/startExportTasks.ts +0 -21
- package/example/src/chevre/transactionNumber/publishByTimestamp.ts +0 -23
- package/example/src/chevre/transactionNumber/testRandomness.ts +0 -42
- package/example/src/chevre/unsetUnnecessaryFields.ts +0 -35
- package/example/src/chevre/updateEventPartiallyById.ts +0 -22
- package/example/src/chevre/updateProjectAggregateReservation.ts +0 -21
- package/example/src/chevre/validateCheckMovieTicketActions.ts +0 -70
- package/example/src/customSearch.ts +0 -48
- package/example/src/duration.ts +0 -22
- package/example/src/fetch.ts +0 -45
- package/example/src/moment.ts +0 -22
- package/example/src/mongoConnectionList.ts +0 -81
- package/example/src/mvtkMessage.ts +0 -11
- package/example/src/objectId.ts +0 -12
- package/example/src/redisClientList.ts +0 -80
- package/example/src/redisMulti.ts +0 -63
- package/example/src/regex.ts +0 -31
- package/example/src/signPayload.ts +0 -50
- package/example/src/verifyToken.ts +0 -44
- package/lib/chevre/repo/mongoose/onIndexCreated.d.ts +0 -2
- package/lib/chevre/repo/mongoose/onIndexCreated.js +0 -10
- package/lib/chevre/settings/aggregation.d.ts +0 -35
- /package/lib/chevre/{settings/aggregation.js → taskSettings.js} +0 -0
|
@@ -1,138 +0,0 @@
|
|
|
1
|
-
// tslint:disable:no-console
|
|
2
|
-
// import * as fs from 'fs';
|
|
3
|
-
import moment from 'moment-timezone';
|
|
4
|
-
import mongoose from 'mongoose';
|
|
5
|
-
|
|
6
|
-
import { chevre } from '../../../../lib/index';
|
|
7
|
-
|
|
8
|
-
const PROJECT_ID = String(process.env.PROJECT_ID);
|
|
9
|
-
const AGGREGATE_PERIOD_IN_DAYS = 365;
|
|
10
|
-
const AGGREGATE_ORDER_CLIENT_IDS = (typeof process.env.AGGREGATE_ORDER_CLIENT_IDS === 'string')
|
|
11
|
-
? process.env.AGGREGATE_ORDER_CLIENT_IDS.split(' ')
|
|
12
|
-
: [];
|
|
13
|
-
|
|
14
|
-
function createAggregation(params: {
|
|
15
|
-
order: Pick<chevre.factory.order.IOrder, 'customer' | 'orderDate' | 'orderNumber' | 'project'>;
|
|
16
|
-
orderDateGte: Date;
|
|
17
|
-
orderDateLte: Date;
|
|
18
|
-
}) {
|
|
19
|
-
return async (repos: {
|
|
20
|
-
order: chevre.repository.Order;
|
|
21
|
-
}) => {
|
|
22
|
-
const { order, orderDateGte, orderDateLte } = params;
|
|
23
|
-
|
|
24
|
-
if (PROJECT_ID === '*') {
|
|
25
|
-
return repos.order.aggregateOrderOfCustomerGlobally({
|
|
26
|
-
orderDate: { $gte: orderDateGte, $lte: orderDateLte },
|
|
27
|
-
customer: { email: { $eq: String(order.customer.email) } }
|
|
28
|
-
});
|
|
29
|
-
} else {
|
|
30
|
-
return repos.order.aggregateOrderOfCustomerByProject({
|
|
31
|
-
project: { id: { $eq: PROJECT_ID } },
|
|
32
|
-
orderDate: { $gte: orderDateGte, $lte: orderDateLte },
|
|
33
|
-
customer: { email: { $eq: String(order.customer.email) } }
|
|
34
|
-
});
|
|
35
|
-
}
|
|
36
|
-
};
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
// tslint:disable-next-line:max-func-body-length
|
|
40
|
-
async function main() {
|
|
41
|
-
await mongoose.connect(<string>process.env.MONGOLAB_URI, { autoIndex: false, appName: 'sample' });
|
|
42
|
-
|
|
43
|
-
const aggregateOrderRepo = await chevre.repository.AggregateOrder.createInstance(mongoose.connection);
|
|
44
|
-
const orderRepo = await chevre.repository.Order.createInstance(mongoose.connection);
|
|
45
|
-
|
|
46
|
-
const orderDateLte: Date = moment()
|
|
47
|
-
.toDate();
|
|
48
|
-
const orderDateGte: Date = moment(orderDateLte)
|
|
49
|
-
.add(-AGGREGATE_PERIOD_IN_DAYS, 'days')
|
|
50
|
-
.toDate();
|
|
51
|
-
|
|
52
|
-
const cursor = orderRepo.getCursor(
|
|
53
|
-
{
|
|
54
|
-
...(PROJECT_ID !== '*') ? { 'project.id': { $eq: PROJECT_ID } } : undefined,
|
|
55
|
-
orderDate: {
|
|
56
|
-
$gte: orderDateGte,
|
|
57
|
-
$lte: orderDateLte
|
|
58
|
-
},
|
|
59
|
-
typeOf: { $eq: chevre.factory.order.OrderType.Order },
|
|
60
|
-
'customer.id': { // exclude pos,tvm
|
|
61
|
-
$exists: true,
|
|
62
|
-
$in: AGGREGATE_ORDER_CLIENT_IDS
|
|
63
|
-
}
|
|
64
|
-
},
|
|
65
|
-
{
|
|
66
|
-
customer: 1,
|
|
67
|
-
orderDate: 1,
|
|
68
|
-
orderNumber: 1,
|
|
69
|
-
project: 1
|
|
70
|
-
}
|
|
71
|
-
);
|
|
72
|
-
console.log('docs found');
|
|
73
|
-
|
|
74
|
-
let maxSumGraceTime: number = 0;
|
|
75
|
-
const peopleWithAggregateOrder: {
|
|
76
|
-
identifier: string;
|
|
77
|
-
aggregateOrder: {
|
|
78
|
-
// emailCount: number;
|
|
79
|
-
orderCount: number;
|
|
80
|
-
sumGraceTime: number;
|
|
81
|
-
};
|
|
82
|
-
score?: number;
|
|
83
|
-
}[] = [];
|
|
84
|
-
|
|
85
|
-
let i = 0;
|
|
86
|
-
let updateCount = 0;
|
|
87
|
-
// tslint:disable-next-line:max-func-body-length
|
|
88
|
-
await cursor.eachAsync(async (doc) => {
|
|
89
|
-
i += 1;
|
|
90
|
-
const order: Pick<chevre.factory.order.IOrder, 'customer' | 'orderDate' | 'orderNumber' | 'project'> = doc.toObject();
|
|
91
|
-
|
|
92
|
-
const { email } = order.customer;
|
|
93
|
-
if (typeof email === 'string') {
|
|
94
|
-
console.log(
|
|
95
|
-
'aggregating...',
|
|
96
|
-
order.project.id, order.orderNumber, email, order.orderDate, i);
|
|
97
|
-
const aggregateResult = await createAggregation({ order, orderDateGte, orderDateLte })({ order: orderRepo });
|
|
98
|
-
await aggregateOrderRepo.save(
|
|
99
|
-
{
|
|
100
|
-
project: { id: PROJECT_ID, typeOf: chevre.factory.organizationType.Project },
|
|
101
|
-
identifier: email,
|
|
102
|
-
typeOf: chevre.factory.personType.Person
|
|
103
|
-
},
|
|
104
|
-
{ $set: { aggregateOrder: aggregateResult.aggregation } }
|
|
105
|
-
);
|
|
106
|
-
updateCount += 1;
|
|
107
|
-
console.log(
|
|
108
|
-
'aggregated.',
|
|
109
|
-
order.project.id, order.orderNumber, email, order.orderDate, i);
|
|
110
|
-
|
|
111
|
-
const sumGraceTime = (typeof aggregateResult.aggregation.sumGraceTime === 'number')
|
|
112
|
-
? aggregateResult.aggregation.sumGraceTime
|
|
113
|
-
: 0;
|
|
114
|
-
maxSumGraceTime = Math.max(sumGraceTime, maxSumGraceTime);
|
|
115
|
-
|
|
116
|
-
peopleWithAggregateOrder.push({
|
|
117
|
-
identifier: email,
|
|
118
|
-
aggregateOrder: {
|
|
119
|
-
...aggregateResult.aggregation,
|
|
120
|
-
sumGraceTime
|
|
121
|
-
}
|
|
122
|
-
});
|
|
123
|
-
console.log('maxSumGraceTime:', maxSumGraceTime);
|
|
124
|
-
}
|
|
125
|
-
});
|
|
126
|
-
|
|
127
|
-
console.log(i, 'docs checked');
|
|
128
|
-
console.log(updateCount, 'docs aggregated');
|
|
129
|
-
|
|
130
|
-
// tslint:disable-next-line:non-literal-fs-path no-null-keyword
|
|
131
|
-
// fs.writeFileSync(`${__dirname}/peopleWithAggregateOrder.json`, JSON.stringify(peopleWithAggregateOrder, null, ' '));
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
main()
|
|
135
|
-
.then(() => {
|
|
136
|
-
console.log('success!');
|
|
137
|
-
})
|
|
138
|
-
.catch(console.error);
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
// tslint:disable:no-console
|
|
2
|
-
// import * as fs from 'fs';
|
|
3
|
-
import moment from 'moment-timezone';
|
|
4
|
-
import mongoose from 'mongoose';
|
|
5
|
-
|
|
6
|
-
import { chevre } from '../../../../lib/index';
|
|
7
|
-
|
|
8
|
-
const AGGREGATE_PERIOD_IN_DAYS = 365;
|
|
9
|
-
|
|
10
|
-
// tslint:disable-next-line:max-func-body-length
|
|
11
|
-
async function main() {
|
|
12
|
-
await mongoose.connect(<string>process.env.MONGOLAB_URI, { autoIndex: false, appName: 'sample' });
|
|
13
|
-
|
|
14
|
-
const orderRepo = await chevre.repository.Order.createInstance(mongoose.connection);
|
|
15
|
-
|
|
16
|
-
const orderDateLte: Date = moment()
|
|
17
|
-
.toDate();
|
|
18
|
-
const orderDateGte: Date = moment(orderDateLte)
|
|
19
|
-
.add(-AGGREGATE_PERIOD_IN_DAYS, 'days')
|
|
20
|
-
.toDate();
|
|
21
|
-
|
|
22
|
-
console.log('aggregating...');
|
|
23
|
-
const result = await orderRepo.aggregateOrderOfCustomerGlobally({
|
|
24
|
-
orderDate: { $gte: orderDateGte, $lte: orderDateLte },
|
|
25
|
-
customer: { email: { $eq: 'ilovegadd@gmail.com' } }
|
|
26
|
-
});
|
|
27
|
-
console.log(result);
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
main()
|
|
31
|
-
.then(() => {
|
|
32
|
-
console.log('success!');
|
|
33
|
-
})
|
|
34
|
-
.catch(console.error);
|
|
@@ -1,172 +0,0 @@
|
|
|
1
|
-
// tslint:disable:no-console
|
|
2
|
-
import * as fs from 'fs';
|
|
3
|
-
import moment from 'moment-timezone';
|
|
4
|
-
import mongoose from 'mongoose';
|
|
5
|
-
|
|
6
|
-
import { chevre } from '../../../../lib/index';
|
|
7
|
-
|
|
8
|
-
const PROJECT_ID = String(process.env.PROJECT_ID);
|
|
9
|
-
// const SCREEN_CODE = '10';
|
|
10
|
-
// const MOVIE_THEATER_CODE = '118';
|
|
11
|
-
const SCREEN_CODE = '130';
|
|
12
|
-
// const SCREEN_CODE = '211';
|
|
13
|
-
const MOVIE_THEATER_CODE = '020';
|
|
14
|
-
const AGGREGATE_PERIOD_IN_MONTHS = 12;
|
|
15
|
-
// tslint:disable-next-line:max-func-body-length
|
|
16
|
-
async function main() {
|
|
17
|
-
await mongoose.connect(<string>process.env.MONGOLAB_URI, { autoIndex: false });
|
|
18
|
-
|
|
19
|
-
const aggregateOrderRepo = await chevre.repository.AggregateOrder.createInstance(mongoose.connection);
|
|
20
|
-
const seatRepo = await chevre.repository.place.Seat.createInstance(mongoose.connection);
|
|
21
|
-
const orderRepo = await chevre.repository.Order.createInstance(mongoose.connection);
|
|
22
|
-
|
|
23
|
-
const royalCustomers = await aggregateOrderRepo.searchRoyalCustomers({
|
|
24
|
-
limit: 300,
|
|
25
|
-
project: { id: PROJECT_ID },
|
|
26
|
-
aggregateOrder: { orderCount: { $gte: 12 } }
|
|
27
|
-
});
|
|
28
|
-
// tslint:disable-next-line:no-null-keyword
|
|
29
|
-
console.dir(royalCustomers, { depth: null });
|
|
30
|
-
console.log(royalCustomers.length, 'royalCustomers found');
|
|
31
|
-
|
|
32
|
-
const customerEmails = royalCustomers.map(({ identifier }) => identifier);
|
|
33
|
-
|
|
34
|
-
const seats = <Pick<chevre.factory.place.seat.IPlace, 'branchCode'>[]>await seatRepo.searchSeats({
|
|
35
|
-
// limit: 50,
|
|
36
|
-
$projection: {
|
|
37
|
-
additionalProperty: 0,
|
|
38
|
-
'containedInPlace.typeOf': 0,
|
|
39
|
-
'containedInPlace.name': 0,
|
|
40
|
-
'containedInPlace.containedInPlace': 0,
|
|
41
|
-
name: 0, typeOf: 0
|
|
42
|
-
},
|
|
43
|
-
project: { id: { $eq: PROJECT_ID } },
|
|
44
|
-
containedInPlace: {
|
|
45
|
-
containedInPlace: {
|
|
46
|
-
branchCode: { $eq: SCREEN_CODE },
|
|
47
|
-
containedInPlace: { branchCode: { $eq: MOVIE_THEATER_CODE } }
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
});
|
|
51
|
-
// tslint:disable-next-line:no-null-keyword
|
|
52
|
-
// console.dir(seats, { depth: null });
|
|
53
|
-
console.log(seats.length, 'seats found');
|
|
54
|
-
|
|
55
|
-
const orderDateGte: Date = moment()
|
|
56
|
-
.add(-AGGREGATE_PERIOD_IN_MONTHS, 'months')
|
|
57
|
-
.toDate();
|
|
58
|
-
const orderDateLte: Date = moment()
|
|
59
|
-
.toDate();
|
|
60
|
-
|
|
61
|
-
let maxSumGraceTime: number = 0;
|
|
62
|
-
let maxRepeatRate: number = 0;
|
|
63
|
-
const seatsWithAggregateOrder: {
|
|
64
|
-
branchCode: string;
|
|
65
|
-
aggregateOrder: {
|
|
66
|
-
emailCount: number;
|
|
67
|
-
orderCount: number;
|
|
68
|
-
repeatRate: number;
|
|
69
|
-
avgGraceTime?: number;
|
|
70
|
-
sumGraceTime: number;
|
|
71
|
-
avgGraceTimeInHours?: number;
|
|
72
|
-
sumGraceTimeInHours: number;
|
|
73
|
-
};
|
|
74
|
-
score?: number;
|
|
75
|
-
}[] = [];
|
|
76
|
-
let i = 1;
|
|
77
|
-
for (const { branchCode } of seats) {
|
|
78
|
-
i += 1;
|
|
79
|
-
const startTime = process.hrtime();
|
|
80
|
-
const aggregateResult = await orderRepo.aggregateOrderOfSeat({
|
|
81
|
-
project: { id: { $eq: PROJECT_ID } },
|
|
82
|
-
orderDate: { $gte: orderDateGte, $lte: orderDateLte },
|
|
83
|
-
acceptedOffers: {
|
|
84
|
-
itemOffered: {
|
|
85
|
-
reservationFor: {
|
|
86
|
-
location: { branchCode: SCREEN_CODE },
|
|
87
|
-
superEvent: { location: { branchCode: MOVIE_THEATER_CODE } }
|
|
88
|
-
},
|
|
89
|
-
reservedTicket: { ticketedSeat: { seatNumber: branchCode } }
|
|
90
|
-
}
|
|
91
|
-
},
|
|
92
|
-
customer: { email: { $in: customerEmails } }
|
|
93
|
-
});
|
|
94
|
-
console.log('aggregateOrder:result', aggregateResult, orderDateGte, orderDateLte, i);
|
|
95
|
-
const diff = process.hrtime(startTime);
|
|
96
|
-
console.log(`aggregateOrderOfSeat took ${diff[0]} seconds and ${diff[1]} nanoseconds.`);
|
|
97
|
-
|
|
98
|
-
const emailCount = (typeof aggregateResult.aggregation.emailCount === 'number')
|
|
99
|
-
? aggregateResult.aggregation.emailCount
|
|
100
|
-
: 0;
|
|
101
|
-
const repeatRate = (aggregateResult.aggregation.orderCount > 0)
|
|
102
|
-
// tslint:disable-next-line:no-magic-numbers
|
|
103
|
-
? (aggregateResult.aggregation.orderCount - emailCount) * 100 / aggregateResult.aggregation.orderCount
|
|
104
|
-
: 0;
|
|
105
|
-
const sumGraceTime = (typeof aggregateResult.aggregation.sumGraceTime === 'number')
|
|
106
|
-
? aggregateResult.aggregation.sumGraceTime
|
|
107
|
-
: 0;
|
|
108
|
-
const avgGraceTimeInHours = (typeof aggregateResult.aggregation.sumGraceTime === 'number')
|
|
109
|
-
? Math.floor(
|
|
110
|
-
moment.duration(Math.floor(aggregateResult.aggregation.sumGraceTime / aggregateResult.aggregation.orderCount), 'milliseconds')
|
|
111
|
-
.asHours()
|
|
112
|
-
)
|
|
113
|
-
: 0;
|
|
114
|
-
const sumGraceTimeInHours = (typeof aggregateResult.aggregation.sumGraceTime === 'number')
|
|
115
|
-
? Math.floor(moment.duration(aggregateResult.aggregation.sumGraceTime, 'milliseconds')
|
|
116
|
-
.asHours())
|
|
117
|
-
: 0;
|
|
118
|
-
maxSumGraceTime = Math.max(sumGraceTime, maxSumGraceTime);
|
|
119
|
-
maxRepeatRate = Math.max(repeatRate, maxRepeatRate);
|
|
120
|
-
|
|
121
|
-
seatsWithAggregateOrder.push({
|
|
122
|
-
branchCode,
|
|
123
|
-
aggregateOrder: {
|
|
124
|
-
...aggregateResult.aggregation,
|
|
125
|
-
emailCount,
|
|
126
|
-
repeatRate,
|
|
127
|
-
avgGraceTimeInHours,
|
|
128
|
-
sumGraceTimeInHours,
|
|
129
|
-
sumGraceTime
|
|
130
|
-
}
|
|
131
|
-
});
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
const seatsJson = seatsWithAggregateOrder.map((seat, key) => {
|
|
135
|
-
// tslint:disable-next-line:no-magic-numbers
|
|
136
|
-
const score = Math.floor(seat.aggregateOrder.sumGraceTime * 100 / maxSumGraceTime);
|
|
137
|
-
console.log('aggregateOrder:result', seat.branchCode, key);
|
|
138
|
-
|
|
139
|
-
return {
|
|
140
|
-
branchCode: seat.branchCode,
|
|
141
|
-
score
|
|
142
|
-
};
|
|
143
|
-
});
|
|
144
|
-
|
|
145
|
-
const scoresByEmailJson = seatsWithAggregateOrder.map((seat, key) => {
|
|
146
|
-
// tslint:disable-next-line:no-magic-numbers
|
|
147
|
-
const score = Math.floor(seat.aggregateOrder.repeatRate * 100 / maxRepeatRate);
|
|
148
|
-
console.log('aggregateOrder:result', seat.branchCode, seat.aggregateOrder.emailCount, key);
|
|
149
|
-
|
|
150
|
-
return {
|
|
151
|
-
branchCode: seat.branchCode,
|
|
152
|
-
score
|
|
153
|
-
// repeatRate: seat.aggregateOrder.repeatRate,
|
|
154
|
-
// emailCount: seat.aggregateOrder.emailCount,
|
|
155
|
-
// orderCount: seat.aggregateOrder.orderCount
|
|
156
|
-
};
|
|
157
|
-
});
|
|
158
|
-
|
|
159
|
-
console.log('maxSumGraceTime:', maxSumGraceTime);
|
|
160
|
-
console.log('maxRepeatRate:', maxRepeatRate);
|
|
161
|
-
|
|
162
|
-
// tslint:disable-next-line:non-literal-fs-path no-null-keyword
|
|
163
|
-
fs.writeFileSync(`${__dirname}/seatScoresByGraceTime.json`, JSON.stringify(seatsJson, null, ' '));
|
|
164
|
-
// tslint:disable-next-line:non-literal-fs-path no-null-keyword
|
|
165
|
-
fs.writeFileSync(`${__dirname}/seatScoresByEmail.json`, JSON.stringify(scoresByEmailJson, null, ' '));
|
|
166
|
-
}
|
|
167
|
-
|
|
168
|
-
main()
|
|
169
|
-
.then(() => {
|
|
170
|
-
console.log('success!');
|
|
171
|
-
})
|
|
172
|
-
.catch(console.error);
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
// tslint:disable:no-console
|
|
2
|
-
import moment from 'moment-timezone';
|
|
3
|
-
import mongoose from 'mongoose';
|
|
4
|
-
|
|
5
|
-
import { chevre } from '../../../../lib/index';
|
|
6
|
-
|
|
7
|
-
const EXCLUDED_PROJECT_ID = String(process.env.EXCLUDED_PROJECT_ID);
|
|
8
|
-
|
|
9
|
-
async function main() {
|
|
10
|
-
await mongoose.connect(<string>process.env.MONGOLAB_URI, { autoIndex: false });
|
|
11
|
-
|
|
12
|
-
const orderRepo = await chevre.repository.Order.createInstance(mongoose.connection);
|
|
13
|
-
|
|
14
|
-
const aggregateDate = new Date('2024-11-03T10:00:00+09:00');
|
|
15
|
-
const aggregateDurationUnit = 'days';
|
|
16
|
-
// const aggregateDurationUnit = 'hours';
|
|
17
|
-
const startFrom: Date = moment(aggregateDate)
|
|
18
|
-
.utc()
|
|
19
|
-
.startOf(aggregateDurationUnit)
|
|
20
|
-
.toDate();
|
|
21
|
-
const startThrough: Date = moment(aggregateDate)
|
|
22
|
-
.utc()
|
|
23
|
-
.endOf(aggregateDurationUnit)
|
|
24
|
-
.toDate();
|
|
25
|
-
|
|
26
|
-
const startTime = process.hrtime();
|
|
27
|
-
const aggregateResult = await orderRepo.aggregateOrder({
|
|
28
|
-
project: { id: { $ne: EXCLUDED_PROJECT_ID } },
|
|
29
|
-
orderDate: { $gte: startFrom, $lte: startThrough }
|
|
30
|
-
});
|
|
31
|
-
console.log('aggregateOrder:result', aggregateResult, startFrom, startThrough);
|
|
32
|
-
const diff = process.hrtime(startTime);
|
|
33
|
-
console.log(`importing chevre took ${diff[0]} seconds and ${diff[1]} nanoseconds.`);
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
main()
|
|
37
|
-
.then(() => {
|
|
38
|
-
console.log('success!');
|
|
39
|
-
})
|
|
40
|
-
.catch(console.error);
|
|
@@ -1,79 +0,0 @@
|
|
|
1
|
-
// tslint:disable:no-console
|
|
2
|
-
import moment from 'moment-timezone';
|
|
3
|
-
import mongoose from 'mongoose';
|
|
4
|
-
|
|
5
|
-
import { chevre } from '../../../../lib/index';
|
|
6
|
-
|
|
7
|
-
async function main() {
|
|
8
|
-
await mongoose.connect(<string>process.env.MONGOLAB_URI, { autoIndex: false });
|
|
9
|
-
|
|
10
|
-
const assetTransactionRepo = await chevre.repository.AssetTransaction.createInstance(mongoose.connection);
|
|
11
|
-
const projectRepo = await chevre.repository.Project.createInstance(mongoose.connection);
|
|
12
|
-
|
|
13
|
-
const aggregateDate = new Date();
|
|
14
|
-
// const aggregateDurationUnit = 'days';
|
|
15
|
-
// const startFrom: Date = moment(aggregateDate)
|
|
16
|
-
// .utc()
|
|
17
|
-
// .startOf(aggregateDurationUnit)
|
|
18
|
-
// .toDate();
|
|
19
|
-
// const startThrough: Date = moment(aggregateDate)
|
|
20
|
-
// .utc()
|
|
21
|
-
// .endOf(aggregateDurationUnit)
|
|
22
|
-
// .toDate();
|
|
23
|
-
const startThrough: Date = aggregateDate;
|
|
24
|
-
const startFrom: Date = moment(aggregateDate)
|
|
25
|
-
.add(-1, 'days')
|
|
26
|
-
.toDate();
|
|
27
|
-
|
|
28
|
-
const cursor = projectRepo.getCursor(
|
|
29
|
-
{
|
|
30
|
-
_id: { $nin: ['xxx'] }
|
|
31
|
-
},
|
|
32
|
-
{
|
|
33
|
-
_id: 1
|
|
34
|
-
}
|
|
35
|
-
);
|
|
36
|
-
console.log('docs found');
|
|
37
|
-
|
|
38
|
-
let i = 0;
|
|
39
|
-
let results: {
|
|
40
|
-
id: string;
|
|
41
|
-
reservationCount?: number;
|
|
42
|
-
}[] = [];
|
|
43
|
-
await cursor.eachAsync(async (doc) => {
|
|
44
|
-
i += 1;
|
|
45
|
-
const project: Pick<chevre.factory.project.IProject, 'id'> = doc.toObject();
|
|
46
|
-
|
|
47
|
-
const startTime = process.hrtime();
|
|
48
|
-
const aggregateResult = await assetTransactionRepo.aggregateAssetTransaction({
|
|
49
|
-
project: { id: { $eq: project.id } },
|
|
50
|
-
startFrom,
|
|
51
|
-
startThrough,
|
|
52
|
-
typeOf: chevre.factory.assetTransactionType.Reserve
|
|
53
|
-
});
|
|
54
|
-
const reservationCount = aggregateResult.statuses.find(
|
|
55
|
-
({ status }) => status === chevre.factory.transactionStatusType.Confirmed
|
|
56
|
-
)?.aggregation.reservationCount;
|
|
57
|
-
console.log(
|
|
58
|
-
'reservationCount',
|
|
59
|
-
reservationCount,
|
|
60
|
-
project.id,
|
|
61
|
-
startFrom, startThrough
|
|
62
|
-
);
|
|
63
|
-
const diff = process.hrtime(startTime);
|
|
64
|
-
console.log(`took ${diff[0]} seconds and ${diff[1]} nanoseconds.`);
|
|
65
|
-
results.push({ id: project.id, reservationCount });
|
|
66
|
-
});
|
|
67
|
-
|
|
68
|
-
results = results.sort(
|
|
69
|
-
(a, b) => {
|
|
70
|
-
return Number(b.reservationCount) - Number(a.reservationCount);
|
|
71
|
-
});
|
|
72
|
-
console.log(results);
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
main()
|
|
76
|
-
.then(() => {
|
|
77
|
-
console.log('success!');
|
|
78
|
-
})
|
|
79
|
-
.catch(console.error);
|
|
@@ -1,201 +0,0 @@
|
|
|
1
|
-
// tslint:disable:no-console
|
|
2
|
-
import mongoose from 'mongoose';
|
|
3
|
-
|
|
4
|
-
import { chevre } from '../../../../lib/index';
|
|
5
|
-
|
|
6
|
-
const EXCLUDED_PROJECT_ID = process.env.EXCLUDED_PROJECT_ID;
|
|
7
|
-
const AGGREGATE_DURATION_UNIT = <'days' | 'hours'>String(process.env.AGGREGATE_DURATION_UNIT);
|
|
8
|
-
const AGGREGATE_DAYS = Number(process.env.AGGREGATE_DAYS);
|
|
9
|
-
const AGGREGATE_CLIENT_IDS = (typeof process.env.AGGREGATE_CLIENT_IDS === 'string') ? process.env.AGGREGATE_CLIENT_IDS.split(' ') : [];
|
|
10
|
-
const ONE_DAY_IN_HOURS = 24;
|
|
11
|
-
console.log('AGGREGATE_CLIENT_IDS:', AGGREGATE_CLIENT_IDS);
|
|
12
|
-
|
|
13
|
-
// tslint:disable-next-line:max-func-body-length
|
|
14
|
-
async function main() {
|
|
15
|
-
await mongoose.connect(<string>process.env.MONGOLAB_URI, { autoIndex: false });
|
|
16
|
-
|
|
17
|
-
const aggregationRepo = await chevre.repository.Aggregation.createInstance(mongoose.connection);
|
|
18
|
-
const eventRepo = await chevre.repository.Event.createInstance(mongoose.connection);
|
|
19
|
-
const orderRepo = await chevre.repository.Order.createInstance(mongoose.connection);
|
|
20
|
-
const transactionRepo = await chevre.repository.Transaction.createInstance(mongoose.connection);
|
|
21
|
-
const assetTransactionRepo = await chevre.repository.AssetTransaction.createInstance(mongoose.connection);
|
|
22
|
-
const actionRepo = await chevre.repository.Action.createInstance(mongoose.connection);
|
|
23
|
-
const taskRepo = await chevre.repository.Task.createInstance(mongoose.connection);
|
|
24
|
-
|
|
25
|
-
const aggregateDate = new Date();
|
|
26
|
-
let result: { aggregationCount: number; aggregateDuration: string };
|
|
27
|
-
|
|
28
|
-
result = await (await chevre.service.aggregation.createService()).system.aggregateOrder({
|
|
29
|
-
aggregateDate,
|
|
30
|
-
aggregateDurationUnit: AGGREGATE_DURATION_UNIT,
|
|
31
|
-
aggregationCount: (AGGREGATE_DURATION_UNIT === 'hours') ? AGGREGATE_DAYS * ONE_DAY_IN_HOURS : AGGREGATE_DAYS,
|
|
32
|
-
excludedProjectId: EXCLUDED_PROJECT_ID
|
|
33
|
-
})({
|
|
34
|
-
agregation: aggregationRepo,
|
|
35
|
-
order: orderRepo
|
|
36
|
-
});
|
|
37
|
-
console.log('aggregateOrder processed.', result);
|
|
38
|
-
// return;
|
|
39
|
-
|
|
40
|
-
result = await (await chevre.service.aggregation.createService()).system.aggregatePlaceOrder({
|
|
41
|
-
aggregateDate,
|
|
42
|
-
aggregateDurationUnit: AGGREGATE_DURATION_UNIT,
|
|
43
|
-
aggregationCount: (AGGREGATE_DURATION_UNIT === 'hours') ? AGGREGATE_DAYS * ONE_DAY_IN_HOURS : AGGREGATE_DAYS,
|
|
44
|
-
excludedProjectId: EXCLUDED_PROJECT_ID,
|
|
45
|
-
clientIds: AGGREGATE_CLIENT_IDS
|
|
46
|
-
})({
|
|
47
|
-
agregation: aggregationRepo,
|
|
48
|
-
transaction: transactionRepo
|
|
49
|
-
});
|
|
50
|
-
console.log('aggregatePlaceOrder processed.', result);
|
|
51
|
-
// return;
|
|
52
|
-
|
|
53
|
-
result = await (await chevre.service.aggregation.createService()).system.aggregateReserveAction({
|
|
54
|
-
aggregateDate,
|
|
55
|
-
aggregateDurationUnit: AGGREGATE_DURATION_UNIT,
|
|
56
|
-
aggregationCount: (AGGREGATE_DURATION_UNIT === 'hours') ? AGGREGATE_DAYS * ONE_DAY_IN_HOURS : AGGREGATE_DAYS,
|
|
57
|
-
excludedProjectId: EXCLUDED_PROJECT_ID
|
|
58
|
-
})({
|
|
59
|
-
agregation: aggregationRepo,
|
|
60
|
-
action: actionRepo
|
|
61
|
-
});
|
|
62
|
-
console.log('aggregateReserveAction processed.', result);
|
|
63
|
-
|
|
64
|
-
result = await (await chevre.service.aggregation.createService()).system.aggregateOrderAction({
|
|
65
|
-
aggregateDate,
|
|
66
|
-
aggregateDurationUnit: AGGREGATE_DURATION_UNIT,
|
|
67
|
-
aggregationCount: (AGGREGATE_DURATION_UNIT === 'hours') ? AGGREGATE_DAYS * ONE_DAY_IN_HOURS : AGGREGATE_DAYS,
|
|
68
|
-
excludedProjectId: EXCLUDED_PROJECT_ID
|
|
69
|
-
})({
|
|
70
|
-
agregation: aggregationRepo,
|
|
71
|
-
action: actionRepo
|
|
72
|
-
});
|
|
73
|
-
console.log('aggregateReserveAction processed.', result);
|
|
74
|
-
|
|
75
|
-
result = await (await chevre.service.aggregation.createService()).system.aggregateCancelReservationAction({
|
|
76
|
-
aggregateDate,
|
|
77
|
-
aggregateDurationUnit: AGGREGATE_DURATION_UNIT,
|
|
78
|
-
aggregationCount: (AGGREGATE_DURATION_UNIT === 'hours') ? AGGREGATE_DAYS * ONE_DAY_IN_HOURS : AGGREGATE_DAYS,
|
|
79
|
-
excludedProjectId: EXCLUDED_PROJECT_ID
|
|
80
|
-
})({
|
|
81
|
-
agregation: aggregationRepo,
|
|
82
|
-
action: actionRepo
|
|
83
|
-
});
|
|
84
|
-
console.log('aggregateCancelReservationAction processed.', result);
|
|
85
|
-
|
|
86
|
-
result = await (await chevre.service.aggregation.createService()).system.aggregateTask({
|
|
87
|
-
aggregateDate,
|
|
88
|
-
aggregateDurationUnit: AGGREGATE_DURATION_UNIT,
|
|
89
|
-
aggregationCount: (AGGREGATE_DURATION_UNIT === 'hours') ? AGGREGATE_DAYS * ONE_DAY_IN_HOURS : AGGREGATE_DAYS,
|
|
90
|
-
excludedProjectId: EXCLUDED_PROJECT_ID
|
|
91
|
-
})({
|
|
92
|
-
agregation: aggregationRepo,
|
|
93
|
-
task: taskRepo
|
|
94
|
-
});
|
|
95
|
-
console.log('aggregateTask processed.', result);
|
|
96
|
-
|
|
97
|
-
result = await (await chevre.service.aggregation.createService()).system.aggregatePayMovieTicketAction({
|
|
98
|
-
aggregateDate,
|
|
99
|
-
aggregateDurationUnit: AGGREGATE_DURATION_UNIT,
|
|
100
|
-
aggregationCount: (AGGREGATE_DURATION_UNIT === 'hours') ? AGGREGATE_DAYS * ONE_DAY_IN_HOURS : AGGREGATE_DAYS,
|
|
101
|
-
excludedProjectId: EXCLUDED_PROJECT_ID
|
|
102
|
-
})({
|
|
103
|
-
agregation: aggregationRepo,
|
|
104
|
-
action: actionRepo
|
|
105
|
-
});
|
|
106
|
-
console.log('aggregatePayMovieTicketAction processed.', result);
|
|
107
|
-
|
|
108
|
-
result = await (await chevre.service.aggregation.createService()).system.aggregatePayTransaction({
|
|
109
|
-
aggregateDate,
|
|
110
|
-
aggregateDurationUnit: AGGREGATE_DURATION_UNIT,
|
|
111
|
-
aggregationCount: (AGGREGATE_DURATION_UNIT === 'hours') ? AGGREGATE_DAYS * ONE_DAY_IN_HOURS : AGGREGATE_DAYS,
|
|
112
|
-
excludedProjectId: EXCLUDED_PROJECT_ID
|
|
113
|
-
})({
|
|
114
|
-
agregation: aggregationRepo,
|
|
115
|
-
assetTransaction: assetTransactionRepo
|
|
116
|
-
});
|
|
117
|
-
console.log('aggregatePayTransaction processed.', result);
|
|
118
|
-
|
|
119
|
-
result = await (await chevre.service.aggregation.createService()).system.aggregateEvent({
|
|
120
|
-
aggregateDate,
|
|
121
|
-
aggregateDurationUnit: AGGREGATE_DURATION_UNIT,
|
|
122
|
-
aggregationCount: (AGGREGATE_DURATION_UNIT === 'hours') ? AGGREGATE_DAYS * ONE_DAY_IN_HOURS : AGGREGATE_DAYS,
|
|
123
|
-
excludedProjectId: EXCLUDED_PROJECT_ID
|
|
124
|
-
})({
|
|
125
|
-
agregation: aggregationRepo,
|
|
126
|
-
event: eventRepo
|
|
127
|
-
});
|
|
128
|
-
console.log('aggregateEvent processed.', result);
|
|
129
|
-
|
|
130
|
-
result = await (await chevre.service.aggregation.createService()).system.aggregateReserveTransaction({
|
|
131
|
-
aggregateDate,
|
|
132
|
-
aggregateDurationUnit: AGGREGATE_DURATION_UNIT,
|
|
133
|
-
aggregationCount: (AGGREGATE_DURATION_UNIT === 'hours') ? AGGREGATE_DAYS * ONE_DAY_IN_HOURS : AGGREGATE_DAYS,
|
|
134
|
-
excludedProjectId: EXCLUDED_PROJECT_ID
|
|
135
|
-
})({
|
|
136
|
-
agregation: aggregationRepo,
|
|
137
|
-
assetTransaction: assetTransactionRepo
|
|
138
|
-
});
|
|
139
|
-
console.log('aggregateReserveTransaction processed.', result);
|
|
140
|
-
|
|
141
|
-
result = await (await chevre.service.aggregation.createService()).system.aggregateAuthorizeOrderAction({
|
|
142
|
-
aggregateDate,
|
|
143
|
-
aggregateDurationUnit: AGGREGATE_DURATION_UNIT,
|
|
144
|
-
aggregationCount: (AGGREGATE_DURATION_UNIT === 'hours') ? AGGREGATE_DAYS * ONE_DAY_IN_HOURS : AGGREGATE_DAYS,
|
|
145
|
-
excludedProjectId: EXCLUDED_PROJECT_ID
|
|
146
|
-
})({
|
|
147
|
-
agregation: aggregationRepo,
|
|
148
|
-
action: actionRepo
|
|
149
|
-
});
|
|
150
|
-
console.log('aggregateAuthorizeOrderAction processed.', result);
|
|
151
|
-
|
|
152
|
-
result = await (await chevre.service.aggregation.createService()).system.aggregateAuthorizeEventServiceOfferAction({
|
|
153
|
-
aggregateDate,
|
|
154
|
-
aggregateDurationUnit: AGGREGATE_DURATION_UNIT,
|
|
155
|
-
aggregationCount: (AGGREGATE_DURATION_UNIT === 'hours') ? AGGREGATE_DAYS * ONE_DAY_IN_HOURS : AGGREGATE_DAYS,
|
|
156
|
-
excludedProjectId: EXCLUDED_PROJECT_ID
|
|
157
|
-
})({
|
|
158
|
-
agregation: aggregationRepo,
|
|
159
|
-
action: actionRepo
|
|
160
|
-
});
|
|
161
|
-
console.log('aggregateAuthorizeEventServiceOfferAction processed.', result);
|
|
162
|
-
|
|
163
|
-
result = await (await chevre.service.aggregation.createService()).system.aggregateAuthorizePaymentAction({
|
|
164
|
-
aggregateDate,
|
|
165
|
-
aggregateDurationUnit: AGGREGATE_DURATION_UNIT,
|
|
166
|
-
aggregationCount: (AGGREGATE_DURATION_UNIT === 'hours') ? AGGREGATE_DAYS * ONE_DAY_IN_HOURS : AGGREGATE_DAYS,
|
|
167
|
-
excludedProjectId: EXCLUDED_PROJECT_ID
|
|
168
|
-
})({
|
|
169
|
-
agregation: aggregationRepo,
|
|
170
|
-
action: actionRepo
|
|
171
|
-
});
|
|
172
|
-
console.log('aggregateAuthorizePaymentAction processed.', result);
|
|
173
|
-
|
|
174
|
-
result = await (await chevre.service.aggregation.createService()).system.aggregateUseAction({
|
|
175
|
-
aggregateDate,
|
|
176
|
-
aggregateDurationUnit: AGGREGATE_DURATION_UNIT,
|
|
177
|
-
aggregationCount: (AGGREGATE_DURATION_UNIT === 'hours') ? AGGREGATE_DAYS * ONE_DAY_IN_HOURS : AGGREGATE_DAYS,
|
|
178
|
-
excludedProjectId: EXCLUDED_PROJECT_ID
|
|
179
|
-
})({
|
|
180
|
-
agregation: aggregationRepo,
|
|
181
|
-
action: actionRepo
|
|
182
|
-
});
|
|
183
|
-
console.log('aggregateUseAction processed.', result);
|
|
184
|
-
|
|
185
|
-
result = await (await chevre.service.aggregation.createService()).system.aggregateCheckMovieTicketAction({
|
|
186
|
-
aggregateDate,
|
|
187
|
-
aggregateDurationUnit: AGGREGATE_DURATION_UNIT,
|
|
188
|
-
aggregationCount: (AGGREGATE_DURATION_UNIT === 'hours') ? AGGREGATE_DAYS * ONE_DAY_IN_HOURS : AGGREGATE_DAYS,
|
|
189
|
-
excludedProjectId: EXCLUDED_PROJECT_ID
|
|
190
|
-
})({
|
|
191
|
-
agregation: aggregationRepo,
|
|
192
|
-
action: actionRepo
|
|
193
|
-
});
|
|
194
|
-
console.log('aggregateCheckMovieTicketAction processed.', result);
|
|
195
|
-
}
|
|
196
|
-
|
|
197
|
-
main()
|
|
198
|
-
.then(() => {
|
|
199
|
-
console.log('success!');
|
|
200
|
-
})
|
|
201
|
-
.catch(console.error);
|