@chevre/domain 23.2.0-alpha.3 → 23.2.0-alpha.30
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/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/eventSeries.js +16 -12
- 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/place/entranceGate.d.ts +48 -0
- package/lib/chevre/repo/place/entranceGate.js +166 -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/payment/any/factory.d.ts +4 -0
- package/lib/chevre/service/payment/any/factory.js +2 -1
- package/lib/chevre/service/payment/any.d.ts +4 -0
- package/lib/chevre/service/payment/any.js +2 -1
- package/lib/chevre/service/task/authorizePayment.js +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 +58 -0
- package/lib/chevre/service/task/onResourceUpdated/onResourceDeleted.d.ts +1 -7
- package/lib/chevre/service/task/onResourceUpdated/onResourceDeleted.js +13 -7
- package/lib/chevre/service/task/onResourceUpdated.js +76 -4
- 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/lib/chevre/service/eventOld.d.ts +0 -60
- package/lib/chevre/service/eventOld.js +0 -864
|
@@ -1,14 +1,11 @@
|
|
|
1
1
|
import * as factory from '../../../factory';
|
|
2
|
-
import type { AccountTitleRepo } from '../../../repo/accountTitle';
|
|
3
2
|
import type { ActionRepo } from '../../../repo/action';
|
|
4
3
|
import type { AggregateOfferRepo } from '../../../repo/aggregateOffer';
|
|
5
4
|
import type { CategoryCodeRepo } from '../../../repo/categoryCode';
|
|
6
|
-
import type { CreativeWorkRepo } from '../../../repo/creativeWork';
|
|
7
5
|
import type { EventRepo } from '../../../repo/event';
|
|
8
6
|
import type { EventSeriesRepo } from '../../../repo/eventSeries';
|
|
9
7
|
import type { MemberRepo } from '../../../repo/member';
|
|
10
8
|
import type { NoteRepo } from '../../../repo/note';
|
|
11
|
-
import type { OfferRepo } from '../../../repo/offer/unitPriceInCatalog';
|
|
12
9
|
import type { OfferCatalogRepo } from '../../../repo/offerCatalog';
|
|
13
10
|
import type { OfferCatalogItemRepo } from '../../../repo/offerCatalogItem';
|
|
14
11
|
import type { PaymentServiceProviderRepo } from '../../../repo/paymentServiceProvider';
|
|
@@ -20,12 +17,10 @@ import type { ProductModelRepo } from '../../../repo/productModel';
|
|
|
20
17
|
import type { ProductOfferRepo } from '../../../repo/productOffer';
|
|
21
18
|
import type { SettingRepo } from '../../../repo/setting';
|
|
22
19
|
import type { TaskRepo } from '../../../repo/task';
|
|
23
|
-
export declare function onResourceDeleted(params: factory.task.
|
|
24
|
-
accountTitle: AccountTitleRepo;
|
|
20
|
+
export declare function onResourceDeleted(params: factory.task.onResourceDeleted.IData): (repos: {
|
|
25
21
|
action: ActionRepo;
|
|
26
22
|
aggregateOffer: AggregateOfferRepo;
|
|
27
23
|
categoryCode: CategoryCodeRepo;
|
|
28
|
-
creativeWork: CreativeWorkRepo;
|
|
29
24
|
event: EventRepo;
|
|
30
25
|
eventSeries: EventSeriesRepo;
|
|
31
26
|
hasPOS: HasPOSRepo;
|
|
@@ -33,7 +28,6 @@ export declare function onResourceDeleted(params: factory.task.onResourceUpdated
|
|
|
33
28
|
movieTheater: MovieTheaterRepo;
|
|
34
29
|
note: NoteRepo;
|
|
35
30
|
paymentServiceProvider: PaymentServiceProviderRepo;
|
|
36
|
-
offer: OfferRepo;
|
|
37
31
|
offerCatalog: OfferCatalogRepo;
|
|
38
32
|
offerCatalogItem: OfferCatalogItemRepo;
|
|
39
33
|
screeningRoom: ScreeningRoomRepo;
|
|
@@ -22,9 +22,10 @@ function onResourceDeleted(params) {
|
|
|
22
22
|
const useInform = params.useInform === true
|
|
23
23
|
&& Array.isArray(useInformResourceTypes) && useInformResourceTypes.includes(params.typeOf);
|
|
24
24
|
const isDeleted = params.isDeleted === true;
|
|
25
|
+
const resourceType = params.typeOf;
|
|
25
26
|
if (isDeleted) {
|
|
26
27
|
if (useInform) {
|
|
27
|
-
switch (
|
|
28
|
+
switch (resourceType) {
|
|
28
29
|
case 'POS':
|
|
29
30
|
yield (0, onHasPOSUpdated_1.createInformHasPOSTasks)({
|
|
30
31
|
project: { id: params.project.id },
|
|
@@ -36,7 +37,7 @@ function onResourceDeleted(params) {
|
|
|
36
37
|
// no op
|
|
37
38
|
}
|
|
38
39
|
}
|
|
39
|
-
switch (
|
|
40
|
+
switch (resourceType) {
|
|
40
41
|
case 'POS':
|
|
41
42
|
break;
|
|
42
43
|
case factory.eventType.ScreeningEventSeries:
|
|
@@ -78,7 +79,7 @@ function onResourceDeleted(params) {
|
|
|
78
79
|
yield (0, syncOfferCatalog_1.syncOfferCatalog)({
|
|
79
80
|
project: { id: params.project.id },
|
|
80
81
|
ids: params.id,
|
|
81
|
-
typeOf:
|
|
82
|
+
typeOf: resourceType,
|
|
82
83
|
isDeleted: true,
|
|
83
84
|
isOfferCatalogItem: params.isOfferCatalogItem === true
|
|
84
85
|
})(repos);
|
|
@@ -91,7 +92,7 @@ function onResourceDeleted(params) {
|
|
|
91
92
|
yield deleteResourcesByProduct({
|
|
92
93
|
project: { id: params.project.id },
|
|
93
94
|
ids: params.id,
|
|
94
|
-
typeOf:
|
|
95
|
+
typeOf: resourceType
|
|
95
96
|
})(repos);
|
|
96
97
|
break;
|
|
97
98
|
// 区分削除に対応(2024-04-18~)
|
|
@@ -104,7 +105,7 @@ function onResourceDeleted(params) {
|
|
|
104
105
|
break;
|
|
105
106
|
default:
|
|
106
107
|
// no op
|
|
107
|
-
throw new factory.errors.NotImplemented(`${
|
|
108
|
+
throw new factory.errors.NotImplemented(`${resourceType} onDeleted not implemented`);
|
|
108
109
|
}
|
|
109
110
|
}
|
|
110
111
|
});
|
|
@@ -146,9 +147,14 @@ function deleteResourcesByScreeningEventSeries(params) {
|
|
|
146
147
|
}
|
|
147
148
|
function deleteResourcesByScreeningRoom(params) {
|
|
148
149
|
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
150
|
+
// 現時点で、複数ルーム削除タスクは作成されない
|
|
151
|
+
const firstBranchCode = params.branchCode.at(0);
|
|
152
|
+
if (typeof firstBranchCode !== 'string') {
|
|
153
|
+
throw new factory.errors.ArgumentNull('branchCode');
|
|
154
|
+
}
|
|
149
155
|
const deleteActionAttributes = {
|
|
150
156
|
agent: { id: params.project.id, typeOf: factory.organizationType.Project },
|
|
151
|
-
object: { branchCode:
|
|
157
|
+
object: { branchCode: firstBranchCode, containedInPlace: params.containedInPlace, typeOf: factory.placeType.ScreeningRoom },
|
|
152
158
|
project: { id: params.project.id, typeOf: factory.organizationType.Project },
|
|
153
159
|
typeOf: factory.actionType.DeleteAction
|
|
154
160
|
};
|
|
@@ -159,7 +165,7 @@ function deleteResourcesByScreeningRoom(params) {
|
|
|
159
165
|
const deleteScreeningEventResult = yield repos.event.deleteManyEventsByScreeningRoom({
|
|
160
166
|
project: { id: params.project.id },
|
|
161
167
|
location: {
|
|
162
|
-
branchCode:
|
|
168
|
+
branchCode: firstBranchCode,
|
|
163
169
|
containedInPlace: { id: params.containedInPlace.id }
|
|
164
170
|
}
|
|
165
171
|
});
|
|
@@ -36,7 +36,7 @@ const onAggregateOfferUpdated_1 = require("./onResourceUpdated/onAggregateOfferU
|
|
|
36
36
|
const onCategoryCodeUpdated_1 = require("./onResourceUpdated/onCategoryCodeUpdated");
|
|
37
37
|
const onHasPOSUpdated_1 = require("./onResourceUpdated/onHasPOSUpdated");
|
|
38
38
|
const onOfferCatalogUpdated_1 = require("./onResourceUpdated/onOfferCatalogUpdated");
|
|
39
|
-
|
|
39
|
+
// import { onResourceDeleted } from './onResourceUpdated/onResourceDeleted';
|
|
40
40
|
/**
|
|
41
41
|
* タスク実行関数
|
|
42
42
|
*/
|
|
@@ -73,7 +73,9 @@ function onResourceUpdated(params) {
|
|
|
73
73
|
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
74
74
|
const isDeleted = params.isDeleted === true;
|
|
75
75
|
if (isDeleted) {
|
|
76
|
-
|
|
76
|
+
// migrate to onResourceDeleted task(2026-01-16~)
|
|
77
|
+
throw new factory.errors.Argument('isDeleted', 'isDeleted must be false');
|
|
78
|
+
// await onResourceDeleted(params)(repos);
|
|
77
79
|
}
|
|
78
80
|
else {
|
|
79
81
|
const setting = yield repos.setting.findOne({ project: { id: { $eq: '*' } } }, ['onResourceUpdated', 'useInformResourceTypes']);
|
|
@@ -118,6 +120,10 @@ function onResourceUpdated(params) {
|
|
|
118
120
|
typeOf: params.typeOf
|
|
119
121
|
}, setting)(repos);
|
|
120
122
|
break;
|
|
123
|
+
// ルーム通知に対応(2026-01-16~)
|
|
124
|
+
case factory.placeType.ScreeningRoom:
|
|
125
|
+
yield createInformRoomTasks(params, setting)(repos);
|
|
126
|
+
break;
|
|
121
127
|
case 'AccountTitle':
|
|
122
128
|
yield createInformAccountTitleTasks({
|
|
123
129
|
project: { id: params.project.id },
|
|
@@ -433,14 +439,14 @@ function createInformMovieTheaterTasks(params, setting) {
|
|
|
433
439
|
throw new factory.errors.NotFound(factory.placeType.MovieTheater);
|
|
434
440
|
}
|
|
435
441
|
// ルームを検索
|
|
436
|
-
const screeningRooms = yield repos.screeningRoom.
|
|
442
|
+
const screeningRooms = yield repos.screeningRoom.findRooms({
|
|
437
443
|
containedInPlace: { id: { $eq: movieTheater.id } }
|
|
438
444
|
});
|
|
439
445
|
const movieTheaters4inform = [Object.assign(Object.assign({}, movieTheater), { containsPlace: screeningRooms.map((room) => {
|
|
440
446
|
return {
|
|
441
447
|
branchCode: room.branchCode,
|
|
442
448
|
name: room.name,
|
|
443
|
-
typeOf:
|
|
449
|
+
typeOf: factory.placeType.ScreeningRoom,
|
|
444
450
|
additionalProperty: room.additionalProperty,
|
|
445
451
|
address: room.address
|
|
446
452
|
};
|
|
@@ -488,6 +494,72 @@ function createInformMovieTheaterTasks(params, setting) {
|
|
|
488
494
|
}
|
|
489
495
|
});
|
|
490
496
|
}
|
|
497
|
+
// tslint:disable-next-line:max-func-body-length
|
|
498
|
+
function createInformRoomTasks(params, setting) {
|
|
499
|
+
return (repos
|
|
500
|
+
// settings: Settings
|
|
501
|
+
) => __awaiter(this, void 0, void 0, function* () {
|
|
502
|
+
var _a;
|
|
503
|
+
// const informResources = settings.onResourceUpdated.informResource;
|
|
504
|
+
const informResources = (_a = setting === null || setting === void 0 ? void 0 : setting.onResourceUpdated) === null || _a === void 0 ? void 0 : _a.informResource;
|
|
505
|
+
if (Array.isArray(params.branchCode) && params.branchCode.length > 0) {
|
|
506
|
+
// ルームを検索
|
|
507
|
+
const rooms = (yield repos.screeningRoom.findRooms({
|
|
508
|
+
project: { id: { $eq: params.project.id } },
|
|
509
|
+
branchCode: { $in: params.branchCode },
|
|
510
|
+
containedInPlace: { id: { $eq: params.containedInPlace.id } }
|
|
511
|
+
}));
|
|
512
|
+
const rooms4inform = rooms.map((room) => {
|
|
513
|
+
return {
|
|
514
|
+
branchCode: room.branchCode,
|
|
515
|
+
name: room.name,
|
|
516
|
+
typeOf: factory.placeType.ScreeningRoom,
|
|
517
|
+
additionalProperty: room.additionalProperty,
|
|
518
|
+
address: room.address,
|
|
519
|
+
containedInPlace: { id: params.containedInPlace.id }
|
|
520
|
+
};
|
|
521
|
+
});
|
|
522
|
+
if (rooms4inform.length > 0) {
|
|
523
|
+
const taskRunsAt = new Date();
|
|
524
|
+
const informTasks = [];
|
|
525
|
+
informResources === null || informResources === void 0 ? void 0 : informResources.forEach((informResource) => {
|
|
526
|
+
var _a;
|
|
527
|
+
const informUrl = String((_a = informResource.recipient) === null || _a === void 0 ? void 0 : _a.url);
|
|
528
|
+
rooms4inform.forEach((room4inform) => {
|
|
529
|
+
var _a;
|
|
530
|
+
const informActionAttributes = {
|
|
531
|
+
object: room4inform,
|
|
532
|
+
recipient: {
|
|
533
|
+
id: '',
|
|
534
|
+
name: String((_a = informResource.recipient) === null || _a === void 0 ? void 0 : _a.name),
|
|
535
|
+
typeOf: factory.creativeWorkType.WebApplication
|
|
536
|
+
},
|
|
537
|
+
target: {
|
|
538
|
+
httpMethod: 'POST',
|
|
539
|
+
encodingType: factory.encodingFormat.Application.json,
|
|
540
|
+
typeOf: 'EntryPoint',
|
|
541
|
+
urlTemplate: informUrl
|
|
542
|
+
}
|
|
543
|
+
};
|
|
544
|
+
informTasks.push({
|
|
545
|
+
project: { id: params.project.id, typeOf: factory.organizationType.Project },
|
|
546
|
+
name: factory.taskName.TriggerWebhook,
|
|
547
|
+
status: factory.taskStatus.Ready,
|
|
548
|
+
runsAt: taskRunsAt,
|
|
549
|
+
remainingNumberOfTries: 10,
|
|
550
|
+
numberOfTried: 0,
|
|
551
|
+
executionResults: [],
|
|
552
|
+
data: informActionAttributes
|
|
553
|
+
});
|
|
554
|
+
});
|
|
555
|
+
});
|
|
556
|
+
if (informTasks.length > 0) {
|
|
557
|
+
yield repos.task.saveMany(informTasks, { emitImmediately: true });
|
|
558
|
+
}
|
|
559
|
+
}
|
|
560
|
+
}
|
|
561
|
+
});
|
|
562
|
+
}
|
|
491
563
|
function createInformAccountTitleTasks(params, setting) {
|
|
492
564
|
return (repos
|
|
493
565
|
// settings: Settings
|
|
@@ -216,7 +216,7 @@ function syncEvents(params) {
|
|
|
216
216
|
throw new factory.errors.NotFound(factory.placeType.MovieTheater);
|
|
217
217
|
}
|
|
218
218
|
// console.log('movieTheater:', movieTheater);
|
|
219
|
-
const screeningRoom = (yield repos.screeningRoom.
|
|
219
|
+
const screeningRoom = (yield repos.screeningRoom.findRooms({
|
|
220
220
|
project: { id: { $eq: params.project.id } },
|
|
221
221
|
containedInPlace: { branchCode: { $eq: movieTheater.branchCode } },
|
|
222
222
|
branchCode: { $eq: roomCode }
|
|
@@ -59,6 +59,7 @@ function executeTask(task, next) {
|
|
|
59
59
|
case factory.taskName.ImportOffersFromCOA:
|
|
60
60
|
case factory.taskName.InvalidatePaymentUrl:
|
|
61
61
|
case factory.taskName.OnAuthorizationCreated:
|
|
62
|
+
case factory.taskName.OnResourceDeleted:
|
|
62
63
|
case factory.taskName.Pay:
|
|
63
64
|
case factory.taskName.PublishPaymentUrl:
|
|
64
65
|
case factory.taskName.Refund:
|
package/package.json
CHANGED
|
@@ -11,8 +11,8 @@
|
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"@aws-sdk/client-cognito-identity-provider": "3.600.0",
|
|
13
13
|
"@aws-sdk/credential-providers": "3.600.0",
|
|
14
|
-
"@chevre/factory": "5.4.0-alpha.
|
|
15
|
-
"@cinerino/sdk": "12.
|
|
14
|
+
"@chevre/factory": "5.4.0-alpha.19",
|
|
15
|
+
"@cinerino/sdk": "12.13.0",
|
|
16
16
|
"@motionpicture/coa-service": "9.6.0",
|
|
17
17
|
"@motionpicture/gmo-service": "5.4.0-alpha.1",
|
|
18
18
|
"@sendgrid/client": "8.1.4",
|
|
@@ -33,6 +33,7 @@
|
|
|
33
33
|
"description": "Chevre Domain Library for Node.js",
|
|
34
34
|
"devDependencies": {
|
|
35
35
|
"@eslint/js": "9.16.0",
|
|
36
|
+
"@json2csv/plainjs": "7.0.6",
|
|
36
37
|
"@sendgrid/helpers": "8.0.0",
|
|
37
38
|
"@types/debug": "0.0.30",
|
|
38
39
|
"@types/google-libphonenumber": "^7.4.19",
|
|
@@ -115,5 +116,5 @@
|
|
|
115
116
|
"postversion": "git push origin --tags",
|
|
116
117
|
"prepublishOnly": "npm run clean && npm run build && npm test && npm run doc"
|
|
117
118
|
},
|
|
118
|
-
"version": "23.2.0-alpha.
|
|
119
|
+
"version": "23.2.0-alpha.30"
|
|
119
120
|
}
|
|
@@ -1,191 +0,0 @@
|
|
|
1
|
-
// tslint:disable:no-console no-magic-numbers
|
|
2
|
-
import * as moment from 'moment-timezone';
|
|
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 ADDITIONAL_PROPERTY_NAME = 'sampleCreateId';
|
|
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 eventRepo = await chevre.repository.Event.createInstance(mongoose.connection);
|
|
15
|
-
|
|
16
|
-
const today = moment()
|
|
17
|
-
.tz('Asia/Tokyo')
|
|
18
|
-
.format('YYYY-MM-DD');
|
|
19
|
-
const identifier = `fromSamples:${moment()
|
|
20
|
-
.format('YYYY-MM-DD HH:mm')}`;
|
|
21
|
-
const settingEvent: chevre.factory.event.screeningEvent.IAttributes = {
|
|
22
|
-
identifier,
|
|
23
|
-
additionalProperty: [
|
|
24
|
-
{ name: ADDITIONAL_PROPERTY_NAME, value: identifier }
|
|
25
|
-
],
|
|
26
|
-
project: {
|
|
27
|
-
id: project.id,
|
|
28
|
-
typeOf: chevre.factory.organizationType.Project
|
|
29
|
-
},
|
|
30
|
-
organizer: {
|
|
31
|
-
id: '59d20831e53ebc2b4e774466'
|
|
32
|
-
},
|
|
33
|
-
typeOf: chevre.factory.eventType.ScreeningEvent,
|
|
34
|
-
name: {
|
|
35
|
-
en: 'pet IMAX2D',
|
|
36
|
-
ja: 'ペット IMAX2D'
|
|
37
|
-
},
|
|
38
|
-
doorTime: moment(`${today}T13:00:00Z`)
|
|
39
|
-
.toDate(),
|
|
40
|
-
startDate: moment(`${today}T13:00:00Z`)
|
|
41
|
-
.toDate(),
|
|
42
|
-
endDate: moment(`${today}T14:00:00Z`)
|
|
43
|
-
.toDate(),
|
|
44
|
-
eventStatus: chevre.factory.eventStatusType.EventScheduled,
|
|
45
|
-
location: {
|
|
46
|
-
typeOf: chevre.factory.placeType.ScreeningRoom,
|
|
47
|
-
branchCode: '70',
|
|
48
|
-
name: {
|
|
49
|
-
ja: 'シネマ7',
|
|
50
|
-
en: 'CINEMA7'
|
|
51
|
-
},
|
|
52
|
-
address: {
|
|
53
|
-
ja: '',
|
|
54
|
-
en: ''
|
|
55
|
-
}
|
|
56
|
-
},
|
|
57
|
-
superEvent: {
|
|
58
|
-
typeOf: chevre.factory.eventType.ScreeningEventSeries,
|
|
59
|
-
id: 'al9s38bj6',
|
|
60
|
-
videoFormat: [
|
|
61
|
-
{
|
|
62
|
-
typeOf: '2D',
|
|
63
|
-
name: '2D'
|
|
64
|
-
},
|
|
65
|
-
{
|
|
66
|
-
typeOf: 'IMAX',
|
|
67
|
-
name: 'IMAX'
|
|
68
|
-
}
|
|
69
|
-
],
|
|
70
|
-
soundFormat: [],
|
|
71
|
-
workPerformed: {
|
|
72
|
-
typeOf: chevre.factory.creativeWorkType.Movie,
|
|
73
|
-
identifier: '1622100',
|
|
74
|
-
id: '5bfb841d5a78d7948369980a',
|
|
75
|
-
name: {
|
|
76
|
-
en: 'Pet',
|
|
77
|
-
ja: 'ペット'
|
|
78
|
-
},
|
|
79
|
-
duration: 'PT2H3M'
|
|
80
|
-
},
|
|
81
|
-
location: {
|
|
82
|
-
typeOf: chevre.factory.placeType.MovieTheater,
|
|
83
|
-
id: '5bfb841d5a78d7948369979a',
|
|
84
|
-
branchCode: '118',
|
|
85
|
-
name: {
|
|
86
|
-
ja: 'シネモーション赤坂 ',
|
|
87
|
-
en: 'CineMotion Akasaka'
|
|
88
|
-
}
|
|
89
|
-
},
|
|
90
|
-
kanaName: 'ペット IMAX2D',
|
|
91
|
-
name: {
|
|
92
|
-
en: 'pet IMAX2D',
|
|
93
|
-
ja: 'ペット IMAX2D'
|
|
94
|
-
},
|
|
95
|
-
additionalProperty: [],
|
|
96
|
-
startDate: moment('2022-09-30T15:00:00.000Z')
|
|
97
|
-
.toDate(),
|
|
98
|
-
endDate: moment('2029-07-31T15:00:00.000Z')
|
|
99
|
-
.toDate(),
|
|
100
|
-
headline: {
|
|
101
|
-
ja: 'IMAX2D上映'
|
|
102
|
-
}
|
|
103
|
-
},
|
|
104
|
-
offers: {
|
|
105
|
-
typeOf: chevre.factory.offerType.Offer,
|
|
106
|
-
eligibleQuantity: {
|
|
107
|
-
typeOf: 'QuantitativeValue',
|
|
108
|
-
unitCode: chevre.factory.unitCode.C62,
|
|
109
|
-
maxValue: 6
|
|
110
|
-
},
|
|
111
|
-
itemOffered: {
|
|
112
|
-
id: '655dc6b02cbb99d946cb6081',
|
|
113
|
-
name: {
|
|
114
|
-
ja: '通常興行カタログ(サブカタログ版)'
|
|
115
|
-
},
|
|
116
|
-
serviceOutput: {
|
|
117
|
-
typeOf: chevre.factory.reservationType.EventReservation,
|
|
118
|
-
reservedTicket: {
|
|
119
|
-
typeOf: 'Ticket',
|
|
120
|
-
ticketedSeat: {
|
|
121
|
-
typeOf: chevre.factory.placeType.Seat
|
|
122
|
-
}
|
|
123
|
-
}
|
|
124
|
-
},
|
|
125
|
-
typeOf: chevre.factory.product.ProductType.EventService,
|
|
126
|
-
availableChannel: {
|
|
127
|
-
typeOf: 'ServiceChannel',
|
|
128
|
-
serviceLocation: {
|
|
129
|
-
typeOf: chevre.factory.placeType.ScreeningRoom,
|
|
130
|
-
branchCode: '70',
|
|
131
|
-
name: {
|
|
132
|
-
ja: 'シネマ7',
|
|
133
|
-
en: 'CINEMA7'
|
|
134
|
-
},
|
|
135
|
-
containedInPlace: {
|
|
136
|
-
typeOf: chevre.factory.placeType.MovieTheater,
|
|
137
|
-
id: '5bfb841d5a78d7948369979a',
|
|
138
|
-
branchCode: '118',
|
|
139
|
-
name: {
|
|
140
|
-
ja: 'シネモーション赤坂 ',
|
|
141
|
-
en: 'CineMotion Akasaka'
|
|
142
|
-
}
|
|
143
|
-
}
|
|
144
|
-
}
|
|
145
|
-
}
|
|
146
|
-
},
|
|
147
|
-
seller: {
|
|
148
|
-
typeOf: chevre.factory.organizationType.Corporation,
|
|
149
|
-
id: '59d20831e53ebc2b4e774466',
|
|
150
|
-
name: {
|
|
151
|
-
ja: 'シネモーション赤坂',
|
|
152
|
-
en: 'CineMotion Akasaka'
|
|
153
|
-
},
|
|
154
|
-
makesOffer: [
|
|
155
|
-
]
|
|
156
|
-
}
|
|
157
|
-
}
|
|
158
|
-
};
|
|
159
|
-
|
|
160
|
-
const createResult = await eventRepo.upsertManyScreeningEventByIdentifier(
|
|
161
|
-
[
|
|
162
|
-
{
|
|
163
|
-
$set: settingEvent,
|
|
164
|
-
$unset: {}
|
|
165
|
-
}
|
|
166
|
-
],
|
|
167
|
-
{ update: false }
|
|
168
|
-
);
|
|
169
|
-
// tslint:disable-next-line:no-null-keyword
|
|
170
|
-
console.dir(createResult, { depth: null });
|
|
171
|
-
|
|
172
|
-
const updateResult = await eventRepo.upsertManyScreeningEventByIdentifier(
|
|
173
|
-
[
|
|
174
|
-
{
|
|
175
|
-
$set: {
|
|
176
|
-
...settingEvent,
|
|
177
|
-
eventStatus: chevre.factory.eventStatusType.EventCancelled
|
|
178
|
-
},
|
|
179
|
-
$unset: {}
|
|
180
|
-
}
|
|
181
|
-
],
|
|
182
|
-
{ update: true }
|
|
183
|
-
);
|
|
184
|
-
// tslint:disable-next-line:no-null-keyword
|
|
185
|
-
console.dir(updateResult, { depth: null });
|
|
186
|
-
|
|
187
|
-
}
|
|
188
|
-
|
|
189
|
-
main()
|
|
190
|
-
.then()
|
|
191
|
-
.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 };
|