@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,83 +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
|
-
/**
|
|
9
|
-
* 指定する施設コード
|
|
10
|
-
*/
|
|
11
|
-
const locationBranchCode = '120';
|
|
12
|
-
/**
|
|
13
|
-
* 指定するタイトルコード
|
|
14
|
-
*/
|
|
15
|
-
const titleCode = '80001';
|
|
16
|
-
/**
|
|
17
|
-
* 指定するタイトル枝番
|
|
18
|
-
*/
|
|
19
|
-
const titleBranchNum = '0';
|
|
20
|
-
|
|
21
|
-
async function main() {
|
|
22
|
-
await mongoose.connect(<string>process.env.MONGOLAB_URI, { autoIndex: false });
|
|
23
|
-
|
|
24
|
-
const categoryCodeRepo = await chevre.repository.CategoryCode.createInstance(mongoose.connection);
|
|
25
|
-
const creativeWorkRepo = await chevre.repository.CreativeWork.createInstance(mongoose.connection);
|
|
26
|
-
const eventSeriesRepo = await chevre.repository.EventSeries.createInstance(mongoose.connection);
|
|
27
|
-
const movieTheaterRepo = await chevre.repository.place.MovieTheater.createInstance(mongoose.connection);
|
|
28
|
-
|
|
29
|
-
const coaAuthClient = new (await chevre.loadCOA()).auth.RefreshToken({
|
|
30
|
-
endpoint: String(process.env.COA_ENDPOINT),
|
|
31
|
-
refreshToken: process.env.COA_REFRESH_TOKEN,
|
|
32
|
-
useFetch: true
|
|
33
|
-
});
|
|
34
|
-
const masterService = new (await chevre.loadCOA()).service.Master(
|
|
35
|
-
{
|
|
36
|
-
endpoint: String(process.env.COA_ENDPOINT),
|
|
37
|
-
auth: coaAuthClient
|
|
38
|
-
},
|
|
39
|
-
{ timeout: 20000 }
|
|
40
|
-
);
|
|
41
|
-
|
|
42
|
-
const movieTheater = (await movieTheaterRepo.projectFields(
|
|
43
|
-
{
|
|
44
|
-
limit: 1,
|
|
45
|
-
page: 1,
|
|
46
|
-
project: { id: { $eq: project.id } },
|
|
47
|
-
branchCode: { $eq: locationBranchCode }
|
|
48
|
-
},
|
|
49
|
-
['id', 'typeOf', 'branchCode', 'name', 'kanaName', 'parentOrganization']
|
|
50
|
-
// []
|
|
51
|
-
)).shift();
|
|
52
|
-
if (movieTheater === undefined) {
|
|
53
|
-
throw new Error('movieTheater not found');
|
|
54
|
-
}
|
|
55
|
-
console.log('movieTheater:', movieTheater);
|
|
56
|
-
|
|
57
|
-
const result = await (await chevre.service.event.createService()).saveScreeningEventSeries(
|
|
58
|
-
{
|
|
59
|
-
project: { id: project.id, typeOf: chevre.factory.organizationType.Project },
|
|
60
|
-
seller: { id: movieTheater.parentOrganization.id },
|
|
61
|
-
movieTheater,
|
|
62
|
-
locationBranchCode,
|
|
63
|
-
saveScreeningEventSeries: true,
|
|
64
|
-
saveScreeningEventSeriesPeriodInMonth: 3
|
|
65
|
-
},
|
|
66
|
-
{
|
|
67
|
-
filterFilmsFromCOA: {
|
|
68
|
-
titleBranchNum,
|
|
69
|
-
titleCode
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
)({
|
|
73
|
-
categoryCode: categoryCodeRepo,
|
|
74
|
-
creativeWork: creativeWorkRepo,
|
|
75
|
-
eventSeries: eventSeriesRepo,
|
|
76
|
-
masterService
|
|
77
|
-
});
|
|
78
|
-
console.log('result:', result.savedEventsCount, result.screeningEventSerieses.length);
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
main()
|
|
82
|
-
.then(console.log)
|
|
83
|
-
.catch(console.error);
|
|
@@ -1,148 +0,0 @@
|
|
|
1
|
-
// tslint:disable:no-console
|
|
2
|
-
import moment from 'moment-timezone';
|
|
3
|
-
import mongoose from 'mongoose';
|
|
4
|
-
|
|
5
|
-
import { createScreeningEventSeriesId } from '../../../../lib/chevre/service/event/saveScreeningEventSeries';
|
|
6
|
-
import { chevre } from '../../../../lib/index';
|
|
7
|
-
|
|
8
|
-
const project = { id: String(process.env.PROJECT_ID) };
|
|
9
|
-
|
|
10
|
-
/**
|
|
11
|
-
* 指定する施設コード
|
|
12
|
-
*/
|
|
13
|
-
const locationBranchCode = '120';
|
|
14
|
-
/**
|
|
15
|
-
* 指定するルームコード
|
|
16
|
-
*/
|
|
17
|
-
const roomCode = '30';
|
|
18
|
-
/**
|
|
19
|
-
* 指定するタイトルコード
|
|
20
|
-
*/
|
|
21
|
-
const titleCode = '99100';
|
|
22
|
-
/**
|
|
23
|
-
* 指定するタイトル枝番
|
|
24
|
-
*/
|
|
25
|
-
const titleBranchNum = '0';
|
|
26
|
-
/**
|
|
27
|
-
* 指定するスケジュールの開始日(日本時間)
|
|
28
|
-
*/
|
|
29
|
-
const importDay = new Date();
|
|
30
|
-
|
|
31
|
-
// tslint:disable-next-line:max-func-body-length
|
|
32
|
-
async function main() {
|
|
33
|
-
await mongoose.connect(<string>process.env.MONGOLAB_URI, { autoIndex: false });
|
|
34
|
-
|
|
35
|
-
const categoryCodeRepo = await chevre.repository.CategoryCode.createInstance(mongoose.connection);
|
|
36
|
-
const creativeWorkRepo = await chevre.repository.CreativeWork.createInstance(mongoose.connection);
|
|
37
|
-
const eventRepo = await chevre.repository.Event.createInstance(mongoose.connection);
|
|
38
|
-
const eventSeriesRepo = await chevre.repository.EventSeries.createInstance(mongoose.connection);
|
|
39
|
-
const movieTheaterRepo = await chevre.repository.place.MovieTheater.createInstance(mongoose.connection);
|
|
40
|
-
const roomRepo = await chevre.repository.place.ScreeningRoom.createInstance(mongoose.connection);
|
|
41
|
-
|
|
42
|
-
const coaAuthClient = new (await chevre.loadCOA()).auth.RefreshToken({
|
|
43
|
-
endpoint: String(process.env.COA_ENDPOINT),
|
|
44
|
-
refreshToken: process.env.COA_REFRESH_TOKEN,
|
|
45
|
-
useFetch: true
|
|
46
|
-
});
|
|
47
|
-
const masterService = new (await chevre.loadCOA()).service.Master(
|
|
48
|
-
{
|
|
49
|
-
endpoint: String(process.env.COA_ENDPOINT),
|
|
50
|
-
auth: coaAuthClient
|
|
51
|
-
},
|
|
52
|
-
{ timeout: 20000 }
|
|
53
|
-
);
|
|
54
|
-
|
|
55
|
-
const movieTheater = (await movieTheaterRepo.projectFields(
|
|
56
|
-
{
|
|
57
|
-
limit: 1,
|
|
58
|
-
page: 1,
|
|
59
|
-
project: { id: { $eq: project.id } },
|
|
60
|
-
branchCode: { $eq: locationBranchCode }
|
|
61
|
-
},
|
|
62
|
-
['id', 'typeOf', 'branchCode', 'name', 'kanaName', 'parentOrganization']
|
|
63
|
-
// []
|
|
64
|
-
)).shift();
|
|
65
|
-
if (movieTheater === undefined) {
|
|
66
|
-
throw new Error('movieTheater not found');
|
|
67
|
-
}
|
|
68
|
-
console.log('movieTheater:', movieTheater);
|
|
69
|
-
|
|
70
|
-
const screeningRooms = await roomRepo.findRooms({
|
|
71
|
-
project: { id: { $eq: project.id } },
|
|
72
|
-
containedInPlace: { branchCode: { $eq: movieTheater.branchCode } },
|
|
73
|
-
branchCode: { $eq: roomCode }
|
|
74
|
-
});
|
|
75
|
-
console.log(screeningRooms);
|
|
76
|
-
|
|
77
|
-
const eventSeriesId = createScreeningEventSeriesId({
|
|
78
|
-
theaterCode: locationBranchCode,
|
|
79
|
-
titleCode,
|
|
80
|
-
titleBranchNum
|
|
81
|
-
});
|
|
82
|
-
const eventSeries = (await eventSeriesRepo.projectEventSeriesFields(
|
|
83
|
-
{
|
|
84
|
-
id: { $eq: eventSeriesId },
|
|
85
|
-
project: { id: { $eq: project.id } }
|
|
86
|
-
},
|
|
87
|
-
[
|
|
88
|
-
'project', 'typeOf', 'eventStatus', 'identifier',
|
|
89
|
-
'name', 'kanaName', 'alternativeHeadline', 'location',
|
|
90
|
-
'organizer', 'soundFormat', 'workPerformed',
|
|
91
|
-
'duration', 'endDate', 'startDate', 'coaInfo',
|
|
92
|
-
'offers', 'additionalProperty'
|
|
93
|
-
]
|
|
94
|
-
)).shift();
|
|
95
|
-
if (eventSeries === undefined) {
|
|
96
|
-
throw new Error('eventSeries not found');
|
|
97
|
-
}
|
|
98
|
-
console.log(eventSeries);
|
|
99
|
-
|
|
100
|
-
const targetImportFrom = moment(importDay)
|
|
101
|
-
.tz('Asia/Tokyo')
|
|
102
|
-
.startOf('day');
|
|
103
|
-
const targetImportThrough = moment(importDay)
|
|
104
|
-
.tz('Asia/Tokyo')
|
|
105
|
-
.endOf('day');
|
|
106
|
-
const begin: string = moment(targetImportFrom)
|
|
107
|
-
.add(-1, 'day') // 深夜帯スケジュールが前日検索の結果に含まれるため
|
|
108
|
-
.tz('Asia/Tokyo')
|
|
109
|
-
.format('YYYYMMDD'); // COAは日本時間で判断
|
|
110
|
-
const end: string = moment(targetImportThrough)
|
|
111
|
-
// .add(-1, 'day')
|
|
112
|
-
.tz('Asia/Tokyo')
|
|
113
|
-
.format('YYYYMMDD'); // COAは日本時間で判断
|
|
114
|
-
console.log('importing screening events...', targetImportFrom, targetImportThrough, begin, end);
|
|
115
|
-
|
|
116
|
-
const result = await (await chevre.service.event.createService()).saveScreeningEvents(
|
|
117
|
-
{
|
|
118
|
-
project: { id: project.id, typeOf: chevre.factory.organizationType.Project },
|
|
119
|
-
seller: { id: movieTheater.parentOrganization.id },
|
|
120
|
-
movieTheater,
|
|
121
|
-
screeningRooms,
|
|
122
|
-
screeningEventSerieses: [eventSeries],
|
|
123
|
-
targetImportFrom: targetImportFrom.toDate(),
|
|
124
|
-
targetImportThrough: targetImportThrough.toDate(),
|
|
125
|
-
instrument: {
|
|
126
|
-
theaterCode: locationBranchCode,
|
|
127
|
-
begin, // debug(2024-04-24~)
|
|
128
|
-
end, // debug(2024-04-24~)
|
|
129
|
-
typeOf: 'WebAPI',
|
|
130
|
-
identifier: chevre.factory.service.webAPI.Identifier.COA
|
|
131
|
-
}
|
|
132
|
-
},
|
|
133
|
-
{
|
|
134
|
-
filterSchedulesFromCOA: { titleBranchNum, titleCode, roomCode }
|
|
135
|
-
}
|
|
136
|
-
)({
|
|
137
|
-
categoryCode: categoryCodeRepo,
|
|
138
|
-
creativeWork: creativeWorkRepo,
|
|
139
|
-
event: eventRepo,
|
|
140
|
-
eventSeries: eventSeriesRepo,
|
|
141
|
-
masterService
|
|
142
|
-
});
|
|
143
|
-
console.log('result:', result.length, 'events');
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
main()
|
|
147
|
-
.then(console.log)
|
|
148
|
-
.catch(console.error);
|
|
@@ -1,121 +0,0 @@
|
|
|
1
|
-
// tslint:disable:no-console no-magic-numbers
|
|
2
|
-
import { webcrypto } from 'crypto';
|
|
3
|
-
// import moment from 'moment';
|
|
4
|
-
import mongoose from 'mongoose';
|
|
5
|
-
|
|
6
|
-
import { chevre } from '../../../../lib/index';
|
|
7
|
-
|
|
8
|
-
// const project = { id: String(process.env.PROJECT_ID) };
|
|
9
|
-
const PROPERTY_NAME = 'createId';
|
|
10
|
-
|
|
11
|
-
async function additionalProperty2identifier(raw: string) {
|
|
12
|
-
const data = new TextEncoder().encode(raw);
|
|
13
|
-
const hashBuffer = await webcrypto.subtle.digest('SHA-256', data);
|
|
14
|
-
const bytes = Array.from(new Uint8Array(hashBuffer));
|
|
15
|
-
|
|
16
|
-
// 0-9 + a-z の36文字セット
|
|
17
|
-
const chars = '0123456789abcdefghijklmnopqrstuvwxyz';
|
|
18
|
-
// tslint:disable-next-line:no-magic-numbers
|
|
19
|
-
const id = bytes.map((b) => chars[b % 36])
|
|
20
|
-
.join('');
|
|
21
|
-
|
|
22
|
-
// tslint:disable-next-line:no-magic-numbers
|
|
23
|
-
return id.slice(0, 16);
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
const identifierMustMatch = /^[0-9a-zA-Z]+$/;
|
|
27
|
-
function validateIdentifier(identifier: string) {
|
|
28
|
-
if (!identifierMustMatch.test(identifier)) {
|
|
29
|
-
throw new Error(`not matched ${identifier}`);
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
if (identifier.length < 8 || identifier.length > 32) {
|
|
33
|
-
throw new Error(`invalid length ${identifier}`);
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
// tslint:disable-next-line:max-func-body-length
|
|
38
|
-
async function main() {
|
|
39
|
-
await mongoose.connect(<string>process.env.MONGOLAB_URI, { autoIndex: false });
|
|
40
|
-
|
|
41
|
-
const eventRepo = await chevre.repository.Event.createInstance(mongoose.connection);
|
|
42
|
-
|
|
43
|
-
const cursor = eventRepo.getCursor(
|
|
44
|
-
{
|
|
45
|
-
// _id: { $eq: '68f5d32176b5f6b689ff24a6' },
|
|
46
|
-
// 'project.id': { $eq: project.id },
|
|
47
|
-
// startDate: {
|
|
48
|
-
// $lte: moment('2025-05-01T10:00:00Z')
|
|
49
|
-
// .toDate()
|
|
50
|
-
// },
|
|
51
|
-
'additionalProperty.name': { $exists: true, $eq: PROPERTY_NAME }
|
|
52
|
-
},
|
|
53
|
-
{
|
|
54
|
-
_id: 1,
|
|
55
|
-
startDate: 1,
|
|
56
|
-
project: 1,
|
|
57
|
-
identifier: 1,
|
|
58
|
-
additionalProperty: 1,
|
|
59
|
-
typeOf: 1
|
|
60
|
-
}
|
|
61
|
-
);
|
|
62
|
-
console.log('events found');
|
|
63
|
-
|
|
64
|
-
let i = 0;
|
|
65
|
-
let updateCount = 0;
|
|
66
|
-
await cursor.eachAsync(async (doc) => {
|
|
67
|
-
i += 1;
|
|
68
|
-
const event: Pick<
|
|
69
|
-
chevre.factory.event.screeningEvent.IEvent,
|
|
70
|
-
'id' | 'identifier' | 'startDate' | 'project' | 'additionalProperty' | 'typeOf'
|
|
71
|
-
> = doc.toObject();
|
|
72
|
-
|
|
73
|
-
console.log(
|
|
74
|
-
'alreadyMigrated?', event.project.id, event.id, event.startDate, i);
|
|
75
|
-
const eventIdentifier = event.identifier;
|
|
76
|
-
const additionalPropertyValue = event.additionalProperty?.find(({ name }) => name === PROPERTY_NAME)?.value;
|
|
77
|
-
if (typeof additionalPropertyValue !== 'string') {
|
|
78
|
-
throw new Error('additionalPropertyValue not found');
|
|
79
|
-
}
|
|
80
|
-
const identifierMustBe = await additionalProperty2identifier(additionalPropertyValue);
|
|
81
|
-
validateIdentifier(identifierMustBe);
|
|
82
|
-
|
|
83
|
-
const alreadyMigrated = typeof eventIdentifier === 'string' && eventIdentifier.length > 0;
|
|
84
|
-
// const alreadyMigrated = typeof eventIdentifier === 'string' && eventIdentifier === identifierMustBe;
|
|
85
|
-
|
|
86
|
-
if (alreadyMigrated) {
|
|
87
|
-
validateIdentifier(eventIdentifier);
|
|
88
|
-
// 追加特性から生成された識別子に一致するはず
|
|
89
|
-
if (identifierMustBe !== eventIdentifier) {
|
|
90
|
-
throw new Error(`${identifierMustBe} !== ${eventIdentifier} ${event.id}, ${i}`);
|
|
91
|
-
}
|
|
92
|
-
console.log(
|
|
93
|
-
'already migrated.', event.project.id, eventIdentifier, additionalPropertyValue, event.id, event.startDate, i);
|
|
94
|
-
} else {
|
|
95
|
-
console.log(
|
|
96
|
-
'updating...',
|
|
97
|
-
identifierMustBe, event.project.id, eventIdentifier, additionalPropertyValue, event.id, event.startDate, i);
|
|
98
|
-
await eventRepo.updatePartiallyById({
|
|
99
|
-
project: { id: event.project.id },
|
|
100
|
-
id: event.id,
|
|
101
|
-
attributes: {
|
|
102
|
-
typeOf: event.typeOf,
|
|
103
|
-
...{
|
|
104
|
-
identifier: identifierMustBe
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
});
|
|
108
|
-
updateCount += 1;
|
|
109
|
-
console.log(
|
|
110
|
-
'updated.',
|
|
111
|
-
event.project.id, eventIdentifier, event.id, event.startDate, i);
|
|
112
|
-
}
|
|
113
|
-
});
|
|
114
|
-
|
|
115
|
-
console.log(i, 'events checked');
|
|
116
|
-
console.log(updateCount, 'events updated');
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
main()
|
|
120
|
-
.then()
|
|
121
|
-
.catch(console.error);
|
|
@@ -1,76 +0,0 @@
|
|
|
1
|
-
// tslint:disable:no-console
|
|
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 eventRepo = await chevre.repository.Event.createInstance(mongoose.connection);
|
|
11
|
-
|
|
12
|
-
const cursor = eventRepo.getCursor(
|
|
13
|
-
{
|
|
14
|
-
// _id: { $eq: 'bm2bftkoj' },
|
|
15
|
-
'location.maximumAttendeeCapacity': { $exists: true }
|
|
16
|
-
},
|
|
17
|
-
{
|
|
18
|
-
_id: 1,
|
|
19
|
-
startDate: 1,
|
|
20
|
-
project: 1,
|
|
21
|
-
location: 1,
|
|
22
|
-
maximumPhysicalAttendeeCapacity: 1,
|
|
23
|
-
typeOf: 1
|
|
24
|
-
}
|
|
25
|
-
);
|
|
26
|
-
console.log('events found');
|
|
27
|
-
|
|
28
|
-
let i = 0;
|
|
29
|
-
let updateCount = 0;
|
|
30
|
-
await cursor.eachAsync(async (doc) => {
|
|
31
|
-
i += 1;
|
|
32
|
-
const event: Pick<
|
|
33
|
-
chevre.factory.event.screeningEvent.IEvent,
|
|
34
|
-
'id' | 'location' | 'startDate' | 'project' | 'maximumPhysicalAttendeeCapacity' | 'typeOf'
|
|
35
|
-
> = doc.toObject();
|
|
36
|
-
|
|
37
|
-
console.log(
|
|
38
|
-
'alreadyMigrated?', event.project.id, event.id, event.startDate, i);
|
|
39
|
-
const originCapacity = event.location.maximumAttendeeCapacity;
|
|
40
|
-
const alreadyMigrated = typeof originCapacity !== 'number'
|
|
41
|
-
|| (typeof originCapacity === 'number' && originCapacity === event.maximumPhysicalAttendeeCapacity);
|
|
42
|
-
|
|
43
|
-
if (alreadyMigrated) {
|
|
44
|
-
console.log(
|
|
45
|
-
'already migrated.', event.project.id, event.id, event.startDate, i);
|
|
46
|
-
} else {
|
|
47
|
-
if (typeof originCapacity === 'number') {
|
|
48
|
-
console.log(
|
|
49
|
-
'updating project... maximumPhysicalAttendeeCapacity:',
|
|
50
|
-
originCapacity,
|
|
51
|
-
event.project.id, event.id, event.startDate, i);
|
|
52
|
-
await eventRepo.updatePartiallyById({
|
|
53
|
-
project: { id: event.project.id },
|
|
54
|
-
id: event.id,
|
|
55
|
-
attributes: {
|
|
56
|
-
typeOf: event.typeOf,
|
|
57
|
-
...{
|
|
58
|
-
maximumPhysicalAttendeeCapacity: originCapacity
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
});
|
|
62
|
-
updateCount += 1;
|
|
63
|
-
console.log(
|
|
64
|
-
'updated.',
|
|
65
|
-
event.project.id, event.id, event.startDate, i);
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
});
|
|
69
|
-
|
|
70
|
-
console.log(i, 'events checked');
|
|
71
|
-
console.log(updateCount, 'events updated');
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
main()
|
|
75
|
-
.then()
|
|
76
|
-
.catch(console.error);
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
// tslint:disable:no-console
|
|
2
|
-
import mongoose from 'mongoose';
|
|
3
|
-
|
|
4
|
-
import { chevre } from '../../../../lib/index';
|
|
5
|
-
|
|
6
|
-
// const excludedProject = { id: String(process.env.EXCLUDED_PROJECT_ID) };
|
|
7
|
-
|
|
8
|
-
async function main() {
|
|
9
|
-
await mongoose.connect(<string>process.env.MONGOLAB_URI, { autoIndex: false });
|
|
10
|
-
|
|
11
|
-
const eventRepo = await chevre.repository.Event.createInstance(mongoose.connection);
|
|
12
|
-
|
|
13
|
-
let updateResult: any;
|
|
14
|
-
|
|
15
|
-
updateResult = await eventRepo.unsetUnnecessaryFields({
|
|
16
|
-
filter: {
|
|
17
|
-
'superEvent.videoFormat': { $exists: true }
|
|
18
|
-
},
|
|
19
|
-
$unset: {
|
|
20
|
-
'superEvent.videoFormat': 1
|
|
21
|
-
} as any
|
|
22
|
-
});
|
|
23
|
-
console.log(updateResult);
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
main()
|
|
27
|
-
.then(() => {
|
|
28
|
-
console.log('success!');
|
|
29
|
-
})
|
|
30
|
-
.catch(console.error);
|
|
@@ -1,106 +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
|
-
const { EVENT_IDENTTIFIER } = process.env;
|
|
9
|
-
|
|
10
|
-
async function main() {
|
|
11
|
-
if (typeof EVENT_IDENTTIFIER !== 'string') {
|
|
12
|
-
throw new Error('environment variables required');
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
await mongoose.connect(<string>process.env.MONGOLAB_URI, { autoIndex: false });
|
|
16
|
-
|
|
17
|
-
const eventSellerMakesOfferRepo = await chevre.repository.EventSellerMakesOffer.createInstance(mongoose.connection);
|
|
18
|
-
const availabilityEnds = moment('2025-10-26T05:20:00.000Z')
|
|
19
|
-
.toDate();
|
|
20
|
-
const availabilityStarts = moment('2025-10-23T15:00:00.000Z')
|
|
21
|
-
.toDate();
|
|
22
|
-
const validFrom = moment('2025-10-12T15:00:00.000Z')
|
|
23
|
-
.toDate();
|
|
24
|
-
const validThrough = moment('2025-10-26T05:20:00.000Z')
|
|
25
|
-
.toDate();
|
|
26
|
-
const result = await eventSellerMakesOfferRepo.updateSellerMakesOffersByEventIdentifier([
|
|
27
|
-
{
|
|
28
|
-
$set: {
|
|
29
|
-
project: { id: project.id, typeOf: chevre.factory.organizationType.Project },
|
|
30
|
-
identifier: EVENT_IDENTTIFIER,
|
|
31
|
-
offers: {
|
|
32
|
-
seller: {
|
|
33
|
-
makesOffer: [
|
|
34
|
-
{
|
|
35
|
-
typeOf: chevre.factory.offerType.Offer,
|
|
36
|
-
availableAtOrFrom: {
|
|
37
|
-
id: '3eo6okferrsdpfd9j2ce1iv9k7'
|
|
38
|
-
},
|
|
39
|
-
availabilityEnds,
|
|
40
|
-
availabilityStarts,
|
|
41
|
-
validFrom,
|
|
42
|
-
validThrough
|
|
43
|
-
},
|
|
44
|
-
{
|
|
45
|
-
typeOf: chevre.factory.offerType.Offer,
|
|
46
|
-
availableAtOrFrom: {
|
|
47
|
-
id: '51qbjcfr72h62m06vtv5kkhgje'
|
|
48
|
-
},
|
|
49
|
-
availabilityEnds,
|
|
50
|
-
availabilityStarts,
|
|
51
|
-
validFrom,
|
|
52
|
-
validThrough
|
|
53
|
-
},
|
|
54
|
-
{
|
|
55
|
-
typeOf: chevre.factory.offerType.Offer,
|
|
56
|
-
availableAtOrFrom: {
|
|
57
|
-
id: '5h3gs22mu9j3ok7o63uog9o9i3'
|
|
58
|
-
},
|
|
59
|
-
availabilityEnds,
|
|
60
|
-
availabilityStarts,
|
|
61
|
-
validFrom,
|
|
62
|
-
validThrough
|
|
63
|
-
},
|
|
64
|
-
{
|
|
65
|
-
typeOf: chevre.factory.offerType.Offer,
|
|
66
|
-
availableAtOrFrom: {
|
|
67
|
-
id: '66e7p2g713675v96nrhdm975kg'
|
|
68
|
-
},
|
|
69
|
-
availabilityEnds,
|
|
70
|
-
availabilityStarts,
|
|
71
|
-
validFrom,
|
|
72
|
-
validThrough
|
|
73
|
-
},
|
|
74
|
-
{
|
|
75
|
-
typeOf: chevre.factory.offerType.Offer,
|
|
76
|
-
availableAtOrFrom: {
|
|
77
|
-
id: '7divuoimobsfgq95tp1csorjqq'
|
|
78
|
-
},
|
|
79
|
-
availabilityEnds,
|
|
80
|
-
availabilityStarts,
|
|
81
|
-
validFrom,
|
|
82
|
-
validThrough
|
|
83
|
-
},
|
|
84
|
-
{
|
|
85
|
-
typeOf: chevre.factory.offerType.Offer,
|
|
86
|
-
availableAtOrFrom: {
|
|
87
|
-
id: 'ckevmf3fueqcunnideu6artt'
|
|
88
|
-
},
|
|
89
|
-
availabilityEnds,
|
|
90
|
-
availabilityStarts,
|
|
91
|
-
validFrom,
|
|
92
|
-
validThrough
|
|
93
|
-
}
|
|
94
|
-
]
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
]);
|
|
100
|
-
// tslint:disable-next-line:no-null-keyword
|
|
101
|
-
console.dir(result, { depth: null });
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
main()
|
|
105
|
-
.then(console.log)
|
|
106
|
-
.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
|
-
// const excludedProject = { id: String(process.env.EXCLUDED_PROJECT_ID) };
|
|
7
|
-
|
|
8
|
-
async function main() {
|
|
9
|
-
await mongoose.connect(<string>process.env.MONGOLAB_URI, { autoIndex: false });
|
|
10
|
-
|
|
11
|
-
const eventSeriesRepo = await chevre.repository.EventSeries.createInstance(mongoose.connection);
|
|
12
|
-
|
|
13
|
-
let updateResult: any;
|
|
14
|
-
|
|
15
|
-
updateResult = await eventSeriesRepo.unsetUnnecessaryFields({
|
|
16
|
-
filter: {
|
|
17
|
-
// _id: { $eq: 'akewitdke' },
|
|
18
|
-
videoFormat: { $exists: true }
|
|
19
|
-
},
|
|
20
|
-
$unset: {
|
|
21
|
-
videoFormat: 1
|
|
22
|
-
}
|
|
23
|
-
});
|
|
24
|
-
console.log(updateResult);
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
main()
|
|
28
|
-
.then(() => {
|
|
29
|
-
console.log('success!');
|
|
30
|
-
})
|
|
31
|
-
.catch(console.error);
|