@chevre/domain 23.2.0-alpha.6 → 23.2.0-alpha.60
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/example/src/chevre/acceptedPaymentMethodOffer/adminAcceptedPaymentMethodOffers.ts +25 -17
- package/example/src/chevre/confirmationNumber/testRandomness.ts +49 -0
- package/example/src/chevre/emailMessage/createEmailMessageText.ts +63 -0
- package/example/src/chevre/event/importEventsFromCOAByTitle.ts +2 -2
- package/example/src/chevre/event/unsetSuperEventVideoFormat.ts +30 -0
- package/example/src/chevre/eventSeries/unsetVideoFormat.ts +31 -0
- package/example/src/chevre/{upsertScreeningEventSeriesByVersion.ts → eventSeries/upsertScreeningEventSeriesByVersion.ts} +47 -43
- package/example/src/chevre/{upsertOfferCatalogItemsByIdentifier.ts → offerCatalog/upsertOfferCatalogItemsByIdentifier.ts} +6 -3
- package/example/src/chevre/{upsertOfferCatalogsByIdentifier.ts → offerCatalog/upsertOfferCatalogsByIdentifier.ts} +8 -3
- package/example/src/chevre/{upsertOffersByIdentifier.ts → offers/upsertOffersByIdentifier.ts} +5 -3
- package/example/src/chevre/orderNumber/decryptOrderNumber.ts +14 -0
- package/example/src/chevre/orderNumber/testRandomness.ts +54 -0
- package/example/src/chevre/place/adminEntranceGates.ts +69 -0
- package/example/src/chevre/place/checkEntranceGatesCount.ts +82 -0
- package/example/src/chevre/place/findRooms.ts +24 -0
- package/example/src/chevre/place/findSections.ts +28 -0
- package/example/src/chevre/place/migrateSectionIdentifier.ts +92 -0
- package/example/src/chevre/place/seatsJson2csv.ts +63 -0
- package/example/src/chevre/place/upsertMovieTheatersByBranchCode.ts +41 -0
- package/example/src/chevre/place/upsertRoomsByBranchCode.ts +40 -0
- package/example/src/chevre/place/upsertSeatSectionsByBranchCode.ts +56 -0
- package/example/src/chevre/reIndex.ts +1 -1
- package/example/src/chevre/roles/addAdminAcceptedPaymentMethodReadPermissionIfNotExists.ts +33 -0
- package/example/src/chevre/roles/addAdminAcceptedPaymentMethodWritePermissionIfNotExists.ts +33 -0
- package/example/src/chevre/roles/addAdminMovieReadPermissionIfNotExists.ts +49 -0
- package/example/src/chevre/roles/addAdminRoomReadPermissionIfNotExists.ts +34 -0
- package/example/src/chevre/roles/addAdminRoomWritePermissionIfNotExists.ts +34 -0
- package/example/src/chevre/settings/addOrderNumberSetting.ts +44 -0
- package/example/src/chevre/settings/addTransactionNumberSetting.ts +40 -0
- package/example/src/chevre/transactionNumber/publishByTimestamp.ts +23 -0
- package/example/src/chevre/transactionNumber/testRandomness.ts +42 -0
- package/example/src/chevre/unsetUnnecessaryFields.ts +8 -4
- package/lib/chevre/emailMessageBuilder.js +1 -0
- package/lib/chevre/factory/event.d.ts +1 -1
- package/lib/chevre/factory/event.js +11 -5
- package/lib/chevre/factory/transactionNumber.d.ts +19 -0
- package/lib/chevre/factory/transactionNumber.js +54 -0
- package/lib/chevre/repo/acceptedPaymentMethod.d.ts +41 -8
- package/lib/chevre/repo/acceptedPaymentMethod.js +72 -27
- package/lib/chevre/repo/aggregateOffer.d.ts +6 -1
- package/lib/chevre/repo/aggregateOffer.js +11 -3
- package/lib/chevre/repo/aggregateOrder.js +0 -93
- package/lib/chevre/repo/aggregateReservation.d.ts +0 -1
- package/lib/chevre/repo/aggregateReservation.js +0 -2
- package/lib/chevre/repo/confirmationNumber.d.ts +1 -0
- package/lib/chevre/repo/confirmationNumber.js +32 -25
- package/lib/chevre/repo/event.d.ts +3 -3
- package/lib/chevre/repo/event.js +20 -8
- package/lib/chevre/repo/eventOffer.d.ts +8 -0
- package/lib/chevre/repo/eventOffer.js +11 -0
- package/lib/chevre/repo/eventSeries.d.ts +18 -25
- package/lib/chevre/repo/eventSeries.js +155 -101
- package/lib/chevre/repo/mongoose/schemas/aggregateReservation.js +0 -1
- package/lib/chevre/repo/mongoose/schemas/eventSeries.js +13 -25
- package/lib/chevre/repo/mongoose/schemas/offerCatalog.js +2 -8
- package/lib/chevre/repo/mongoose/schemas/offerCatalogItem.js +28 -2
- package/lib/chevre/repo/mongoose/schemas/place.d.ts +6 -2
- package/lib/chevre/repo/mongoose/schemas/setting.d.ts +40 -0
- package/lib/chevre/repo/mongoose/schemas/setting.js +3 -0
- package/lib/chevre/repo/offerCatalog.d.ts +14 -1
- package/lib/chevre/repo/offerCatalog.js +41 -19
- package/lib/chevre/repo/offerCatalogItem.d.ts +10 -1
- package/lib/chevre/repo/offerCatalogItem.js +32 -17
- package/lib/chevre/repo/orderNumber.d.ts +7 -0
- package/lib/chevre/repo/orderNumber.js +110 -34
- package/lib/chevre/repo/place/entranceGate.d.ts +57 -0
- package/lib/chevre/repo/place/entranceGate.js +172 -0
- package/lib/chevre/repo/place/movieTheater.d.ts +40 -3
- package/lib/chevre/repo/place/movieTheater.js +77 -6
- package/lib/chevre/repo/place/screeningRoom.d.ts +60 -31
- package/lib/chevre/repo/place/screeningRoom.js +227 -135
- package/lib/chevre/repo/place/seat.d.ts +47 -45
- package/lib/chevre/repo/place/seat.js +175 -45
- package/lib/chevre/repo/place/section.d.ts +60 -30
- package/lib/chevre/repo/place/section.js +337 -127
- package/lib/chevre/repo/serviceOutputIdentifier.d.ts +3 -1
- package/lib/chevre/repo/serviceOutputIdentifier.js +42 -27
- package/lib/chevre/repo/setting.d.ts +1 -1
- package/lib/chevre/repo/setting.js +2 -2
- package/lib/chevre/repo/task.d.ts +1 -1
- package/lib/chevre/repo/transactionNumber.d.ts +5 -0
- package/lib/chevre/repo/transactionNumber.js +63 -27
- package/lib/chevre/repository.d.ts +8 -0
- package/lib/chevre/repository.js +16 -0
- package/lib/chevre/service/assetTransaction/reserve/start/factory/createStartParams.js +10 -2
- package/lib/chevre/service/event/processUpdateMovieTheater.d.ts +1 -1
- package/lib/chevre/service/event/processUpdateMovieTheater.js +13 -11
- package/lib/chevre/service/event/saveScreeningEventSeries.js +4 -5
- package/lib/chevre/service/event/saveScreeningEvents.d.ts +2 -2
- package/lib/chevre/service/event/saveScreeningEvents.js +16 -12
- package/lib/chevre/service/offer/event/authorize/factory.js +9 -1
- package/lib/chevre/service/offer/event/searchEventTicketOffers.js +7 -4
- package/lib/chevre/service/offer/event/searchOfferAppliesToMovieTicket.js +9 -6
- package/lib/chevre/service/offer/event/searchOffersByIds.js +7 -4
- package/lib/chevre/service/offer/eventServiceByCOA/authorize/factory.js +7 -1
- package/lib/chevre/service/offer/onEventChanged.js +10 -6
- package/lib/chevre/service/offer/product.js +1 -1
- package/lib/chevre/service/offer.d.ts +5 -0
- package/lib/chevre/service/offer.js +34 -9
- package/lib/chevre/service/order/onOrderStatusChanged/onOrderCancelled/factory.d.ts +1 -1
- package/lib/chevre/service/order/onOrderStatusChanged/onOrderDeliveredPartially/factory.d.ts +1 -1
- package/lib/chevre/service/order/onOrderStatusChanged/onOrderReturned/factory.d.ts +1 -1
- package/lib/chevre/service/task/createEvent/createEventBySchedule/factory.d.ts +2 -2
- package/lib/chevre/service/task/createEvent/createEventBySchedule/factory.js +5 -3
- package/lib/chevre/service/task/createEvent/createEventBySchedule/schedule2events.js +4 -2
- package/lib/chevre/service/task/onResourceDeleted/deleteResourcesByAggregateOffer.d.ts +13 -0
- package/lib/chevre/service/task/onResourceDeleted/deleteResourcesByAggregateOffer.js +53 -0
- package/lib/chevre/service/task/onResourceDeleted/deleteResourcesByEventSeries.d.ts +13 -0
- package/lib/chevre/service/task/onResourceDeleted/deleteResourcesByEventSeries.js +56 -0
- package/lib/chevre/service/task/onResourceDeleted/deleteResourcesByMovieTheater.d.ts +15 -0
- package/lib/chevre/service/task/onResourceDeleted/deleteResourcesByMovieTheater.js +58 -0
- package/lib/chevre/service/task/onResourceDeleted/deleteResourcesByOfferCatalog.d.ts +17 -0
- package/lib/chevre/service/task/onResourceDeleted/deleteResourcesByOfferCatalog.js +75 -0
- package/lib/chevre/service/task/onResourceDeleted/deleteResourcesByProduct.d.ts +19 -0
- package/lib/chevre/service/task/onResourceDeleted/deleteResourcesByProduct.js +60 -0
- package/lib/chevre/service/task/onResourceDeleted/deleteResourcesByRoom.d.ts +20 -0
- package/lib/chevre/service/task/onResourceDeleted/deleteResourcesByRoom.js +51 -0
- package/lib/chevre/service/task/onResourceDeleted/deleteResourcesBySeller.d.ts +27 -0
- package/lib/chevre/service/task/onResourceDeleted/deleteResourcesBySeller.js +100 -0
- package/lib/chevre/service/task/onResourceDeleted.d.ts +6 -0
- package/lib/chevre/service/task/onResourceDeleted.js +168 -0
- package/lib/chevre/service/task/onResourceUpdated.js +205 -42
- package/lib/chevre/service/task/syncResourcesFromCOA.js +4 -2
- package/lib/chevre/service/taskHandler.js +1 -0
- package/package.json +10 -8
- package/example/src/chevre/event/upsertManyScreeningEventByIdentifier.ts +0 -191
- package/example/src/chevre/eventSeries/migrateEventSeriesUnacceptedPaymentMethod.ts +0 -93
- package/example/src/chevre/offers/createSampleOffers.ts +0 -154
- package/example/src/chevre/settings/addSettings.ts +0 -46
- package/lib/chevre/service/eventOld.d.ts +0 -60
- package/lib/chevre/service/eventOld.js +0 -864
- package/lib/chevre/service/task/onResourceUpdated/onResourceDeleted.d.ts +0 -45
- package/lib/chevre/service/task/onResourceUpdated/onResourceDeleted.js +0 -447
|
@@ -1,93 +0,0 @@
|
|
|
1
|
-
// tslint:disable:no-console
|
|
2
|
-
import * as moment from 'moment';
|
|
3
|
-
import * as mongoose from 'mongoose';
|
|
4
|
-
|
|
5
|
-
import { chevre } from '../../../../lib/index';
|
|
6
|
-
|
|
7
|
-
// const project = { id: String(process.env.PROJECT_ID) };
|
|
8
|
-
const DEFAULT_PAYMENT_METHOD_TYPE_FOR_MOVIE_TICKET = 'MovieTicket';
|
|
9
|
-
|
|
10
|
-
// tslint:disable-next-line:max-func-body-length
|
|
11
|
-
async function main() {
|
|
12
|
-
await mongoose.connect(<string>process.env.MONGOLAB_URI, { autoIndex: false });
|
|
13
|
-
|
|
14
|
-
const eventSeriesRepo = await chevre.repository.EventSeries.createInstance(mongoose.connection);
|
|
15
|
-
|
|
16
|
-
const cursor = eventSeriesRepo.getCursor(
|
|
17
|
-
{
|
|
18
|
-
'project.id': { $eq: 'xxx' },
|
|
19
|
-
'offers.unacceptedPaymentMethod': {
|
|
20
|
-
$exists: true,
|
|
21
|
-
$ne: DEFAULT_PAYMENT_METHOD_TYPE_FOR_MOVIE_TICKET
|
|
22
|
-
},
|
|
23
|
-
startDate: {
|
|
24
|
-
$lte: moment()
|
|
25
|
-
.add(-1, 'year')
|
|
26
|
-
.toDate()
|
|
27
|
-
}
|
|
28
|
-
// _id: { $eq: 'bliy11ffa' }
|
|
29
|
-
},
|
|
30
|
-
{
|
|
31
|
-
// _id: 1,
|
|
32
|
-
// offers: 1,
|
|
33
|
-
// startDate: 1,
|
|
34
|
-
// project: 1,
|
|
35
|
-
// typeOf: 1
|
|
36
|
-
}
|
|
37
|
-
);
|
|
38
|
-
console.log('docs found');
|
|
39
|
-
|
|
40
|
-
let i = 0;
|
|
41
|
-
let updateCount = 0;
|
|
42
|
-
await cursor.eachAsync(async (doc) => {
|
|
43
|
-
i += 1;
|
|
44
|
-
const eventSeries: Pick<
|
|
45
|
-
chevre.factory.eventSeries.IEvent,
|
|
46
|
-
'id' | 'offers' | 'startDate' | 'project' | 'typeOf'
|
|
47
|
-
> = doc.toObject();
|
|
48
|
-
|
|
49
|
-
console.log(
|
|
50
|
-
'alreadyMigrated?', eventSeries.project.id, eventSeries.typeOf, eventSeries.id, eventSeries.startDate, i);
|
|
51
|
-
const unacceptedPaymentMethod = eventSeries.offers?.unacceptedPaymentMethod;
|
|
52
|
-
const alreadyMigrated = !Array.isArray(unacceptedPaymentMethod)
|
|
53
|
-
|| (Array.isArray(unacceptedPaymentMethod)
|
|
54
|
-
&& unacceptedPaymentMethod.every(
|
|
55
|
-
(paymentMethodType) => paymentMethodType === DEFAULT_PAYMENT_METHOD_TYPE_FOR_MOVIE_TICKET
|
|
56
|
-
));
|
|
57
|
-
|
|
58
|
-
if (alreadyMigrated) {
|
|
59
|
-
console.log(
|
|
60
|
-
'already migrated.', eventSeries.project.id, eventSeries.typeOf, eventSeries.id, eventSeries.startDate, i);
|
|
61
|
-
} else {
|
|
62
|
-
if (Array.isArray(unacceptedPaymentMethod)) {
|
|
63
|
-
const newUnacceptedPaymentMethod = unacceptedPaymentMethod.filter(
|
|
64
|
-
(paymentMethod) => paymentMethod === DEFAULT_PAYMENT_METHOD_TYPE_FOR_MOVIE_TICKET
|
|
65
|
-
);
|
|
66
|
-
console.log(
|
|
67
|
-
'updating project...',
|
|
68
|
-
newUnacceptedPaymentMethod,
|
|
69
|
-
eventSeries.project.id, eventSeries.typeOf, eventSeries.id, eventSeries.startDate, i);
|
|
70
|
-
await eventSeriesRepo.saveEventSeries({
|
|
71
|
-
id: eventSeries.id,
|
|
72
|
-
attributes: <any>{
|
|
73
|
-
...{
|
|
74
|
-
typeOf: eventSeries.typeOf,
|
|
75
|
-
'offers.unacceptedPaymentMethod': newUnacceptedPaymentMethod
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
});
|
|
79
|
-
updateCount += 1;
|
|
80
|
-
console.log(
|
|
81
|
-
'updated.',
|
|
82
|
-
eventSeries.project.id, eventSeries.typeOf, eventSeries.id, eventSeries.startDate, i);
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
});
|
|
86
|
-
|
|
87
|
-
console.log(i, 'docs checked');
|
|
88
|
-
console.log(updateCount, 'docs updated');
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
main()
|
|
92
|
-
.then()
|
|
93
|
-
.catch(console.error);
|
|
@@ -1,154 +0,0 @@
|
|
|
1
|
-
// tslint:disable:no-console
|
|
2
|
-
import * as mongoose from 'mongoose';
|
|
3
|
-
|
|
4
|
-
import { chevre } from '../../../../lib/index';
|
|
5
|
-
|
|
6
|
-
const project = { id: String(process.env.PROJECT_ID) };
|
|
7
|
-
const NUM_CREATE_OFFERS = 300;
|
|
8
|
-
const NUM_CREATE_SUB_CATALOGS = 10;
|
|
9
|
-
|
|
10
|
-
// tslint:disable-next-line:max-func-body-length
|
|
11
|
-
async function main() {
|
|
12
|
-
await mongoose.connect(<string>process.env.MONGOLAB_URI, { autoIndex: false });
|
|
13
|
-
|
|
14
|
-
const aggregateOfferRepo = await chevre.repository.AggregateOffer.createInstance(mongoose.connection);
|
|
15
|
-
const offerCatalogRepo = await chevre.repository.OfferCatalog.createInstance(mongoose.connection);
|
|
16
|
-
const productRepo = await chevre.repository.Product.createInstance(mongoose.connection);
|
|
17
|
-
const offerCatalogItemRepo = await chevre.repository.OfferCatalogItem.createInstance(mongoose.connection);
|
|
18
|
-
|
|
19
|
-
const savingOffers: Omit<chevre.factory.unitPriceOffer.IUnitPriceOffer, 'id'>[] =
|
|
20
|
-
// tslint:disable-next-line:prefer-array-literal
|
|
21
|
-
[...Array(NUM_CREATE_OFFERS)].map<Omit<chevre.factory.unitPriceOffer.IUnitPriceOffer, 'id'>>((__, i) => {
|
|
22
|
-
const identifier = `sampleFreeOffer${i}`;
|
|
23
|
-
const priceSpecification: chevre.factory.unitPriceOffer.IUnitPriceOfferPriceSpecification = {
|
|
24
|
-
typeOf: chevre.factory.priceSpecificationType.UnitPriceSpecification,
|
|
25
|
-
priceCurrency: chevre.factory.priceCurrency.JPY,
|
|
26
|
-
valueAddedTaxIncluded: true,
|
|
27
|
-
price: 0,
|
|
28
|
-
referenceQuantity: {
|
|
29
|
-
value: 1,
|
|
30
|
-
typeOf: 'QuantitativeValue',
|
|
31
|
-
unitCode: chevre.factory.unitCode.C62
|
|
32
|
-
},
|
|
33
|
-
accounting: {
|
|
34
|
-
typeOf: 'Accounting',
|
|
35
|
-
accountsReceivable: 0
|
|
36
|
-
}
|
|
37
|
-
};
|
|
38
|
-
|
|
39
|
-
return {
|
|
40
|
-
project: { id: project.id, typeOf: chevre.factory.organizationType.Project },
|
|
41
|
-
typeOf: chevre.factory.offerType.Offer,
|
|
42
|
-
identifier,
|
|
43
|
-
description: { en: identifier, ja: identifier },
|
|
44
|
-
alternateName: { ja: identifier },
|
|
45
|
-
name: { en: identifier, ja: identifier },
|
|
46
|
-
availability: chevre.factory.itemAvailability.InStock,
|
|
47
|
-
availableAtOrFrom: [
|
|
48
|
-
{ id: '51qbjcfr72h62m06vtv5kkhgje' }
|
|
49
|
-
],
|
|
50
|
-
itemOffered: { typeOf: chevre.factory.product.ProductType.EventService },
|
|
51
|
-
priceCurrency: chevre.factory.priceCurrency.JPY,
|
|
52
|
-
priceSpecification
|
|
53
|
-
};
|
|
54
|
-
});
|
|
55
|
-
const saveOfferResult = await aggregateOfferRepo.upsertByIdentifier(savingOffers);
|
|
56
|
-
console.log('saveOfferResult:', saveOfferResult);
|
|
57
|
-
|
|
58
|
-
const offerIds: string[] = (Array.isArray(saveOfferResult?.modifiedOffers)) ? saveOfferResult.modifiedOffers.map(({ id }) => id) : [];
|
|
59
|
-
const catalogIdentifier = 'sampleFreeOffersCatalog';
|
|
60
|
-
const savingOfferCatalog: chevre.factory.offerCatalog.IOfferCatalog = {
|
|
61
|
-
project: { id: project.id, typeOf: chevre.factory.organizationType.Project },
|
|
62
|
-
typeOf: 'OfferCatalog',
|
|
63
|
-
identifier: catalogIdentifier,
|
|
64
|
-
description: { en: catalogIdentifier, ja: catalogIdentifier },
|
|
65
|
-
name: { en: catalogIdentifier, ja: catalogIdentifier },
|
|
66
|
-
itemListElement: offerIds.map((id) => ({ id, typeOf: chevre.factory.offerType.Offer })),
|
|
67
|
-
itemOffered: { typeOf: chevre.factory.product.ProductType.EventService }
|
|
68
|
-
};
|
|
69
|
-
const saveCatalogResult = await offerCatalogRepo.saveByIdentifier(savingOfferCatalog);
|
|
70
|
-
console.log('saveCatalogResult:', saveCatalogResult);
|
|
71
|
-
|
|
72
|
-
const productId = 'sampleFreeEventService';
|
|
73
|
-
const savingProduct: chevre.factory.product.IProduct & {
|
|
74
|
-
offers?: never;
|
|
75
|
-
} = {
|
|
76
|
-
project: { id: project.id, typeOf: chevre.factory.organizationType.Project },
|
|
77
|
-
typeOf: chevre.factory.product.ProductType.EventService,
|
|
78
|
-
name: { en: productId, ja: productId },
|
|
79
|
-
productID: productId,
|
|
80
|
-
hasOfferCatalog: {
|
|
81
|
-
typeOf: 'OfferCatalog',
|
|
82
|
-
itemListElement: [{ id: saveCatalogResult.id }]
|
|
83
|
-
}
|
|
84
|
-
};
|
|
85
|
-
const saveProductResult = await productRepo.upsertManyByProductId([{
|
|
86
|
-
$set: savingProduct
|
|
87
|
-
}]);
|
|
88
|
-
console.log('saveProductResult:', saveProductResult);
|
|
89
|
-
|
|
90
|
-
// 以下サブカタログ
|
|
91
|
-
const offerIds4subCatalog: string[] = (Array.isArray(saveOfferResult?.modifiedOffers))
|
|
92
|
-
// tslint:disable-next-line:no-magic-numbers
|
|
93
|
-
? saveOfferResult.modifiedOffers.slice(0, 100)
|
|
94
|
-
.map(({ id }) => id) :
|
|
95
|
-
[];
|
|
96
|
-
const savingSubOfferCatalogs: chevre.factory.offerCatalog.IOfferCatalog[] =
|
|
97
|
-
// tslint:disable-next-line:prefer-array-literal
|
|
98
|
-
[...Array(NUM_CREATE_SUB_CATALOGS)].map<chevre.factory.offerCatalog.IOfferCatalog>((__, i) => {
|
|
99
|
-
const subCatalogIdentifier = `sampleFreeOffersSubCatalog${i}`;
|
|
100
|
-
|
|
101
|
-
return {
|
|
102
|
-
project: { id: project.id, typeOf: chevre.factory.organizationType.Project },
|
|
103
|
-
typeOf: 'OfferCatalog',
|
|
104
|
-
identifier: subCatalogIdentifier,
|
|
105
|
-
description: { en: subCatalogIdentifier, ja: subCatalogIdentifier },
|
|
106
|
-
name: { en: subCatalogIdentifier, ja: subCatalogIdentifier },
|
|
107
|
-
itemListElement: offerIds4subCatalog.map((id) => ({ id, typeOf: chevre.factory.offerType.Offer })),
|
|
108
|
-
itemOffered: { typeOf: chevre.factory.product.ProductType.EventService }
|
|
109
|
-
};
|
|
110
|
-
});
|
|
111
|
-
const saveSubCatalogResult = await offerCatalogItemRepo.upsertManyByIdentifier(savingSubOfferCatalogs.map((savingSubOfferCatalog) => {
|
|
112
|
-
return {
|
|
113
|
-
$set: savingSubOfferCatalog
|
|
114
|
-
};
|
|
115
|
-
}));
|
|
116
|
-
console.log('saveSubCatalogResult:', saveSubCatalogResult);
|
|
117
|
-
|
|
118
|
-
const subCatalogIds: string[] =
|
|
119
|
-
(Array.isArray(saveSubCatalogResult?.modifiedCatalogs)) ? saveSubCatalogResult.modifiedCatalogs.map(({ id }) => id) : [];
|
|
120
|
-
const catalogBySubCatalogIdentifier = 'sampleFreeOffersCatalogBySub';
|
|
121
|
-
const savingOfferCatalogBySubCatalog: chevre.factory.offerCatalog.IOfferCatalog = {
|
|
122
|
-
project: { id: project.id, typeOf: chevre.factory.organizationType.Project },
|
|
123
|
-
typeOf: 'OfferCatalog',
|
|
124
|
-
identifier: catalogBySubCatalogIdentifier,
|
|
125
|
-
description: { en: catalogBySubCatalogIdentifier, ja: catalogBySubCatalogIdentifier },
|
|
126
|
-
name: { en: catalogBySubCatalogIdentifier, ja: catalogBySubCatalogIdentifier },
|
|
127
|
-
itemListElement: subCatalogIds.map((id) => ({ id, typeOf: 'OfferCatalog' })),
|
|
128
|
-
itemOffered: { typeOf: chevre.factory.product.ProductType.EventService }
|
|
129
|
-
};
|
|
130
|
-
const saveCatalogBySubResult = await offerCatalogRepo.saveByIdentifier(savingOfferCatalogBySubCatalog);
|
|
131
|
-
console.log('saveCatalogBySubResult:', saveCatalogBySubResult);
|
|
132
|
-
|
|
133
|
-
const productIdBySubCatalog = 'sampleFreeEventServiceBySub';
|
|
134
|
-
const savingProductBySubCatalog: chevre.factory.product.IProduct & {
|
|
135
|
-
offers?: never;
|
|
136
|
-
} = {
|
|
137
|
-
project: { id: project.id, typeOf: chevre.factory.organizationType.Project },
|
|
138
|
-
typeOf: chevre.factory.product.ProductType.EventService,
|
|
139
|
-
name: { en: productIdBySubCatalog, ja: productIdBySubCatalog },
|
|
140
|
-
productID: productIdBySubCatalog,
|
|
141
|
-
hasOfferCatalog: {
|
|
142
|
-
typeOf: 'OfferCatalog',
|
|
143
|
-
itemListElement: [{ id: saveCatalogBySubResult.id }]
|
|
144
|
-
}
|
|
145
|
-
};
|
|
146
|
-
const saveProductBySubCatalogResult = await productRepo.upsertManyByProductId([{
|
|
147
|
-
$set: savingProductBySubCatalog
|
|
148
|
-
}]);
|
|
149
|
-
console.log('saveProductBySubCatalogResult:', saveProductBySubCatalogResult);
|
|
150
|
-
}
|
|
151
|
-
|
|
152
|
-
main()
|
|
153
|
-
.then()
|
|
154
|
-
.catch(console.error);
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
// tslint:disable:no-console
|
|
2
|
-
import * as mongoose from 'mongoose';
|
|
3
|
-
|
|
4
|
-
import { chevre } from '../../../../lib/index';
|
|
5
|
-
|
|
6
|
-
const { INFORM_TASK_AGG_URL } = process.env;
|
|
7
|
-
if (typeof INFORM_TASK_AGG_URL !== 'string') {
|
|
8
|
-
throw new Error('INFORM_TASK_AGG_URL required');
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
async function main() {
|
|
12
|
-
await mongoose.connect(<string>process.env.MONGOLAB_URI, { autoIndex: false });
|
|
13
|
-
|
|
14
|
-
const settingRepo = await chevre.repository.Setting.createInstance(mongoose.connection);
|
|
15
|
-
// const setting = await settingRepo.findOne({ project: { id: { $eq: '*' } } }, ['onTaskStatusChanged']);
|
|
16
|
-
// update
|
|
17
|
-
await settingRepo.updateByProject(
|
|
18
|
-
{ project: { id: { $eq: '*' } } },
|
|
19
|
-
{
|
|
20
|
-
onTaskStatusChanged: {
|
|
21
|
-
informTask: [{
|
|
22
|
-
recipient: {
|
|
23
|
-
name: 'Aggregation Service',
|
|
24
|
-
url: INFORM_TASK_AGG_URL
|
|
25
|
-
}
|
|
26
|
-
}],
|
|
27
|
-
informTaskNames: [
|
|
28
|
-
chevre.factory.taskName.Pay,
|
|
29
|
-
chevre.factory.taskName.InvalidatePaymentUrl,
|
|
30
|
-
chevre.factory.taskName.Refund,
|
|
31
|
-
chevre.factory.taskName.VoidPayment
|
|
32
|
-
// chevre.factory.taskName.ConfirmReserveTransaction
|
|
33
|
-
],
|
|
34
|
-
informTaskStatuses: [
|
|
35
|
-
chevre.factory.taskStatus.Aborted
|
|
36
|
-
// chevre.factory.taskStatus.Running
|
|
37
|
-
]
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
);
|
|
41
|
-
console.log('updated.');
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
main()
|
|
45
|
-
.then()
|
|
46
|
-
.catch(console.error);
|
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* マスターデータ同期サービス
|
|
3
|
-
*/
|
|
4
|
-
import type * as COA from '@motionpicture/coa-service';
|
|
5
|
-
import type { ActionRepo } from '../repo/action';
|
|
6
|
-
import type { CategoryCodeRepo } from '../repo/categoryCode';
|
|
7
|
-
import type { CreativeWorkRepo } from '../repo/creativeWork';
|
|
8
|
-
import type { EventRepo } from '../repo/event';
|
|
9
|
-
import type { EventSeriesRepo } from '../repo/eventSeries';
|
|
10
|
-
import type { MovieTheaterRepo } from '../repo/place/movieTheater';
|
|
11
|
-
import type { ScreeningRoomRepo } from '../repo/place/screeningRoom';
|
|
12
|
-
import type { SellerRepo } from '../repo/seller';
|
|
13
|
-
import * as factory from '../factory';
|
|
14
|
-
interface IImportFromCOAParams {
|
|
15
|
-
project: {
|
|
16
|
-
id: string;
|
|
17
|
-
typeOf: factory.organizationType.Project;
|
|
18
|
-
};
|
|
19
|
-
/**
|
|
20
|
-
* 施設コード
|
|
21
|
-
*/
|
|
22
|
-
locationBranchCode: string;
|
|
23
|
-
importFrom: Date;
|
|
24
|
-
importThrough: Date;
|
|
25
|
-
/**
|
|
26
|
-
* 施設を保管するかどうか
|
|
27
|
-
*/
|
|
28
|
-
saveMovieTheater: boolean;
|
|
29
|
-
/**
|
|
30
|
-
* 施設コンテンツを保管するかどうか
|
|
31
|
-
*/
|
|
32
|
-
saveScreeningEventSeries: boolean;
|
|
33
|
-
saveScreeningEventSeriesPeriodInMonth: number;
|
|
34
|
-
}
|
|
35
|
-
/**
|
|
36
|
-
* イベントをインポートする
|
|
37
|
-
*/
|
|
38
|
-
declare function importFromCOA(params: IImportFromCOAParams): (repos: {
|
|
39
|
-
action: ActionRepo;
|
|
40
|
-
categoryCode: CategoryCodeRepo;
|
|
41
|
-
creativeWork: CreativeWorkRepo;
|
|
42
|
-
event: EventRepo;
|
|
43
|
-
eventSeries: EventSeriesRepo;
|
|
44
|
-
movieTheater: MovieTheaterRepo;
|
|
45
|
-
screeningRoom: ScreeningRoomRepo;
|
|
46
|
-
seller: SellerRepo;
|
|
47
|
-
masterService: COA.service.Master;
|
|
48
|
-
}) => Promise<void>;
|
|
49
|
-
/**
|
|
50
|
-
* COA情報からイベントIDを作成する
|
|
51
|
-
*/
|
|
52
|
-
declare function createScreeningEventIdFromCOA(params: {
|
|
53
|
-
theaterCode: string;
|
|
54
|
-
titleCode: string;
|
|
55
|
-
titleBranchNum: string;
|
|
56
|
-
dateJouei: string;
|
|
57
|
-
screenCode: string;
|
|
58
|
-
timeBegin: string;
|
|
59
|
-
}): string;
|
|
60
|
-
export { importFromCOA, createScreeningEventIdFromCOA };
|