@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,41 +0,0 @@
|
|
|
1
|
-
// tslint:disable:no-console
|
|
2
|
-
import moment from 'moment';
|
|
3
|
-
import mongoose from 'mongoose';
|
|
4
|
-
|
|
5
|
-
import { chevre } from '../../../../lib/index';
|
|
6
|
-
|
|
7
|
-
// tslint:disable-next-line:max-func-body-length
|
|
8
|
-
async function main() {
|
|
9
|
-
await mongoose.connect(<string>process.env.MONGOLAB_URI, { autoIndex: false });
|
|
10
|
-
|
|
11
|
-
const taskRepo = await chevre.repository.Task.createInstance(mongoose.connection);
|
|
12
|
-
|
|
13
|
-
const aggregateDate = new Date();
|
|
14
|
-
const runsFrom: Date = moment(aggregateDate)
|
|
15
|
-
.utc()
|
|
16
|
-
// .tz('Asia/Tokyo')
|
|
17
|
-
.add(-1, 'days')
|
|
18
|
-
.startOf('days')
|
|
19
|
-
.toDate();
|
|
20
|
-
const runsThrough: Date = moment(aggregateDate)
|
|
21
|
-
.utc()
|
|
22
|
-
// .tz('Asia/Tokyo')
|
|
23
|
-
.add(-1, 'days')
|
|
24
|
-
.endOf('days')
|
|
25
|
-
.toDate();
|
|
26
|
-
|
|
27
|
-
const result = await taskRepo.aggregateTask({
|
|
28
|
-
project: {
|
|
29
|
-
id: { $ne: 'sskts-development' }
|
|
30
|
-
},
|
|
31
|
-
runsFrom,
|
|
32
|
-
runsThrough
|
|
33
|
-
});
|
|
34
|
-
console.dir(result, { depth: null });
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
main()
|
|
38
|
-
.then(() => {
|
|
39
|
-
console.log('success!');
|
|
40
|
-
})
|
|
41
|
-
.catch(console.error);
|
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
// tslint:disable:no-console
|
|
2
|
-
import moment from 'moment';
|
|
3
|
-
import mongoose from 'mongoose';
|
|
4
|
-
|
|
5
|
-
import { chevre } from '../../../../lib/index';
|
|
6
|
-
|
|
7
|
-
const PROJECT = { typeOf: chevre.factory.organizationType.Project, id: String(process.env.PROJECT_ID) };
|
|
8
|
-
|
|
9
|
-
async function main() {
|
|
10
|
-
await mongoose.connect(<string>process.env.MONGOLAB_URI);
|
|
11
|
-
|
|
12
|
-
const eventRepo = await chevre.repository.Event.createInstance(mongoose.connection);
|
|
13
|
-
const taskRepo = await chevre.repository.Task.createInstance(mongoose.connection);
|
|
14
|
-
|
|
15
|
-
const events = <Pick<
|
|
16
|
-
chevre.factory.event.screeningEvent.IEvent,
|
|
17
|
-
'id' | 'typeOf' | 'startDate' | 'project'
|
|
18
|
-
>[]>await eventRepo.projectEventFields(
|
|
19
|
-
{
|
|
20
|
-
typeOf: chevre.factory.eventType.ScreeningEvent,
|
|
21
|
-
project: { id: { $eq: PROJECT.id } },
|
|
22
|
-
startFrom: moment()
|
|
23
|
-
.add(-1, 'days')
|
|
24
|
-
.toDate()
|
|
25
|
-
// startFrom: moment().add(-1, 'day').toDate(),
|
|
26
|
-
// startThrough: moment().add(1, 'day').toDate(),
|
|
27
|
-
// startThrough: now
|
|
28
|
-
},
|
|
29
|
-
['typeOf', 'startDate', 'project']
|
|
30
|
-
);
|
|
31
|
-
|
|
32
|
-
// console.log(events);
|
|
33
|
-
console.log(events.length);
|
|
34
|
-
// return;
|
|
35
|
-
|
|
36
|
-
const tasks: chevre.factory.task.aggregateScreeningEvent.IAttributes[] = [];
|
|
37
|
-
for (const { id, typeOf, startDate, project } of events) {
|
|
38
|
-
const aggregateTask: chevre.factory.task.aggregateScreeningEvent.IAttributes = {
|
|
39
|
-
name: chevre.factory.taskName.AggregateScreeningEvent,
|
|
40
|
-
project: { typeOf: chevre.factory.organizationType.Project, id: project.id },
|
|
41
|
-
status: chevre.factory.taskStatus.Ready,
|
|
42
|
-
runsAt: new Date(),
|
|
43
|
-
remainingNumberOfTries: 1,
|
|
44
|
-
numberOfTried: 0,
|
|
45
|
-
executionResults: [],
|
|
46
|
-
data: { typeOf, id }
|
|
47
|
-
};
|
|
48
|
-
// const aggregateUseActionsTask: chevre.factory.task.aggregateUseActionsOnEvent.IAttributes = {
|
|
49
|
-
// name: chevre.factory.taskName.AggregateUseActionsOnEvent,
|
|
50
|
-
// project: { typeOf: chevre.factory.organizationType.Project, id: project.id },
|
|
51
|
-
// status: chevre.factory.taskStatus.Ready,
|
|
52
|
-
// runsAt: new Date(),
|
|
53
|
-
// remainingNumberOfTries: 1,
|
|
54
|
-
// numberOfTried: 0,
|
|
55
|
-
// executionResults: [],
|
|
56
|
-
// data: { typeOf, id }
|
|
57
|
-
// };
|
|
58
|
-
tasks.push(aggregateTask);
|
|
59
|
-
console.log('task created', project.id, id, startDate);
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
console.log('creating...', tasks.length, 'tasks');
|
|
63
|
-
const result = await taskRepo.taskModel.insertMany(tasks, { ordered: false, rawResult: true });
|
|
64
|
-
console.log('result:', { ...result, ops: undefined, insertedIds: undefined });
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
main()
|
|
68
|
-
.then(() => {
|
|
69
|
-
console.log('success!');
|
|
70
|
-
})
|
|
71
|
-
.catch(console.error);
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
// tslint:disable:no-console
|
|
2
|
-
import mongoose from 'mongoose';
|
|
3
|
-
|
|
4
|
-
import { chevre } from '../../../../lib/index';
|
|
5
|
-
|
|
6
|
-
const project = { id: <string>process.env.PROJECT_ID };
|
|
7
|
-
const EVENT_ID = String(process.env.EVENT_ID);
|
|
8
|
-
|
|
9
|
-
// tslint:disable-next-line:max-func-body-length
|
|
10
|
-
async function main() {
|
|
11
|
-
await mongoose.connect(<string>process.env.MONGOLAB_URI, { autoIndex: false });
|
|
12
|
-
|
|
13
|
-
const aggregateReservationRepo = await chevre.repository.AggregateReservation.createInstance(mongoose.connection);
|
|
14
|
-
const aggregateReservations = await aggregateReservationRepo.searchWithReservationForId(
|
|
15
|
-
{
|
|
16
|
-
limit: 100,
|
|
17
|
-
page: 1,
|
|
18
|
-
project: { id: { $eq: project.id } },
|
|
19
|
-
reservationFor: {
|
|
20
|
-
id: { $eq: EVENT_ID },
|
|
21
|
-
typeOf: chevre.factory.eventType.ScreeningEvent
|
|
22
|
-
}
|
|
23
|
-
},
|
|
24
|
-
['aggregateOffer']
|
|
25
|
-
);
|
|
26
|
-
console.log('aggregateReservations:', aggregateReservations);
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
main()
|
|
30
|
-
.then(() => {
|
|
31
|
-
console.log('success!');
|
|
32
|
-
})
|
|
33
|
-
.catch(console.error);
|
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
// tslint:disable:no-console
|
|
2
|
-
import moment from 'moment';
|
|
3
|
-
import mongoose from 'mongoose';
|
|
4
|
-
|
|
5
|
-
import { chevre } from '../../../../lib/index';
|
|
6
|
-
|
|
7
|
-
// tslint:disable-next-line:max-func-body-length
|
|
8
|
-
async function main() {
|
|
9
|
-
await mongoose.connect(<string>process.env.MONGOLAB_URI, { autoIndex: false });
|
|
10
|
-
|
|
11
|
-
const assetTransactionRepo = await chevre.repository.AssetTransaction.createInstance(mongoose.connection);
|
|
12
|
-
|
|
13
|
-
const cursor = assetTransactionRepo.getCursor(
|
|
14
|
-
{
|
|
15
|
-
typeOf: { $eq: chevre.factory.assetTransactionType.Pay },
|
|
16
|
-
startDate: {
|
|
17
|
-
$gte: moment()
|
|
18
|
-
// tslint:disable-next-line:no-magic-numbers
|
|
19
|
-
.add(-3, 'days')
|
|
20
|
-
.toDate()
|
|
21
|
-
},
|
|
22
|
-
'object.typeOf': {
|
|
23
|
-
$exists: true,
|
|
24
|
-
$in: [
|
|
25
|
-
// chevre.factory.service.paymentService.PaymentServiceType.FaceToFace,
|
|
26
|
-
// chevre.factory.service.paymentService.PaymentServiceType.MovieTicket,
|
|
27
|
-
chevre.factory.service.paymentService.PaymentServiceType.CreditCard
|
|
28
|
-
]
|
|
29
|
-
}
|
|
30
|
-
},
|
|
31
|
-
{
|
|
32
|
-
}
|
|
33
|
-
);
|
|
34
|
-
console.log('docs found');
|
|
35
|
-
|
|
36
|
-
let i = 0;
|
|
37
|
-
let ticketTokenCount = 0;
|
|
38
|
-
await cursor.eachAsync(async (doc) => {
|
|
39
|
-
i += 1;
|
|
40
|
-
const payTransaction = <chevre.factory.assetTransaction.pay.ITransaction>doc.toObject();
|
|
41
|
-
|
|
42
|
-
const ticketTokenByInstrument = payTransaction.instrument?.find((instrument) => instrument.typeOf === 'Ticket')?.ticketToken;
|
|
43
|
-
if (typeof ticketTokenByInstrument === 'string' && ticketTokenByInstrument !== '') {
|
|
44
|
-
console.log(
|
|
45
|
-
ticketTokenByInstrument,
|
|
46
|
-
' ticket token exists.',
|
|
47
|
-
payTransaction.project.id, payTransaction.typeOf, payTransaction.object.typeOf,
|
|
48
|
-
payTransaction.startDate, payTransaction.transactionNumber, i
|
|
49
|
-
);
|
|
50
|
-
ticketTokenCount += 1;
|
|
51
|
-
} else {
|
|
52
|
-
console.log(
|
|
53
|
-
ticketTokenByInstrument,
|
|
54
|
-
' ticket token does not exists.',
|
|
55
|
-
payTransaction.project.id, payTransaction.typeOf, payTransaction.object.typeOf,
|
|
56
|
-
payTransaction.startDate, payTransaction.transactionNumber, i
|
|
57
|
-
);
|
|
58
|
-
}
|
|
59
|
-
});
|
|
60
|
-
|
|
61
|
-
console.log(i, 'docs checked');
|
|
62
|
-
console.log(ticketTokenCount, 'ticketToken exist');
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
main()
|
|
66
|
-
.then()
|
|
67
|
-
.catch(console.error);
|
|
@@ -1,149 +0,0 @@
|
|
|
1
|
-
// tslint:disable:no-console
|
|
2
|
-
import moment from 'moment';
|
|
3
|
-
import mongoose from 'mongoose';
|
|
4
|
-
import * as redis from 'redis';
|
|
5
|
-
|
|
6
|
-
import { chevre } from '../../../../lib/index';
|
|
7
|
-
|
|
8
|
-
const project = { id: String(process.env.PROJECT_ID) };
|
|
9
|
-
const { EVENT_ID, OFFER_ID, APPLICATION_ID, OFFER_TOKEN } = process.env;
|
|
10
|
-
|
|
11
|
-
// tslint:disable-next-line:max-func-body-length
|
|
12
|
-
async function main() {
|
|
13
|
-
if (typeof EVENT_ID !== 'string'
|
|
14
|
-
|| typeof OFFER_ID !== 'string'
|
|
15
|
-
|| typeof APPLICATION_ID !== 'string') {
|
|
16
|
-
throw new Error('environment variables required');
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
const redisClient = redis.createClient<redis.RedisDefaultModules, Record<string, never>, Record<string, never>>({
|
|
20
|
-
socket: {
|
|
21
|
-
port: Number(<string>process.env.REDIS_PORT),
|
|
22
|
-
host: <string>process.env.REDIS_HOST
|
|
23
|
-
},
|
|
24
|
-
password: <string>process.env.REDIS_KEY
|
|
25
|
-
});
|
|
26
|
-
await redisClient.connect();
|
|
27
|
-
await mongoose.connect(<string>process.env.MONGOLAB_URI, { autoIndex: false });
|
|
28
|
-
|
|
29
|
-
const transactionNumberRepo = await chevre.repository.TransactionNumber.createInstance({
|
|
30
|
-
connection: mongoose.connection
|
|
31
|
-
});
|
|
32
|
-
const { transactionNumber } = await transactionNumberRepo.publishByTimestamp({ startDate: new Date() });
|
|
33
|
-
const provider: chevre.factory.reservation.IProvider = {
|
|
34
|
-
id: '59d20831e53ebc2b4e774466',
|
|
35
|
-
typeOf: chevre.factory.organizationType.Corporation
|
|
36
|
-
};
|
|
37
|
-
|
|
38
|
-
const { transaction } = await (await chevre.service.assetTransaction.createService()).reserve.start(
|
|
39
|
-
{
|
|
40
|
-
project: { id: project.id, typeOf: chevre.factory.organizationType.Project },
|
|
41
|
-
typeOf: chevre.factory.assetTransactionType.Reserve,
|
|
42
|
-
transactionNumber,
|
|
43
|
-
agent: { ...provider, name: 'sample agent name' },
|
|
44
|
-
object: {
|
|
45
|
-
acceptedOffer: [{
|
|
46
|
-
/**
|
|
47
|
-
* オファーID
|
|
48
|
-
*/
|
|
49
|
-
id: OFFER_ID,
|
|
50
|
-
/**
|
|
51
|
-
* アイテム情報
|
|
52
|
-
* 予約の詳細指定など
|
|
53
|
-
*/
|
|
54
|
-
itemOffered: {
|
|
55
|
-
serviceOutput: {
|
|
56
|
-
typeOf: chevre.factory.reservationType.EventReservation,
|
|
57
|
-
reservedTicket: {
|
|
58
|
-
/**
|
|
59
|
-
* チケット識別子
|
|
60
|
-
* 指定された場合、決済カードの対象チケット識別子と関連付けされます
|
|
61
|
-
* /^[0-9a-zA-Z]{8,16}$/
|
|
62
|
-
*/
|
|
63
|
-
// identifier?: string;
|
|
64
|
-
// issuedBy?: ReservationFactory.IUnderName;
|
|
65
|
-
typeOf: 'Ticket',
|
|
66
|
-
ticketedSeat: {
|
|
67
|
-
typeOf: chevre.factory.placeType.Seat,
|
|
68
|
-
seatNumber: 'A-01',
|
|
69
|
-
seatRow: '',
|
|
70
|
-
seatSection: 'Default'
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
}],
|
|
76
|
-
reservationFor: {
|
|
77
|
-
id: EVENT_ID,
|
|
78
|
-
offers: {
|
|
79
|
-
// token: OFFER_TOKEN,
|
|
80
|
-
// identifier: 'LegacyReservation'
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
},
|
|
84
|
-
expires: moment()
|
|
85
|
-
// tslint:disable-next-line:no-magic-numbers
|
|
86
|
-
.add(5, 'seconds')
|
|
87
|
-
.toDate(),
|
|
88
|
-
validateEvent: false,
|
|
89
|
-
validateEventOfferPeriod: true,
|
|
90
|
-
validateAppliesToMovieTicket: true,
|
|
91
|
-
instrument: [
|
|
92
|
-
...(typeof OFFER_TOKEN === 'string') ? [{ ticketToken: OFFER_TOKEN, typeOf: <'Ticket'>'Ticket' }] : []
|
|
93
|
-
],
|
|
94
|
-
availableAtOrFrom: { id: APPLICATION_ID }
|
|
95
|
-
// stockHoldUntilDaysAfterEventEnd: STOCK_HOLD_UNTIL_DAYS_AFTER_EVENT_END
|
|
96
|
-
},
|
|
97
|
-
{ maxReservationGracePeriodInDays: 93 }
|
|
98
|
-
)(
|
|
99
|
-
{
|
|
100
|
-
advanceBookingRequirement: await chevre.repository.AdvanceBookingRequirement.createInstance(mongoose.connection),
|
|
101
|
-
authorization: await chevre.repository.Authorization.createInstance(mongoose.connection),
|
|
102
|
-
project: await chevre.repository.Project.createInstance(mongoose.connection),
|
|
103
|
-
stockHolder: await chevre.repository.StockHolder.createInstance({ connection: mongoose.connection }),
|
|
104
|
-
event: await chevre.repository.Event.createInstance(mongoose.connection),
|
|
105
|
-
eventOffer: await chevre.repository.EventOffer.createInstance(mongoose.connection),
|
|
106
|
-
eventSeries: await chevre.repository.EventSeries.createInstance(mongoose.connection),
|
|
107
|
-
issuer: await chevre.repository.Issuer.createInstance(mongoose.connection),
|
|
108
|
-
member: await chevre.repository.Member.createInstance(mongoose.connection),
|
|
109
|
-
memberProgram: await chevre.repository.MemberProgram.createInstance(mongoose.connection),
|
|
110
|
-
offer: await chevre.repository.Offer.createInstance(mongoose.connection),
|
|
111
|
-
offerCatalog: await chevre.repository.OfferCatalog.createInstance(mongoose.connection),
|
|
112
|
-
offerCatalogItem: await chevre.repository.OfferCatalogItem.createInstance(mongoose.connection),
|
|
113
|
-
offerRateLimit: await chevre.repository.rateLimit.Offer.createInstance(redisClient),
|
|
114
|
-
paymentService: await chevre.repository.PaymentService.createInstance(mongoose.connection),
|
|
115
|
-
priceSpecification: await chevre.repository.PriceSpecification.createInstance(mongoose.connection),
|
|
116
|
-
product: await chevre.repository.Product.createInstance(mongoose.connection),
|
|
117
|
-
productOffer: await chevre.repository.ProductOffer.createInstance(mongoose.connection),
|
|
118
|
-
seat: await chevre.repository.place.Seat.createInstance(mongoose.connection),
|
|
119
|
-
setting: await chevre.repository.Setting.createInstance(mongoose.connection),
|
|
120
|
-
task: await chevre.repository.Task.createInstance(mongoose.connection),
|
|
121
|
-
ticket: await chevre.repository.Ticket.createInstance(mongoose.connection),
|
|
122
|
-
assetTransaction: await chevre.repository.AssetTransaction.createInstance(mongoose.connection)
|
|
123
|
-
},
|
|
124
|
-
new chevre.settings.Settings({
|
|
125
|
-
abortedTasksWithoutReport: [],
|
|
126
|
-
numTryConfirmReserveTransaction: 10,
|
|
127
|
-
deliverOrderLimit: 1,
|
|
128
|
-
coa: { timeout: 20000 },
|
|
129
|
-
gmo: {
|
|
130
|
-
timeout: 5000,
|
|
131
|
-
timeoutBackground: 5000,
|
|
132
|
-
useFetch: true
|
|
133
|
-
},
|
|
134
|
-
movieticketReserve: {
|
|
135
|
-
timeout: 5000,
|
|
136
|
-
timeoutCheck: 5000,
|
|
137
|
-
minIntervalBetweenPayAndRefund: 1,
|
|
138
|
-
credentialsExpireInSeconds: 300
|
|
139
|
-
},
|
|
140
|
-
// useAssetTransactionSyncProcessing: process.env.USE_ASSET_TRANSACTION_SYNC_PROCESSING === '1',
|
|
141
|
-
useExperimentalFeature: false
|
|
142
|
-
})
|
|
143
|
-
);
|
|
144
|
-
console.log('transaction:', transaction);
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
main()
|
|
148
|
-
.then(console.log)
|
|
149
|
-
.catch(console.error);
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
// tslint:disable:no-console
|
|
2
|
-
import mongoose from 'mongoose';
|
|
3
|
-
|
|
4
|
-
import { chevre } from '../../../lib/index';
|
|
5
|
-
|
|
6
|
-
async function main() {
|
|
7
|
-
await mongoose.connect(<string>process.env.MONGOLAB_URI);
|
|
8
|
-
|
|
9
|
-
const reservationRepo = await chevre.repository.Reservation.createInstance(mongoose.connection);
|
|
10
|
-
|
|
11
|
-
const reservation = await reservationRepo.attendIfNotAttended(
|
|
12
|
-
{
|
|
13
|
-
id: '948926445022844-0',
|
|
14
|
-
now: new Date()
|
|
15
|
-
}
|
|
16
|
-
);
|
|
17
|
-
console.log('reservation found', reservation);
|
|
18
|
-
|
|
19
|
-
// await reservationRepo.cancel(
|
|
20
|
-
// {
|
|
21
|
-
// id: '948926445022844-0',
|
|
22
|
-
// previousReservationStatus: chevre.factory.reservationStatusType.ReservationConfirmed,
|
|
23
|
-
// modifiedTime: new Date()
|
|
24
|
-
// }
|
|
25
|
-
// );
|
|
26
|
-
// console.log('reservation canceled');
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
main()
|
|
30
|
-
.then(console.log)
|
|
31
|
-
.catch(console.error);
|
|
@@ -1,122 +0,0 @@
|
|
|
1
|
-
// tslint:disable:no-console
|
|
2
|
-
import mongoose from 'mongoose';
|
|
3
|
-
import * as redis from 'redis';
|
|
4
|
-
|
|
5
|
-
import { chevre } from '../../../lib/index';
|
|
6
|
-
|
|
7
|
-
const project = {
|
|
8
|
-
id: String(process.env.PROJECT_ID),
|
|
9
|
-
typeOf: <chevre.factory.organizationType.Project>chevre.factory.organizationType.Project
|
|
10
|
-
};
|
|
11
|
-
|
|
12
|
-
// tslint:disable-next-line:max-func-body-length
|
|
13
|
-
async function main() {
|
|
14
|
-
const redisClient = redis.createClient<redis.RedisDefaultModules, Record<string, never>, Record<string, never>>({
|
|
15
|
-
socket: {
|
|
16
|
-
port: Number(<string>process.env.REDIS_PORT),
|
|
17
|
-
host: <string>process.env.REDIS_HOST
|
|
18
|
-
},
|
|
19
|
-
password: <string>process.env.REDIS_KEY
|
|
20
|
-
});
|
|
21
|
-
await redisClient.connect();
|
|
22
|
-
await mongoose.connect(<string>process.env.MONGOLAB_URI, { autoIndex: false });
|
|
23
|
-
|
|
24
|
-
const action = await (await chevre.service.offer.createService()).event.authorize(
|
|
25
|
-
{
|
|
26
|
-
project: project,
|
|
27
|
-
object: {
|
|
28
|
-
acceptedOffer: [],
|
|
29
|
-
reservationFor: {
|
|
30
|
-
id: 'bmcvkft63',
|
|
31
|
-
offers: {
|
|
32
|
-
// validForMemberTier: {
|
|
33
|
-
// token: 'xx',
|
|
34
|
-
// isTierOf: { identifier: 'DefaultMemberProgram' }
|
|
35
|
-
// }
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
}
|
|
39
|
-
},
|
|
40
|
-
agent: { id: 'xxx' },
|
|
41
|
-
transaction: { id: 'xxx' },
|
|
42
|
-
validateEventOfferPeriod: true,
|
|
43
|
-
validateEvent: false,
|
|
44
|
-
store: { id: 'xxx' },
|
|
45
|
-
instrument: []
|
|
46
|
-
},
|
|
47
|
-
{
|
|
48
|
-
noOfferSpecified: true,
|
|
49
|
-
maxReservationGracePeriodInDays: 93
|
|
50
|
-
}
|
|
51
|
-
)(
|
|
52
|
-
{
|
|
53
|
-
action: await chevre.repository.Action.createInstance(mongoose.connection),
|
|
54
|
-
advanceBookingRequirement: await chevre.repository.AdvanceBookingRequirement.createInstance(mongoose.connection),
|
|
55
|
-
assetTransaction: await chevre.repository.AssetTransaction.createInstance(mongoose.connection),
|
|
56
|
-
authorization: await chevre.repository.Authorization.createInstance(mongoose.connection),
|
|
57
|
-
event: await chevre.repository.Event.createInstance(mongoose.connection),
|
|
58
|
-
eventOffer: await chevre.repository.EventOffer.createInstance(mongoose.connection),
|
|
59
|
-
eventSeries: await chevre.repository.EventSeries.createInstance(mongoose.connection),
|
|
60
|
-
issuer: await chevre.repository.Issuer.createInstance(mongoose.connection),
|
|
61
|
-
member: await chevre.repository.Member.createInstance(mongoose.connection),
|
|
62
|
-
memberProgram: await chevre.repository.MemberProgram.createInstance(mongoose.connection),
|
|
63
|
-
stockHolder: await chevre.repository.StockHolder.createInstance({ connection: mongoose.connection }),
|
|
64
|
-
offer: await chevre.repository.Offer.createInstance(mongoose.connection),
|
|
65
|
-
offerCatalog: await chevre.repository.OfferCatalog.createInstance(mongoose.connection),
|
|
66
|
-
offerCatalogItem: await chevre.repository.OfferCatalogItem.createInstance(mongoose.connection),
|
|
67
|
-
offerRateLimit: await chevre.repository.rateLimit.Offer.createInstance(redisClient),
|
|
68
|
-
orderInTransaction: await chevre.repository.OrderInTransaction.createInstance(mongoose.connection),
|
|
69
|
-
orderNumber: await chevre.repository.OrderNumber.createInstance({ connection: mongoose.connection }),
|
|
70
|
-
paymentService: await chevre.repository.PaymentService.createInstance(mongoose.connection),
|
|
71
|
-
priceSpecification: await chevre.repository.PriceSpecification.createInstance(mongoose.connection),
|
|
72
|
-
product: await chevre.repository.Product.createInstance(mongoose.connection),
|
|
73
|
-
productOffer: await chevre.repository.ProductOffer.createInstance(mongoose.connection),
|
|
74
|
-
project: await chevre.repository.Project.createInstance(mongoose.connection),
|
|
75
|
-
seat: await chevre.repository.place.Seat.createInstance(mongoose.connection),
|
|
76
|
-
setting: await chevre.repository.Setting.createInstance(mongoose.connection),
|
|
77
|
-
task: await chevre.repository.Task.createInstance(mongoose.connection),
|
|
78
|
-
ticket: await chevre.repository.Ticket.createInstance(mongoose.connection),
|
|
79
|
-
transaction: await chevre.repository.Transaction.createInstance(mongoose.connection),
|
|
80
|
-
transactionNumber: await chevre.repository.TransactionNumber.createInstance({ connection: mongoose.connection })
|
|
81
|
-
},
|
|
82
|
-
new chevre.settings.Settings({
|
|
83
|
-
// notification: {
|
|
84
|
-
// // tslint:disable-next-line:no-magic-numbers
|
|
85
|
-
// timeout: (process.env.TRIGGER_WEBHOOK_TIMEOUT !== undefined) ? Number(process.env.TRIGGER_WEBHOOK_TIMEOUT) : 15000,
|
|
86
|
-
// useFetchAPI: process.env.USE_FETCH_API === '1',
|
|
87
|
-
// secretKey: (typeof process.env.TRIGGER_WEBHOOK_SECRET_KEY === 'string')
|
|
88
|
-
// ? process.env.TRIGGER_WEBHOOK_SECRET_KEY
|
|
89
|
-
// : '',
|
|
90
|
-
// headerIdentifier: (typeof process.env.TRIGGER_WEBHOOK_HEADER_IDENTIFIER === 'string')
|
|
91
|
-
// ? process.env.TRIGGER_WEBHOOK_HEADER_IDENTIFIER
|
|
92
|
-
// : ''
|
|
93
|
-
// },
|
|
94
|
-
abortedTasksWithoutReport: (typeof process.env.ABORTED_TASKS_WITHOUT_REPORT === 'string')
|
|
95
|
-
? process.env.ABORTED_TASKS_WITHOUT_REPORT.split(' ')
|
|
96
|
-
: [],
|
|
97
|
-
numTryConfirmReserveTransaction: (typeof process.env.NUM_TRY_CONFIRM_RESERVE_TRANSACTION === 'string')
|
|
98
|
-
? Number(process.env.NUM_TRY_CONFIRM_RESERVE_TRANSACTION)
|
|
99
|
-
// tslint:disable-next-line:no-magic-numbers
|
|
100
|
-
: 10,
|
|
101
|
-
deliverOrderLimit: (typeof process.env.DELIVER_ORDER_LIMIT === 'string')
|
|
102
|
-
? Number(process.env.DELIVER_ORDER_LIMIT)
|
|
103
|
-
: 1,
|
|
104
|
-
coa: {
|
|
105
|
-
// tslint:disable-next-line:no-magic-numbers
|
|
106
|
-
timeout: (typeof process.env.COA_TIMEOUT === 'string') ? Number(process.env.COA_TIMEOUT) : 20000
|
|
107
|
-
},
|
|
108
|
-
gmo: <any>{
|
|
109
|
-
useFetch: process.env.GMO_USE_FETCH === '1'
|
|
110
|
-
},
|
|
111
|
-
movieticketReserve: <any>{
|
|
112
|
-
},
|
|
113
|
-
// useAssetTransactionSyncProcessing: process.env.USE_ASSET_TRANSACTION_SYNC_PROCESSING === '1',
|
|
114
|
-
useExperimentalFeature: process.env.USE_EXPERIMENTAL_FEATURE === '1'
|
|
115
|
-
})
|
|
116
|
-
);
|
|
117
|
-
console.log('authorized.', action);
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
main()
|
|
121
|
-
.then(console.log)
|
|
122
|
-
.catch(console.error);
|
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
// tslint:disable:no-console no-magic-numbers
|
|
2
|
-
import mongoose from 'mongoose';
|
|
3
|
-
|
|
4
|
-
import { chevre } from '../../../../lib/index';
|
|
5
|
-
|
|
6
|
-
// tslint:disable-next-line:max-func-body-length
|
|
7
|
-
async function main() {
|
|
8
|
-
await mongoose.connect(<string>process.env.MONGOLAB_URI, { autoIndex: false });
|
|
9
|
-
|
|
10
|
-
const categoryCodeRepo = await chevre.repository.CategoryCode.createInstance(mongoose.connection);
|
|
11
|
-
|
|
12
|
-
const cursor = categoryCodeRepo.getCursor(
|
|
13
|
-
{
|
|
14
|
-
// _id: { $eq: '68f5d32176b5f6b689ff24a6' },
|
|
15
|
-
// 'project.id': { $eq: project.id },
|
|
16
|
-
// 'additionalProperty.name': { $exists: true, $eq: PROPERTY_NAME }
|
|
17
|
-
'inCodeSet.identifier': { $ne: chevre.factory.movieTicketType.CategorySetIdentifier.MovieTicketType }
|
|
18
|
-
},
|
|
19
|
-
{
|
|
20
|
-
_id: 1,
|
|
21
|
-
codeValue: 1,
|
|
22
|
-
project: 1,
|
|
23
|
-
inCodeSet: 1,
|
|
24
|
-
name: 1,
|
|
25
|
-
typeOf: 1
|
|
26
|
-
}
|
|
27
|
-
);
|
|
28
|
-
console.log('docs found');
|
|
29
|
-
|
|
30
|
-
let i = 0;
|
|
31
|
-
let notUniqueCount = 0;
|
|
32
|
-
await cursor.eachAsync(async (doc) => {
|
|
33
|
-
i += 1;
|
|
34
|
-
const categoryCode: Pick<
|
|
35
|
-
chevre.factory.categoryCode.ICategoryCode,
|
|
36
|
-
'codeValue' | 'id' | 'inCodeSet' | 'name' | 'project' | 'typeOf'
|
|
37
|
-
> = doc.toObject();
|
|
38
|
-
|
|
39
|
-
// console.log('unique?', categoryCode.project.id, categoryCode.id, categoryCode.codeValue, i);
|
|
40
|
-
|
|
41
|
-
const sameCodeValues = (await categoryCodeRepo.projectCategoryCodeFields(
|
|
42
|
-
{
|
|
43
|
-
project: { id: { $eq: categoryCode.project.id } },
|
|
44
|
-
codeValue: { $eq: categoryCode.codeValue }
|
|
45
|
-
// inCodeSet:{identifier:{$}}
|
|
46
|
-
},
|
|
47
|
-
['codeValue', 'inCodeSet']
|
|
48
|
-
)).filter(
|
|
49
|
-
({ inCodeSet }) => <unknown>inCodeSet.identifier !== chevre.factory.movieTicketType.CategorySetIdentifier.MovieTicketType
|
|
50
|
-
);
|
|
51
|
-
// console.log(sameCodeValues, 'sameCodeValues found', categoryCode.project.id, categoryCode.id, categoryCode.codeValue, i);
|
|
52
|
-
|
|
53
|
-
const isUnique = sameCodeValues.length === 1;
|
|
54
|
-
if (isUnique) {
|
|
55
|
-
// console.log(
|
|
56
|
-
// 'unique.', categoryCode.project.id, categoryCode.id, categoryCode.codeValue, i);
|
|
57
|
-
} else {
|
|
58
|
-
notUniqueCount += 1;
|
|
59
|
-
console.log('not unique.', categoryCode.project.id, categoryCode.id, categoryCode.codeValue, i);
|
|
60
|
-
}
|
|
61
|
-
});
|
|
62
|
-
|
|
63
|
-
console.log(i, 'docs checked');
|
|
64
|
-
console.log(notUniqueCount, 'docs not unique');
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
main()
|
|
68
|
-
.then()
|
|
69
|
-
.catch(console.error);
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
// tslint:disable:no-console
|
|
2
|
-
import mongoose from 'mongoose';
|
|
3
|
-
|
|
4
|
-
import { chevre } from '../../../lib/index';
|
|
5
|
-
|
|
6
|
-
const project = { id: String(process.env.PROJECT_ID) };
|
|
7
|
-
|
|
8
|
-
async function main() {
|
|
9
|
-
await mongoose.connect(<string>process.env.MONGOLAB_URI, { autoIndex: false });
|
|
10
|
-
|
|
11
|
-
const orderRepo = await chevre.repository.Order.createInstance(mongoose.connection);
|
|
12
|
-
const result = await orderRepo.changeStatus(
|
|
13
|
-
{
|
|
14
|
-
project: {
|
|
15
|
-
id: project.id
|
|
16
|
-
},
|
|
17
|
-
orderNumber: 'CIN1-3723005-2440693',
|
|
18
|
-
orderStatus: chevre.factory.orderStatus.OrderDelivered,
|
|
19
|
-
previousOrderStatus: chevre.factory.orderStatus.OrderInTransit
|
|
20
|
-
}
|
|
21
|
-
);
|
|
22
|
-
// tslint:disable-next-line:no-null-keyword
|
|
23
|
-
console.dir(result, { depth: null });
|
|
24
|
-
console.log(result);
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
main()
|
|
28
|
-
.then(console.log)
|
|
29
|
-
.catch(console.error);
|