@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,49 +0,0 @@
|
|
|
1
|
-
// tslint:disable:no-console
|
|
2
|
-
import mongoose from 'mongoose';
|
|
3
|
-
|
|
4
|
-
import { chevre } from '../../../../lib/index';
|
|
5
|
-
|
|
6
|
-
// const PROJECT_ID = process.env.PROJECT_ID;
|
|
7
|
-
mongoose.Model.on('index', (...args) => {
|
|
8
|
-
console.error('******** index event emitted. ********\n', args);
|
|
9
|
-
});
|
|
10
|
-
|
|
11
|
-
async function main() {
|
|
12
|
-
await mongoose.connect(<string>process.env.MONGOLAB_URI, { autoIndex: false });
|
|
13
|
-
|
|
14
|
-
const offerCatalogRepo = await chevre.repository.OfferCatalog.createInstance(mongoose.connection);
|
|
15
|
-
|
|
16
|
-
try {
|
|
17
|
-
await offerCatalogRepo.updateManyOfferCatalogsByIds({
|
|
18
|
-
id: {
|
|
19
|
-
$in: ['xxx']
|
|
20
|
-
},
|
|
21
|
-
itemOffered: {
|
|
22
|
-
typeOf: {
|
|
23
|
-
$eq: chevre.factory.product.ProductType.EventService
|
|
24
|
-
}
|
|
25
|
-
},
|
|
26
|
-
$push: {
|
|
27
|
-
itemListElement: {
|
|
28
|
-
$each: [{ id: 'xxx', typeOf: chevre.factory.offerType.Offer }],
|
|
29
|
-
$slice: 300
|
|
30
|
-
}
|
|
31
|
-
},
|
|
32
|
-
$pull: {
|
|
33
|
-
itemListElement: {
|
|
34
|
-
$elemMatch: {
|
|
35
|
-
id: {
|
|
36
|
-
$in: ['xxx']
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
});
|
|
42
|
-
} catch (error) {
|
|
43
|
-
throw await chevre.errorHandler.handleMongoError(error);
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
main()
|
|
48
|
-
.then(console.log)
|
|
49
|
-
.catch(console.error);
|
|
@@ -1,49 +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
|
-
// tslint:disable-next-line:max-func-body-length
|
|
9
|
-
async function main() {
|
|
10
|
-
await mongoose.connect(<string>process.env.MONGOLAB_URI, { autoIndex: false });
|
|
11
|
-
|
|
12
|
-
const offerCatalogItemRepo = await chevre.repository.OfferCatalogItem.createInstance(mongoose.connection);
|
|
13
|
-
|
|
14
|
-
const result = await offerCatalogItemRepo.upsertManyByIdentifier(
|
|
15
|
-
[
|
|
16
|
-
{
|
|
17
|
-
$set: {
|
|
18
|
-
project: { typeOf: chevre.factory.organizationType.Project, id: PROJECT_ID },
|
|
19
|
-
typeOf: 'OfferCatalog',
|
|
20
|
-
id: '',
|
|
21
|
-
identifier: '2023122501CatalogItem',
|
|
22
|
-
itemListElement: [
|
|
23
|
-
{ id: '1001', typeOf: chevre.factory.offerType.Offer }
|
|
24
|
-
],
|
|
25
|
-
itemOffered: { typeOf: chevre.factory.product.ProductType.EventService },
|
|
26
|
-
name: {
|
|
27
|
-
en: 'xxx',
|
|
28
|
-
ja: 'xxx'
|
|
29
|
-
},
|
|
30
|
-
description: {
|
|
31
|
-
en: 'xxx',
|
|
32
|
-
ja: 'xxx'
|
|
33
|
-
},
|
|
34
|
-
additionalProperty: []
|
|
35
|
-
},
|
|
36
|
-
$unset: {}
|
|
37
|
-
}
|
|
38
|
-
],
|
|
39
|
-
{
|
|
40
|
-
update: true,
|
|
41
|
-
productType: chevre.factory.product.ProductType.EventService
|
|
42
|
-
}
|
|
43
|
-
);
|
|
44
|
-
console.log('result:', result);
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
main()
|
|
48
|
-
.then(console.log)
|
|
49
|
-
.catch(console.error);
|
|
@@ -1,51 +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
|
-
// tslint:disable-next-line:max-func-body-length
|
|
9
|
-
async function main() {
|
|
10
|
-
await mongoose.connect(<string>process.env.MONGOLAB_URI, { autoIndex: false });
|
|
11
|
-
|
|
12
|
-
const offerCatalogRepo = await chevre.repository.OfferCatalog.createInstance(mongoose.connection);
|
|
13
|
-
|
|
14
|
-
const result = await offerCatalogRepo.upsertManyByIdentifier(
|
|
15
|
-
[
|
|
16
|
-
{
|
|
17
|
-
$set: {
|
|
18
|
-
project: { typeOf: chevre.factory.organizationType.Project, id: PROJECT_ID },
|
|
19
|
-
typeOf: 'OfferCatalog',
|
|
20
|
-
id: '',
|
|
21
|
-
identifier: '2023121501',
|
|
22
|
-
itemListElement: [
|
|
23
|
-
{ id: '1001', typeOf: chevre.factory.offerType.Offer }
|
|
24
|
-
],
|
|
25
|
-
itemOffered: { typeOf: chevre.factory.product.ProductType.EventService },
|
|
26
|
-
name: {
|
|
27
|
-
en: '2023121501',
|
|
28
|
-
ja: '2023121501'
|
|
29
|
-
},
|
|
30
|
-
description: {
|
|
31
|
-
en: '2023121501',
|
|
32
|
-
ja: '2023121501'
|
|
33
|
-
},
|
|
34
|
-
additionalProperty: []
|
|
35
|
-
},
|
|
36
|
-
$unset: {}
|
|
37
|
-
}
|
|
38
|
-
],
|
|
39
|
-
{
|
|
40
|
-
update: false,
|
|
41
|
-
productType: chevre.factory.product.ProductType.EventService,
|
|
42
|
-
itemListElementType: chevre.factory.offerType.Offer
|
|
43
|
-
}
|
|
44
|
-
// { update: false }
|
|
45
|
-
);
|
|
46
|
-
console.log('result:', result);
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
main()
|
|
50
|
-
.then(console.log)
|
|
51
|
-
.catch(console.error);
|
|
@@ -1,47 +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 excludedProject = { id: String(process.env.EXCLUDED_PROJECT_ID) };
|
|
8
|
-
|
|
9
|
-
mongoose.connect(<string>process.env.MONGOLAB_URI, { autoIndex: false });
|
|
10
|
-
|
|
11
|
-
// tslint:disable-next-line:max-func-body-length
|
|
12
|
-
async function main() {
|
|
13
|
-
const aggregateOfferRepo = await chevre.repository.AggregateOffer.createInstance(mongoose.connection);
|
|
14
|
-
|
|
15
|
-
const cursor = aggregateOfferRepo.getCursor(
|
|
16
|
-
{
|
|
17
|
-
'project.id': { $ne: excludedProject.id }
|
|
18
|
-
// _id: { $eq: 'blyk9q24f' }
|
|
19
|
-
},
|
|
20
|
-
{
|
|
21
|
-
_id: 1,
|
|
22
|
-
project: 1
|
|
23
|
-
}
|
|
24
|
-
);
|
|
25
|
-
console.log('docs found');
|
|
26
|
-
|
|
27
|
-
let i = 0;
|
|
28
|
-
await cursor.eachAsync(async (doc) => {
|
|
29
|
-
i += 1;
|
|
30
|
-
const offer: Pick<chevre.factory.aggregateOffer.IAggregateOffer, 'id' | 'project'> = doc.toObject();
|
|
31
|
-
|
|
32
|
-
console.log('count?', offer.project.id, offer.id, i);
|
|
33
|
-
const result = await aggregateOfferRepo.countIncludedInDataCatalog({
|
|
34
|
-
id: { $eq: String(offer.id) }
|
|
35
|
-
});
|
|
36
|
-
console.log('result:', result, offer.project.id, offer.id, i);
|
|
37
|
-
});
|
|
38
|
-
|
|
39
|
-
console.log(i, 'docs checked');
|
|
40
|
-
|
|
41
|
-
const resultMax = await aggregateOfferRepo.maxIncludedInDataCatalogCount();
|
|
42
|
-
console.log('resultMax:', resultMax);
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
main()
|
|
46
|
-
.then()
|
|
47
|
-
.catch(console.error);
|
|
@@ -1,54 +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
|
-
const formatter = new Intl.NumberFormat('ja-JP');
|
|
9
|
-
|
|
10
|
-
// tslint:disable-next-line:max-func-body-length
|
|
11
|
-
async function main() {
|
|
12
|
-
let startTime: [number, number] = process.hrtime();
|
|
13
|
-
let diff: [number, number] = process.hrtime(startTime);
|
|
14
|
-
let result: any;
|
|
15
|
-
|
|
16
|
-
await mongoose.connect(<string>process.env.MONGOLAB_URI, { autoIndex: false });
|
|
17
|
-
|
|
18
|
-
const offerCatalogRepo = await chevre.repository.OfferCatalog.createInstance(mongoose.connection);
|
|
19
|
-
const offerCatalogItemRepo = await chevre.repository.OfferCatalogItem.createInstance(mongoose.connection);
|
|
20
|
-
|
|
21
|
-
// startTime = process.hrtime();
|
|
22
|
-
// result = await offerCatalogRepo.searchItemListElementById({
|
|
23
|
-
// id: 'blpc770py',
|
|
24
|
-
// limit: 100,
|
|
25
|
-
// page: 1
|
|
26
|
-
// });
|
|
27
|
-
// diff = process.hrtime(startTime);
|
|
28
|
-
// console.log('diff:', [diff[0], formatter.format(diff[1])]);
|
|
29
|
-
// console.log('result:', result);
|
|
30
|
-
|
|
31
|
-
startTime = process.hrtime();
|
|
32
|
-
result = await offerCatalogRepo.sliceItemListElementById({
|
|
33
|
-
id: 'blpc770py',
|
|
34
|
-
limit: 10,
|
|
35
|
-
page: 1
|
|
36
|
-
});
|
|
37
|
-
diff = process.hrtime(startTime);
|
|
38
|
-
console.log('diff:', [diff[0], formatter.format(diff[1])]);
|
|
39
|
-
console.log('result:', result);
|
|
40
|
-
|
|
41
|
-
startTime = process.hrtime();
|
|
42
|
-
result = await offerCatalogItemRepo.sliceItemListElementById({
|
|
43
|
-
id: '65669285c7b871dba60ed72e',
|
|
44
|
-
limit: 10,
|
|
45
|
-
page: 1
|
|
46
|
-
});
|
|
47
|
-
diff = process.hrtime(startTime);
|
|
48
|
-
console.log('diff:', [diff[0], formatter.format(diff[1])]);
|
|
49
|
-
console.log('result:', result);
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
main()
|
|
53
|
-
.then()
|
|
54
|
-
.catch(console.error);
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
// tslint:disable:no-console
|
|
2
|
-
import mongoose from 'mongoose';
|
|
3
|
-
|
|
4
|
-
import { chevre } from '../../../../lib/index';
|
|
5
|
-
|
|
6
|
-
const formatter = new Intl.NumberFormat('ja-JP');
|
|
7
|
-
|
|
8
|
-
// const PROJECT_ID = process.env.PROJECT_ID;
|
|
9
|
-
mongoose.Model.on('index', (...args) => {
|
|
10
|
-
console.error('******** index event emitted. ********\n', args);
|
|
11
|
-
});
|
|
12
|
-
|
|
13
|
-
async function main() {
|
|
14
|
-
let startTime: [number, number] = process.hrtime();
|
|
15
|
-
let diff: [number, number] = process.hrtime(startTime);
|
|
16
|
-
let result: any;
|
|
17
|
-
|
|
18
|
-
await mongoose.connect(<string>process.env.MONGOLAB_URI, { autoIndex: false });
|
|
19
|
-
|
|
20
|
-
const eventRepo = await chevre.repository.Event.createInstance(mongoose.connection);
|
|
21
|
-
const eventSeriesRepo = await chevre.repository.EventSeries.createInstance(mongoose.connection);
|
|
22
|
-
const offerRepo = await chevre.repository.Offer.createInstance(mongoose.connection);
|
|
23
|
-
const offerCatalogRepo = await chevre.repository.OfferCatalog.createInstance(mongoose.connection);
|
|
24
|
-
const productRepo = await chevre.repository.Product.createInstance(mongoose.connection);
|
|
25
|
-
|
|
26
|
-
startTime = process.hrtime();
|
|
27
|
-
result = await (await chevre.service.offer.createService()).event.searchOfferAppliesToMovieTicket({
|
|
28
|
-
event: {
|
|
29
|
-
id: 'cm8dwc74k'
|
|
30
|
-
},
|
|
31
|
-
limit: 10,
|
|
32
|
-
page: 1,
|
|
33
|
-
store: { id: '51qbjcfr72h62m06vtv5kkhgje' },
|
|
34
|
-
onlyValid: true,
|
|
35
|
-
options: { useIncludeInDataCatalog: false }
|
|
36
|
-
})({
|
|
37
|
-
event: eventRepo,
|
|
38
|
-
eventSeries: eventSeriesRepo,
|
|
39
|
-
offer: offerRepo,
|
|
40
|
-
offerCatalog: offerCatalogRepo,
|
|
41
|
-
product: productRepo
|
|
42
|
-
});
|
|
43
|
-
diff = process.hrtime(startTime);
|
|
44
|
-
console.log(result);
|
|
45
|
-
console.log(result.length);
|
|
46
|
-
console.log('diff:', [diff[0], formatter.format(diff[1])]);
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
main()
|
|
50
|
-
.then(console.log)
|
|
51
|
-
.catch(console.error);
|
|
@@ -1,44 +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
|
-
mongoose.connect(<string>process.env.MONGOLAB_URI, { autoIndex: false });
|
|
9
|
-
|
|
10
|
-
// tslint:disable-next-line:max-func-body-length
|
|
11
|
-
async function main() {
|
|
12
|
-
const offerRepo = await chevre.repository.Offer.createInstance(mongoose.connection);
|
|
13
|
-
|
|
14
|
-
const result = await offerRepo.searchByOfferCatalogIdWithSortIndex({
|
|
15
|
-
offerCatalog: { id: '65669285c7b871dba60ed72e', isOfferCatalogItem: true },
|
|
16
|
-
// availableAtOrFrom: { id: params.store?.id },
|
|
17
|
-
// unacceptedPaymentMethod: params.unacceptedPaymentMethod,
|
|
18
|
-
excludeAppliesToMovieTicket: false,
|
|
19
|
-
priceSpecification: {
|
|
20
|
-
appliesToMovieTicket: {
|
|
21
|
-
// serviceOutput: {
|
|
22
|
-
// typeOf: {
|
|
23
|
-
// ...(typeof req.query.priceSpecification?.appliesToMovieTicket?.serviceOutput?.typeOf?.$eq === 'string')
|
|
24
|
-
// ? { $eq: req.query.priceSpecification.appliesToMovieTicket.serviceOutput.typeOf.$eq }
|
|
25
|
-
// : undefined
|
|
26
|
-
// }
|
|
27
|
-
// },
|
|
28
|
-
serviceType: {
|
|
29
|
-
$exists: false
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
},
|
|
33
|
-
onlyValid: false,
|
|
34
|
-
useIncludeInDataCatalog: true,
|
|
35
|
-
limit: 10,
|
|
36
|
-
page: 1
|
|
37
|
-
});
|
|
38
|
-
console.log('result:', result);
|
|
39
|
-
console.log(result.offers.map(({ name }) => name));
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
main()
|
|
43
|
-
.then()
|
|
44
|
-
.catch(console.error);
|
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
// tslint:disable:no-console
|
|
2
|
-
import mongoose from 'mongoose';
|
|
3
|
-
|
|
4
|
-
import { chevre } from '../../../../lib/index';
|
|
5
|
-
|
|
6
|
-
const formatter = new Intl.NumberFormat('ja-JP');
|
|
7
|
-
|
|
8
|
-
// const PROJECT_ID = process.env.PROJECT_ID;
|
|
9
|
-
mongoose.Model.on('index', (...args) => {
|
|
10
|
-
console.error('******** index event emitted. ********\n', args);
|
|
11
|
-
});
|
|
12
|
-
|
|
13
|
-
async function main() {
|
|
14
|
-
let startTime: [number, number] = process.hrtime();
|
|
15
|
-
let diff: [number, number] = process.hrtime(startTime);
|
|
16
|
-
let result: any;
|
|
17
|
-
|
|
18
|
-
await mongoose.connect(<string>process.env.MONGOLAB_URI, { autoIndex: false });
|
|
19
|
-
|
|
20
|
-
const eventRepo = await chevre.repository.Event.createInstance(mongoose.connection);
|
|
21
|
-
const offerRepo = await chevre.repository.Offer.createInstance(mongoose.connection);
|
|
22
|
-
const offerCatalogRepo = await chevre.repository.OfferCatalog.createInstance(mongoose.connection);
|
|
23
|
-
const productRepo = await chevre.repository.Product.createInstance(mongoose.connection);
|
|
24
|
-
|
|
25
|
-
// startTime = process.hrtime();
|
|
26
|
-
// result = await (await chevre.service.offer.createService()).event.searchOfferCatalogItemAvailability({
|
|
27
|
-
// event: {
|
|
28
|
-
// id: 'cm8dwc74j'
|
|
29
|
-
// },
|
|
30
|
-
// limit: 10,
|
|
31
|
-
// page: 1,
|
|
32
|
-
// availableAtOrFrom: { id: '51qbjcfr72h62m06vtv5kkhgje' },
|
|
33
|
-
// options: { considerUnacceptedPaymentMethod: true, useIncludeInDataCatalog: true }
|
|
34
|
-
// })({
|
|
35
|
-
// event: eventRepo,
|
|
36
|
-
// offer: offerRepo,
|
|
37
|
-
// offerCatalog: offerCatalogRepo,
|
|
38
|
-
// product: productRepo
|
|
39
|
-
// });
|
|
40
|
-
// diff = process.hrtime(startTime);
|
|
41
|
-
// console.log(result);
|
|
42
|
-
// console.log(result.length);
|
|
43
|
-
// console.log('diff:', [diff[0], formatter.format(diff[1])]);
|
|
44
|
-
|
|
45
|
-
startTime = process.hrtime();
|
|
46
|
-
result = await (await chevre.service.offer.createService()).event.searchOfferCatalogItemAvailability({
|
|
47
|
-
event: {
|
|
48
|
-
id: 'cm8dwc74j'
|
|
49
|
-
},
|
|
50
|
-
limit: 10,
|
|
51
|
-
page: 1,
|
|
52
|
-
availableAtOrFrom: { id: '51qbjcfr72h62m06vtv5kkhgje' },
|
|
53
|
-
options: { considerUnacceptedPaymentMethod: true, useIncludeInDataCatalog: false }
|
|
54
|
-
})({
|
|
55
|
-
event: eventRepo,
|
|
56
|
-
offer: offerRepo,
|
|
57
|
-
offerCatalog: offerCatalogRepo,
|
|
58
|
-
product: productRepo
|
|
59
|
-
});
|
|
60
|
-
diff = process.hrtime(startTime);
|
|
61
|
-
console.log(result);
|
|
62
|
-
console.log(result.length);
|
|
63
|
-
console.log('diff:', [diff[0], formatter.format(diff[1])]);
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
main()
|
|
67
|
-
.then(console.log)
|
|
68
|
-
.catch(console.error);
|
|
@@ -1,63 +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 PRICE = 1234;
|
|
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 offerRepo = await chevre.repository.AggregateOffer.createInstance(mongoose.connection);
|
|
14
|
-
|
|
15
|
-
const result = await offerRepo.upsertByIdentifier(
|
|
16
|
-
[
|
|
17
|
-
{
|
|
18
|
-
additionalProperty: [],
|
|
19
|
-
addOn: [],
|
|
20
|
-
alternateName: { en: '', ja: '2024092601' },
|
|
21
|
-
availability: chevre.factory.itemAvailability.InStock,
|
|
22
|
-
availableAtOrFrom: [],
|
|
23
|
-
itemOffered: {
|
|
24
|
-
typeOf: chevre.factory.product.ProductType.EventService,
|
|
25
|
-
serviceOutput: {}
|
|
26
|
-
},
|
|
27
|
-
name: { ja: '2024092601', en: '2024092601' },
|
|
28
|
-
priceCurrency: chevre.factory.priceCurrency.JPY,
|
|
29
|
-
priceSpecification: {
|
|
30
|
-
name: { en: '2024092601', ja: '2024092601' },
|
|
31
|
-
price: PRICE,
|
|
32
|
-
priceCurrency: chevre.factory.priceCurrency.JPY,
|
|
33
|
-
referenceQuantity: {
|
|
34
|
-
typeOf: 'QuantitativeValue',
|
|
35
|
-
value: 1,
|
|
36
|
-
unitCode: chevre.factory.unitCode.C62
|
|
37
|
-
},
|
|
38
|
-
typeOf: chevre.factory.priceSpecificationType.UnitPriceSpecification,
|
|
39
|
-
valueAddedTaxIncluded: true,
|
|
40
|
-
accounting: {
|
|
41
|
-
typeOf: 'Accounting',
|
|
42
|
-
accountsReceivable: PRICE
|
|
43
|
-
}
|
|
44
|
-
},
|
|
45
|
-
settings: { ignoreCategoryCodeChargeSpec: false },
|
|
46
|
-
description: { en: '', ja: '' },
|
|
47
|
-
hasMerchantReturnPolicy: [],
|
|
48
|
-
identifier: '2024092601',
|
|
49
|
-
project: { typeOf: chevre.factory.organizationType.Project, id: PROJECT_ID },
|
|
50
|
-
typeOf: chevre.factory.offerType.Offer
|
|
51
|
-
}
|
|
52
|
-
],
|
|
53
|
-
{
|
|
54
|
-
productType: chevre.factory.product.ProductType.EventService
|
|
55
|
-
}
|
|
56
|
-
);
|
|
57
|
-
// tslint:disable-next-line:no-null-keyword
|
|
58
|
-
console.dir(result, { depth: null });
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
main()
|
|
62
|
-
.then(console.log)
|
|
63
|
-
.catch(console.error);
|
|
@@ -1,61 +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 = { id: String(process.env.PROJECT_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 actionRepo = await chevre.repository.Action.createInstance(mongoose.connection);
|
|
14
|
-
|
|
15
|
-
// tslint:disable-next-line:no-increment-decrement no-magic-numbers
|
|
16
|
-
for (let index = 0; index < 24 * 1000; index++) {
|
|
17
|
-
const updateResult = await actionRepo.unsetUnnecessaryFields({
|
|
18
|
-
filter: {
|
|
19
|
-
typeOf: { $eq: chevre.factory.actionType.UseAction },
|
|
20
|
-
'object.typeOf': { $exists: true, $eq: chevre.factory.reservationType.EventReservation },
|
|
21
|
-
// actionStatus: { $eq: chevre.factory.actionStatusType.CompletedActionStatus },
|
|
22
|
-
startDate: {
|
|
23
|
-
// $exists: true,
|
|
24
|
-
$gte: moment()
|
|
25
|
-
.add(-(index + 1), 'hours')
|
|
26
|
-
.toDate(),
|
|
27
|
-
$lte: moment()
|
|
28
|
-
.add(-index, 'hours')
|
|
29
|
-
.toDate()
|
|
30
|
-
}
|
|
31
|
-
// _id: { $eq: '61da235d94a80f000af85f6b' }
|
|
32
|
-
},
|
|
33
|
-
$unset: {
|
|
34
|
-
'object.0.issuedThrough.availableChannel': 1,
|
|
35
|
-
'object.0.issuedThrough.serviceType': 1,
|
|
36
|
-
'object.0.reservationFor.superEvent': 1,
|
|
37
|
-
'object.0.reservationFor.location': 1,
|
|
38
|
-
'object.0.reservationFor.name': 1,
|
|
39
|
-
'object.0.reservedTicket.issuedBy': 1,
|
|
40
|
-
'object.0.reservedTicket.ticketType.description': 1,
|
|
41
|
-
'object.0.reservedTicket.ticketType.name': 1,
|
|
42
|
-
'object.0.reservedTicket.ticketType.additionalProperty': 1,
|
|
43
|
-
'object.0.reservedTicket.ticketType.category': 1,
|
|
44
|
-
'object.0.reservedTicket.ticketType.color': 1
|
|
45
|
-
}
|
|
46
|
-
});
|
|
47
|
-
console.log(
|
|
48
|
-
'unset processed.', updateResult,
|
|
49
|
-
-index, 'hours',
|
|
50
|
-
moment.duration(index, 'hours')
|
|
51
|
-
.asDays(),
|
|
52
|
-
'days'
|
|
53
|
-
);
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
main()
|
|
58
|
-
.then(() => {
|
|
59
|
-
console.log('success!');
|
|
60
|
-
})
|
|
61
|
-
.catch(console.error);
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
// tslint:disable:object-literal-key-quotes no-console
|
|
2
|
-
import mongoose from 'mongoose';
|
|
3
|
-
|
|
4
|
-
import { chevre } from '../../../../lib/index';
|
|
5
|
-
|
|
6
|
-
async function testGeneration() {
|
|
7
|
-
await mongoose.connect(<string>process.env.MONGOLAB_URI, { autoIndex: false });
|
|
8
|
-
|
|
9
|
-
const orderNumberRepo = await chevre.repository.OrderNumber.createInstance({
|
|
10
|
-
connection: mongoose.connection
|
|
11
|
-
});
|
|
12
|
-
|
|
13
|
-
const ts = new Date(); // 同一ミリ秒固定
|
|
14
|
-
const results: Record<string, string>[] = [];
|
|
15
|
-
|
|
16
|
-
console.log(`--- 同一ミリ秒(${ts})内での連続生成テスト ---`);
|
|
17
|
-
|
|
18
|
-
// tslint:disable-next-line:no-magic-numbers
|
|
19
|
-
for (let i = 0; i < 100; i += 1) {
|
|
20
|
-
// 同一ミリ秒内でシーケンス(00-99)だけが変わる状況を再現
|
|
21
|
-
const orderNumber = await orderNumberRepo.publishByTimestamp({
|
|
22
|
-
project: { alternateName: 'CIN' },
|
|
23
|
-
orderDate: ts
|
|
24
|
-
|
|
25
|
-
});
|
|
26
|
-
|
|
27
|
-
// 復号して元のデータに戻るかチェック
|
|
28
|
-
let decoded: string;
|
|
29
|
-
let isSuccess: boolean = false;
|
|
30
|
-
try {
|
|
31
|
-
decoded = await orderNumberRepo.decrypt(orderNumber);
|
|
32
|
-
isSuccess = decoded === `${ts.valueOf()}${(i + 1).toString()
|
|
33
|
-
// tslint:disable-next-line:no-magic-numbers
|
|
34
|
-
.padStart(2, '0')}`;
|
|
35
|
-
} catch (error) {
|
|
36
|
-
decoded = error.message;
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
results.push({
|
|
40
|
-
timestamp: ts.valueOf()
|
|
41
|
-
.toString(),
|
|
42
|
-
'シーケンス': (i + 1).toString(),
|
|
43
|
-
'生成された番号 (17桁)': orderNumber,
|
|
44
|
-
// tslint:disable-next-line:no-magic-numbers
|
|
45
|
-
'ソルト(2文字目)': orderNumber[2],
|
|
46
|
-
'復号結果': decoded,
|
|
47
|
-
'復号確認': isSuccess ? '✅OK' : '❌NG'
|
|
48
|
-
});
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
console.table(results);
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
testGeneration();
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
// tslint:disable:no-console
|
|
2
|
-
import mongoose from 'mongoose';
|
|
3
|
-
|
|
4
|
-
import { chevre } from '../../../../lib/index';
|
|
5
|
-
|
|
6
|
-
mongoose.Model.on('index', (...args) => {
|
|
7
|
-
console.error('******** index event emitted. ********\n', args);
|
|
8
|
-
});
|
|
9
|
-
|
|
10
|
-
async function main() {
|
|
11
|
-
await mongoose.connect(<string>process.env.MONGOLAB_URI);
|
|
12
|
-
|
|
13
|
-
const orderRepo = await chevre.repository.Order.createInstance(mongoose.connection);
|
|
14
|
-
|
|
15
|
-
const orders = await orderRepo.projectFields(
|
|
16
|
-
{
|
|
17
|
-
limit: 1,
|
|
18
|
-
page: 1
|
|
19
|
-
},
|
|
20
|
-
{ inclusion: ['customer.id', 'customer.typeOf'] }
|
|
21
|
-
);
|
|
22
|
-
// tslint:disable-next-line:no-null-keyword
|
|
23
|
-
console.dir(orders, { depth: null });
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
main()
|
|
27
|
-
.then()
|
|
28
|
-
.catch(console.error);
|