@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,51 +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 indexes = await mongoose.connection.db.collection('aggregateOffers')
|
|
14
|
-
.indexes();
|
|
15
|
-
console.log(indexes);
|
|
16
|
-
console.log(indexes.length);
|
|
17
|
-
|
|
18
|
-
const aggregateOfferRepo = await chevre.repository.AggregateOffer.createInstance(mongoose.connection);
|
|
19
|
-
|
|
20
|
-
const offers = await aggregateOfferRepo.search(
|
|
21
|
-
{
|
|
22
|
-
limit: 10,
|
|
23
|
-
// page: 1,
|
|
24
|
-
project: { id: { $eq: String(process.env.PROJECT_ID) } },
|
|
25
|
-
availability: { $eq: chevre.factory.itemAvailability.InStock },
|
|
26
|
-
itemOffered: { typeOf: { $eq: chevre.factory.product.ProductType.EventService } },
|
|
27
|
-
acceptedPaymentMethod: { identifier: { $in: ['xxx'] } },
|
|
28
|
-
// identifier: { $eq: '901' },
|
|
29
|
-
sort: {
|
|
30
|
-
'priceSpecification.price': 1,
|
|
31
|
-
identifier: 1
|
|
32
|
-
}
|
|
33
|
-
},
|
|
34
|
-
{
|
|
35
|
-
id: 1,
|
|
36
|
-
identifier: 1,
|
|
37
|
-
name: 1,
|
|
38
|
-
priceSpecification: 1
|
|
39
|
-
}
|
|
40
|
-
);
|
|
41
|
-
console.log(offers);
|
|
42
|
-
console.log(offers[0]?.offers);
|
|
43
|
-
console.log(offers.map((offer) => {
|
|
44
|
-
return `${offer.project.id} ${(<any>offer).offerCount} ${offer.offers[0].identifier} ${offer.offers[0].name.ja} ${offer.offers[0].priceSpecification.price}`;
|
|
45
|
-
}));
|
|
46
|
-
console.log(offers.length);
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
main()
|
|
50
|
-
.then(console.log)
|
|
51
|
-
.catch(console.error);
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
// tslint:disable:no-implicit-dependencies no-console
|
|
2
|
-
import { chevre } from '../../../lib/index';
|
|
3
|
-
|
|
4
|
-
import moment from 'moment';
|
|
5
|
-
import * as mongoose from 'mongoose';
|
|
6
|
-
|
|
7
|
-
// const project = { id: String(process.env.PROJECT_ID) };
|
|
8
|
-
|
|
9
|
-
mongoose.Model.on('index', (...args) => {
|
|
10
|
-
console.error('******** index event emitted. ********\n', args);
|
|
11
|
-
});
|
|
12
|
-
|
|
13
|
-
async function main() {
|
|
14
|
-
await mongoose.connect(<string>process.env.MONGOLAB_URI, { autoIndex: false });
|
|
15
|
-
|
|
16
|
-
const now = new Date();
|
|
17
|
-
const limit = 100;
|
|
18
|
-
const page = 1;
|
|
19
|
-
const aggregationRepo = await chevre.repository.Aggregation.createInstance(mongoose.connection);
|
|
20
|
-
const aggregations = await aggregationRepo.search({
|
|
21
|
-
limit,
|
|
22
|
-
page,
|
|
23
|
-
typeOf: { $eq: 'AggregateAuthorizeEventServiceOfferAction' },
|
|
24
|
-
aggregateDuration: { $eq: 'P1D' },
|
|
25
|
-
aggregateStart: {
|
|
26
|
-
$gte: moment(now)
|
|
27
|
-
.add(-1, 'months')
|
|
28
|
-
.toDate(),
|
|
29
|
-
$lte: now
|
|
30
|
-
}
|
|
31
|
-
});
|
|
32
|
-
|
|
33
|
-
// console.log('aggregations:', aggregations);
|
|
34
|
-
console.log(aggregations.length, 'aggregations found');
|
|
35
|
-
|
|
36
|
-
// const cleanResult = await aggregationRepo.deleteAggregateStartPassedCertainPeriod({
|
|
37
|
-
// aggregateStart: {
|
|
38
|
-
// $lt: moment()
|
|
39
|
-
// .add(-1, 'year')
|
|
40
|
-
// .toDate()
|
|
41
|
-
// }
|
|
42
|
-
// });
|
|
43
|
-
// console.log('cleanResult:', cleanResult);
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
main()
|
|
47
|
-
.then(() => {
|
|
48
|
-
console.log('success!');
|
|
49
|
-
})
|
|
50
|
-
.catch(console.error);
|
|
@@ -1,36 +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.Model.on('index', (...args) => {
|
|
9
|
-
console.error('******** index event emitted. ********\n', args);
|
|
10
|
-
});
|
|
11
|
-
|
|
12
|
-
async function main() {
|
|
13
|
-
await mongoose.connect(<string>process.env.MONGOLAB_URI, { autoIndex: false });
|
|
14
|
-
|
|
15
|
-
const indexes = await mongoose.connection.db.collection('authorizations')
|
|
16
|
-
.indexes();
|
|
17
|
-
// console.log(indexes);
|
|
18
|
-
console.log(indexes.length, 'indexes found');
|
|
19
|
-
|
|
20
|
-
const authorizationRepo = await chevre.repository.Authorization.createInstance(mongoose.connection);
|
|
21
|
-
|
|
22
|
-
const docs = await authorizationRepo.projectFields(
|
|
23
|
-
{
|
|
24
|
-
limit: 10,
|
|
25
|
-
project: { id: { $eq: project.id } }
|
|
26
|
-
// audience: { id: { $eq: '6749bd9b84c1b2a0759cbfc8' } }
|
|
27
|
-
},
|
|
28
|
-
['code']
|
|
29
|
-
);
|
|
30
|
-
console.log('docs found', docs);
|
|
31
|
-
console.log(docs.length, 'docs found');
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
main()
|
|
35
|
-
.then()
|
|
36
|
-
.catch(console.error);
|
|
@@ -1,56 +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);
|
|
10
|
-
|
|
11
|
-
const actionRepo = await chevre.repository.Action.createInstance(mongoose.connection);
|
|
12
|
-
|
|
13
|
-
// let mkknInfos = await actionRepo.searchMkknInfoByCheckMovieTicketResult({
|
|
14
|
-
// limit: 10,
|
|
15
|
-
// page: 1,
|
|
16
|
-
// id: '666171386c7acb70fd9a44ec',
|
|
17
|
-
// project: { id: project.id },
|
|
18
|
-
// purpose: { id: '6661712a6c7acb70fd9a44a8' }
|
|
19
|
-
// });
|
|
20
|
-
// console.log('mkknInfos found', mkknInfos);
|
|
21
|
-
// console.log(mkknInfos.length, 'infos found');
|
|
22
|
-
|
|
23
|
-
const mkknInfos = await actionRepo.searchMkknInfoByCheckRecipe({
|
|
24
|
-
limit: 10,
|
|
25
|
-
page: 1,
|
|
26
|
-
id: '666171386c7acb70fd9a44ec',
|
|
27
|
-
project: { id: project.id },
|
|
28
|
-
purpose: { id: '6661712a6c7acb70fd9a44a8' }
|
|
29
|
-
});
|
|
30
|
-
console.log('mkknInfos found', mkknInfos);
|
|
31
|
-
console.log(mkknInfos.length, 'infos found');
|
|
32
|
-
|
|
33
|
-
// let ykknInfos = await actionRepo.searchYkknInfoByCheckMovieTicketResult({
|
|
34
|
-
// limit: 10,
|
|
35
|
-
// page: 1,
|
|
36
|
-
// id: '666171386c7acb70fd9a44ec',
|
|
37
|
-
// project: { id: project.id },
|
|
38
|
-
// purpose: { id: '6661712a6c7acb70fd9a44a8' }
|
|
39
|
-
// });
|
|
40
|
-
// console.log('ykknInfos found', ykknInfos);
|
|
41
|
-
// console.log(ykknInfos.length, 'infos found');
|
|
42
|
-
|
|
43
|
-
const ykknInfos = await actionRepo.searchYkknInfoByCheckRecipe({
|
|
44
|
-
limit: 10,
|
|
45
|
-
page: 1,
|
|
46
|
-
id: '666171386c7acb70fd9a44ec',
|
|
47
|
-
project: { id: project.id },
|
|
48
|
-
purpose: { id: '6661712a6c7acb70fd9a44a8' }
|
|
49
|
-
});
|
|
50
|
-
console.log('ykknInfos found', ykknInfos);
|
|
51
|
-
console.log(ykknInfos.length, 'infos found');
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
main()
|
|
55
|
-
.then()
|
|
56
|
-
.catch(console.error);
|
|
@@ -1,43 +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);
|
|
10
|
-
|
|
11
|
-
const eventRepo = await chevre.repository.Event.createInstance(mongoose.connection);
|
|
12
|
-
const productRepo = await chevre.repository.Product.createInstance(mongoose.connection);
|
|
13
|
-
|
|
14
|
-
const event = (await eventRepo.projectEventFields(
|
|
15
|
-
{
|
|
16
|
-
id: { $eq: 'bm0f0cadm' },
|
|
17
|
-
typeOf: chevre.factory.eventType.ScreeningEvent,
|
|
18
|
-
project: { id: { $eq: project.id } }
|
|
19
|
-
},
|
|
20
|
-
['offers.itemOffered.id']
|
|
21
|
-
)).shift();
|
|
22
|
-
console.log('event:', event);
|
|
23
|
-
if (event === undefined) {
|
|
24
|
-
throw new Error('event not found');
|
|
25
|
-
}
|
|
26
|
-
const productId = event.offers.itemOffered.id;
|
|
27
|
-
if (typeof productId !== 'string') {
|
|
28
|
-
throw new Error('offers.itemOffered.id undefined');
|
|
29
|
-
}
|
|
30
|
-
const catalogs = await productRepo.aggregateHasOfferCatalog(
|
|
31
|
-
{
|
|
32
|
-
id: productId,
|
|
33
|
-
limit: 10,
|
|
34
|
-
page: 1
|
|
35
|
-
}
|
|
36
|
-
);
|
|
37
|
-
console.log(catalogs);
|
|
38
|
-
console.log(catalogs.length);
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
main()
|
|
42
|
-
.then(console.log)
|
|
43
|
-
.catch(console.error);
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
// tslint:disable:no-console
|
|
2
|
-
import * as mongoose from 'mongoose';
|
|
3
|
-
import * as redis from 'redis';
|
|
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
|
-
const client = redis.createClient<redis.RedisDefaultModules, Record<string, never>, Record<string, never>>({
|
|
12
|
-
socket: {
|
|
13
|
-
port: Number(<string>process.env.REDIS_PORT),
|
|
14
|
-
host: <string>process.env.REDIS_HOST
|
|
15
|
-
},
|
|
16
|
-
password: <string>process.env.REDIS_KEY
|
|
17
|
-
});
|
|
18
|
-
await client.connect();
|
|
19
|
-
|
|
20
|
-
const itemAvailabilityRepo = await chevre.repository.StockHolder.createInstance({ connection: mongoose.connection });
|
|
21
|
-
|
|
22
|
-
const result = await itemAvailabilityRepo.searchHolders({
|
|
23
|
-
project,
|
|
24
|
-
eventId: 'alckc9mlx',
|
|
25
|
-
startDate: new Date(),
|
|
26
|
-
hasTicketedSeat: true,
|
|
27
|
-
offers: [
|
|
28
|
-
{
|
|
29
|
-
seatSection: 'Default',
|
|
30
|
-
seatNumber: 'B-10'
|
|
31
|
-
},
|
|
32
|
-
{
|
|
33
|
-
seatSection: 'xxx',
|
|
34
|
-
seatNumber: 'xxx'
|
|
35
|
-
}
|
|
36
|
-
]
|
|
37
|
-
});
|
|
38
|
-
console.log(result);
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
main()
|
|
42
|
-
.then(() => {
|
|
43
|
-
console.log('success!');
|
|
44
|
-
})
|
|
45
|
-
.catch(console.error);
|
|
@@ -1,16 +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, { autoIndex: false });
|
|
8
|
-
const reservationRepo = await chevre.repository.Reservation.createInstance(mongoose.connection);
|
|
9
|
-
const ids = await reservationRepo.searchIdsByReservationNumber({ reservationNumber: { $in: ['283297254100608'] } });
|
|
10
|
-
console.log(ids);
|
|
11
|
-
console.log(ids.length, 'reservations found');
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
main()
|
|
15
|
-
.then(console.log)
|
|
16
|
-
.catch(console.error);
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
// tslint:disable:no-implicit-dependencies no-console
|
|
2
|
-
import { chevre } from '../../../lib/index';
|
|
3
|
-
|
|
4
|
-
import * as mongoose from 'mongoose';
|
|
5
|
-
|
|
6
|
-
const project = { id: String(process.env.PROJECT_ID) };
|
|
7
|
-
|
|
8
|
-
mongoose.Model.on('index', (...args) => {
|
|
9
|
-
console.error('******** index event emitted. ********\n', args);
|
|
10
|
-
});
|
|
11
|
-
|
|
12
|
-
async function main() {
|
|
13
|
-
await mongoose.connect(<string>process.env.MONGOLAB_URI, { autoIndex: false });
|
|
14
|
-
|
|
15
|
-
const limit = 100;
|
|
16
|
-
const page = 1;
|
|
17
|
-
const memberRepo = await chevre.repository.Member.createInstance(mongoose.connection);
|
|
18
|
-
const members = await memberRepo.projectFieldsByProjectId(
|
|
19
|
-
{ id: project.id },
|
|
20
|
-
{
|
|
21
|
-
limit,
|
|
22
|
-
page,
|
|
23
|
-
member: {
|
|
24
|
-
typeOf: {
|
|
25
|
-
// $eq: chevre.factory.creativeWorkType.WebApplication
|
|
26
|
-
// $eq: chevre.factory.personType.Person
|
|
27
|
-
},
|
|
28
|
-
memberOf: { typeOf: { $eq: chevre.factory.organizationType.Project } }
|
|
29
|
-
}
|
|
30
|
-
},
|
|
31
|
-
[]
|
|
32
|
-
);
|
|
33
|
-
console.log('members:', members);
|
|
34
|
-
console.log(members.length, 'members found');
|
|
35
|
-
|
|
36
|
-
const customerMembers = await memberRepo.searchCustomerMembers(
|
|
37
|
-
{
|
|
38
|
-
limit: 10,
|
|
39
|
-
page: 1,
|
|
40
|
-
sort: { 'member.id': chevre.factory.sortType.Ascending },
|
|
41
|
-
project: { id: project.id },
|
|
42
|
-
member: {
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
);
|
|
46
|
-
// tslint:disable-next-line:no-null-keyword
|
|
47
|
-
console.dir(customerMembers, { depth: null });
|
|
48
|
-
console.log(customerMembers.length, 'customerMembers found');
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
main()
|
|
52
|
-
.then(() => {
|
|
53
|
-
console.log('success!');
|
|
54
|
-
})
|
|
55
|
-
.catch(console.error);
|
|
@@ -1,26 +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
|
-
const result = await offerCatalogRepo.searchItemListElement({
|
|
17
|
-
id: { $in: ['blpj322ni', 'blpc770py', 'xxxx', 'blos0d5gu'] },
|
|
18
|
-
itemListElement: { id: { $in: ['xxx', '65669285c7b871dba60ed72e', '65669285c7b871dba60ed742', '1008'] } }
|
|
19
|
-
});
|
|
20
|
-
console.log(result);
|
|
21
|
-
console.log(result.length);
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
main()
|
|
25
|
-
.then(console.log)
|
|
26
|
-
.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
|
-
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 indexes = await mongoose.connection.db.collection('aggregateOffers')
|
|
14
|
-
// .indexes();
|
|
15
|
-
// console.log(indexes);
|
|
16
|
-
// console.log(indexes.length);
|
|
17
|
-
|
|
18
|
-
const offerRepo = await chevre.repository.Offer.createInstance(mongoose.connection);
|
|
19
|
-
|
|
20
|
-
const offers = await offerRepo.search(
|
|
21
|
-
{
|
|
22
|
-
limit: 3,
|
|
23
|
-
// page: 1,
|
|
24
|
-
sort: { identifier: chevre.factory.sortType.Descending },
|
|
25
|
-
project: { id: { $eq: String(process.env.PROJECT_ID) } },
|
|
26
|
-
availability: { $eq: chevre.factory.itemAvailability.InStock },
|
|
27
|
-
// acceptedPaymentMethod: { identifier: { $in: ['xxx'] } },
|
|
28
|
-
parentOffer: {
|
|
29
|
-
}
|
|
30
|
-
// priceSpecification: {
|
|
31
|
-
// appliesToMovieTicket: {
|
|
32
|
-
// $size: 2,
|
|
33
|
-
// serviceOutput: {
|
|
34
|
-
// typeOf: {
|
|
35
|
-
// }
|
|
36
|
-
// }
|
|
37
|
-
// }
|
|
38
|
-
// }
|
|
39
|
-
// includedInDataCatalog: { id: { $in: ['0001'] } }
|
|
40
|
-
// additionalProperty: {
|
|
41
|
-
// $all: [
|
|
42
|
-
// {
|
|
43
|
-
// $elemMatch: {
|
|
44
|
-
// name: { $eq: 'theaterCode' },
|
|
45
|
-
// value: { $in: ['120'] }
|
|
46
|
-
// }
|
|
47
|
-
// },
|
|
48
|
-
// {
|
|
49
|
-
// $elemMatch: {
|
|
50
|
-
// name: { $eq: 'ticketCode' },
|
|
51
|
-
// value: { $in: ['10', '1001'] }
|
|
52
|
-
// }
|
|
53
|
-
// }
|
|
54
|
-
// ]
|
|
55
|
-
// }
|
|
56
|
-
},
|
|
57
|
-
{ project: 1, name: 1, identifier: 1 }
|
|
58
|
-
);
|
|
59
|
-
console.log(offers.map((offer) => {
|
|
60
|
-
return `${offer.project?.id} ${offer.id} ${offer.parentOffer?.id} ${offer.identifier} ${offer.name?.ja}`;
|
|
61
|
-
}));
|
|
62
|
-
// console.log(offers);
|
|
63
|
-
console.log(offers.length);
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
main()
|
|
67
|
-
.then(console.log)
|
|
68
|
-
.catch(console.error);
|
|
@@ -1,28 +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);
|
|
10
|
-
|
|
11
|
-
const productRepo = await chevre.repository.Product.createInstance(mongoose.connection);
|
|
12
|
-
|
|
13
|
-
const products = await productRepo.projectFields(
|
|
14
|
-
{
|
|
15
|
-
limit: 10,
|
|
16
|
-
project: { id: { $eq: PROJECT_ID } },
|
|
17
|
-
additionalPropertyMatch: { nameEq: 'xxxxx' }
|
|
18
|
-
// seller: { id: { $eq: 'xxx' } }
|
|
19
|
-
},
|
|
20
|
-
['additionalProperty', 'productID']
|
|
21
|
-
);
|
|
22
|
-
console.log(products);
|
|
23
|
-
console.log(products.length, 'products found');
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
main()
|
|
27
|
-
.then(console.log)
|
|
28
|
-
.catch(console.error);
|
|
@@ -1,36 +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 projectRepo = await chevre.repository.Project.createInstance(mongoose.connection);
|
|
12
|
-
|
|
13
|
-
const project = await projectRepo.findById({
|
|
14
|
-
id: PROJECT_ID,
|
|
15
|
-
inclusion: ['settings']
|
|
16
|
-
});
|
|
17
|
-
console.log('project:', project);
|
|
18
|
-
|
|
19
|
-
const projects = await projectRepo.projectFields(
|
|
20
|
-
{
|
|
21
|
-
limit: 1,
|
|
22
|
-
page: 1,
|
|
23
|
-
id: { $eq: project.id }
|
|
24
|
-
},
|
|
25
|
-
['typeOf']
|
|
26
|
-
);
|
|
27
|
-
console.log(projects);
|
|
28
|
-
console.log(projects.length, 'projects found');
|
|
29
|
-
|
|
30
|
-
const findAlternateNameByIdReulst = await projectRepo.findAlternateNameById({ id: project.id });
|
|
31
|
-
console.log('findAlternateNameByIdReulst:', findAlternateNameByIdReulst);
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
main()
|
|
35
|
-
.then(console.log)
|
|
36
|
-
.catch(console.error);
|
|
@@ -1,42 +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 coaAuthClient = new (await chevre.loadCOA()).auth.RefreshToken({
|
|
12
|
-
endpoint: '',
|
|
13
|
-
refreshToken: '',
|
|
14
|
-
useFetch: true
|
|
15
|
-
});
|
|
16
|
-
|
|
17
|
-
const { reservations } = await (await chevre.service.reserve.createService()).searchByOrder({
|
|
18
|
-
limit: 10,
|
|
19
|
-
page: 1,
|
|
20
|
-
project: { id: project.id },
|
|
21
|
-
orderNumber: 'CIN3-0760465-8981560',
|
|
22
|
-
typeOf: chevre.factory.reservationType.EventReservation
|
|
23
|
-
})({
|
|
24
|
-
acceptedOffer: await chevre.repository.AcceptedOffer.createInstance(mongoose.connection),
|
|
25
|
-
order: await chevre.repository.Order.createInstance(mongoose.connection),
|
|
26
|
-
reservation: await chevre.repository.Reservation.createInstance(mongoose.connection),
|
|
27
|
-
reserveService: new (await chevre.loadCOA()).service.Reserve(
|
|
28
|
-
{
|
|
29
|
-
endpoint: '',
|
|
30
|
-
auth: coaAuthClient
|
|
31
|
-
},
|
|
32
|
-
{ timeout: 20000 }
|
|
33
|
-
)
|
|
34
|
-
});
|
|
35
|
-
|
|
36
|
-
console.log(reservations);
|
|
37
|
-
console.log(reservations.length, 'reservations found');
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
main()
|
|
41
|
-
.then(console.log)
|
|
42
|
-
.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
|
-
|
|
8
|
-
async function main() {
|
|
9
|
-
await mongoose.connect(<string>process.env.MONGOLAB_URI);
|
|
10
|
-
|
|
11
|
-
const sellerRepo = await chevre.repository.Seller.createInstance(mongoose.connection);
|
|
12
|
-
|
|
13
|
-
const sellersByAggregate = await sellerRepo.searchByAggregate(
|
|
14
|
-
{
|
|
15
|
-
limit: 10,
|
|
16
|
-
page: 1,
|
|
17
|
-
sort: { branchCode: chevre.factory.sortType.Descending },
|
|
18
|
-
// id: { $eq: '59d20831e53ebc2b4e774466' }
|
|
19
|
-
project: { id: { $eq: project.id } }
|
|
20
|
-
// paymentAccepted: { paymentMethodType: { $eq: 'Cash' } },
|
|
21
|
-
// hasMerchantReturnPolicy: { applicablePaymentMethod: {} }
|
|
22
|
-
},
|
|
23
|
-
['additionalProperty', 'project', 'name', 'typeOf', 'url', 'telephone']
|
|
24
|
-
);
|
|
25
|
-
// tslint:disable-next-line:no-null-keyword
|
|
26
|
-
console.dir(sellersByAggregate, { depth: null });
|
|
27
|
-
console.log('sellers found', sellersByAggregate, sellersByAggregate[0]?.hasMerchantReturnPolicy);
|
|
28
|
-
console.log(sellersByAggregate.length, 'sellers found');
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
main()
|
|
32
|
-
.then()
|
|
33
|
-
.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 limit = 1;
|
|
10
|
-
const page = 2;
|
|
11
|
-
const acceptedOfferRepo = await chevre.repository.AcceptedOffer.createInstance(mongoose.connection);
|
|
12
|
-
|
|
13
|
-
const result = await acceptedOfferRepo.searchSlicedAcceptedOffersByOrderNumber(
|
|
14
|
-
{
|
|
15
|
-
orderNumber: { $eq: 'TTT6-4203485-8379924' },
|
|
16
|
-
// project: { id: { $eq: String(process.env.PROJECT_ID) } },
|
|
17
|
-
project: { id: { $eq: 'ttts-development' } },
|
|
18
|
-
// tslint:disable-next-line:no-magic-numbers
|
|
19
|
-
$slice: [limit * (page - 1), limit]
|
|
20
|
-
}
|
|
21
|
-
);
|
|
22
|
-
console.log(result);
|
|
23
|
-
console.log(result.acceptedOffers.map((offer) => {
|
|
24
|
-
return `${(<any>offer.itemOffered).id}`;
|
|
25
|
-
}));
|
|
26
|
-
console.log(result.acceptedOffers.length);
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
main()
|
|
30
|
-
.then(console.log)
|
|
31
|
-
.catch(console.error);
|