@chevre/domain 23.2.0-alpha.4 → 23.2.0-alpha.40
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/event/importEventsFromCOAByTitle.ts +1 -1
- package/example/src/chevre/eventSeries/migrateEventSeriesOffers.ts +75 -0
- package/example/src/chevre/eventSeries/migrateEventSeriesVideoFormat.ts +80 -0
- package/example/src/chevre/{upsertScreeningEventSeriesByVersion.ts → eventSeries/upsertScreeningEventSeriesByVersion.ts} +47 -42
- package/example/src/chevre/{upsertOfferCatalogItemsByIdentifier.ts → offerCatalog/upsertOfferCatalogItemsByIdentifier.ts} +3 -3
- package/example/src/chevre/{upsertOfferCatalogsByIdentifier.ts → offerCatalog/upsertOfferCatalogsByIdentifier.ts} +4 -3
- 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/addAdminEventSeriesReadPermissionIfNotExists.ts +49 -0
- package/example/src/chevre/roles/addAdminMovieReadPermissionIfNotExists.ts +49 -0
- package/example/src/chevre/roles/addAdminMovieTheaterReadPermissionIfNotExists.ts +34 -0
- package/example/src/chevre/roles/addAdminMovieTheaterWritePermissionIfNotExists.ts +34 -0
- package/example/src/chevre/roles/addAdminRoomReadPermissionIfNotExists.ts +34 -0
- package/example/src/chevre/roles/addAdminRoomWritePermissionIfNotExists.ts +34 -0
- package/example/src/chevre/unsetUnnecessaryFields.ts +8 -4
- package/lib/chevre/factory/event.js +5 -5
- 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/creativeWork.js +9 -5
- package/lib/chevre/repo/event.d.ts +2 -2
- 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 +10 -4
- package/lib/chevre/repo/eventSeries.js +56 -28
- package/lib/chevre/repo/mongoose/schemas/aggregateReservation.js +0 -1
- package/lib/chevre/repo/mongoose/schemas/creativeWork.js +10 -9
- package/lib/chevre/repo/mongoose/schemas/eventSeries.js +10 -0
- package/lib/chevre/repo/mongoose/schemas/place.d.ts +6 -2
- package/lib/chevre/repo/offerCatalog.d.ts +6 -1
- package/lib/chevre/repo/offerCatalog.js +26 -17
- package/lib/chevre/repo/offerCatalogItem.d.ts +6 -1
- package/lib/chevre/repo/offerCatalogItem.js +24 -15
- 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/task.d.ts +1 -1
- 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 +6 -3
- package/lib/chevre/service/event/processUpdateMovieTheater.d.ts +1 -1
- package/lib/chevre/service/event/processUpdateMovieTheater.js +13 -11
- package/lib/chevre/service/event/saveScreeningEvents.d.ts +1 -1
- package/lib/chevre/service/event/saveScreeningEvents.js +6 -5
- package/lib/chevre/service/offer/event/authorize/factory.js +4 -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 +4 -13
- package/lib/chevre/service/offer/onEventChanged.js +7 -5
- 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 +1 -1
- package/lib/chevre/service/task/createEvent/createEventBySchedule/factory.js +5 -3
- package/lib/chevre/service/task/createEvent/createEventBySchedule/schedule2events.js +1 -1
- package/lib/chevre/service/task/onResourceDeleted.d.ts +6 -0
- package/lib/chevre/service/task/onResourceDeleted.js +60 -0
- package/lib/chevre/service/task/onResourceUpdated/onResourceDeleted.d.ts +3 -7
- package/lib/chevre/service/task/onResourceUpdated/onResourceDeleted.js +19 -7
- package/lib/chevre/service/task/onResourceUpdated.js +206 -42
- package/lib/chevre/service/task/syncResourcesFromCOA.js +1 -1
- package/lib/chevre/service/taskHandler.js +1 -0
- package/package.json +4 -3
- package/example/src/chevre/event/upsertManyScreeningEventByIdentifier.ts +0 -191
- package/example/src/chevre/offers/createSampleOffers.ts +0 -154
- package/lib/chevre/service/eventOld.d.ts +0 -60
- package/lib/chevre/service/eventOld.js +0 -864
|
@@ -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,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 };
|