@chevre/domain 22.6.0-alpha.9 → 22.6.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/example/src/chevre/aggregateAllEvents2.ts +0 -19
- package/example/src/chevre/createEventBySchedule.ts +53 -0
- package/example/src/chevre/findSchedule.ts +4 -0
- package/example/src/chevre/findSetting.ts +75 -0
- package/example/src/chevre/projectEventFieldsById.ts +23 -0
- package/example/src/chevre/reIndex.ts +20 -0
- package/example/src/chevre/retryTasks.ts +6 -4
- package/example/src/chevre/searchAuthorizations.ts +35 -0
- package/example/src/chevre/unsetUnnecessaryFields.ts +34 -16
- package/lib/chevre/credentials.js +0 -13
- package/lib/chevre/emailMessageBuilder.d.ts +5 -5
- package/lib/chevre/emailMessageBuilder.js +20 -8
- package/lib/chevre/repo/action.d.ts +7 -1
- package/lib/chevre/repo/authorization.js +5 -1
- package/lib/chevre/repo/credentials.d.ts +19 -0
- package/lib/chevre/repo/credentials.js +70 -0
- package/lib/chevre/repo/event.d.ts +0 -5
- package/lib/chevre/repo/event.js +0 -26
- package/lib/chevre/repo/interface.d.ts +25 -0
- package/lib/chevre/repo/interface.js +62 -0
- package/lib/chevre/repo/mongoose/schemas/aggregateOffer.js +5 -21
- package/lib/chevre/repo/mongoose/schemas/authorization.js +9 -0
- package/lib/chevre/repo/mongoose/schemas/categoryCode.js +36 -11
- package/lib/chevre/repo/mongoose/schemas/civicStructure.js +9 -1
- package/lib/chevre/repo/mongoose/schemas/creativeWork.js +9 -1
- package/lib/chevre/repo/mongoose/schemas/interface.d.ts +11 -0
- package/lib/chevre/repo/mongoose/schemas/interface.js +55 -0
- package/lib/chevre/repo/mongoose/schemas/offerCatalog.d.ts +1 -1
- package/lib/chevre/repo/mongoose/schemas/offerCatalog.js +29 -25
- package/lib/chevre/repo/mongoose/schemas/offerCatalogItem.d.ts +1 -1
- package/lib/chevre/repo/mongoose/schemas/offerCatalogItem.js +21 -15
- package/lib/chevre/repo/mongoose/schemas/place.js +1 -1
- package/lib/chevre/repo/mongoose/schemas/reservation.d.ts +1 -1
- package/lib/chevre/repo/mongoose/schemas/reservation.js +25 -19
- package/lib/chevre/repo/mongoose/schemas/schedule.d.ts +1 -1
- package/lib/chevre/repo/mongoose/schemas/setting.d.ts +41 -0
- package/lib/chevre/repo/mongoose/schemas/setting.js +61 -0
- package/lib/chevre/repo/offerCatalog.d.ts +5 -1
- package/lib/chevre/repo/offerCatalog.js +6 -0
- package/lib/chevre/repo/offerCatalogItem.d.ts +5 -1
- package/lib/chevre/repo/offerCatalogItem.js +6 -0
- package/lib/chevre/repo/place/movieTheater.d.ts +0 -6
- package/lib/chevre/repo/place/movieTheater.js +0 -14
- package/lib/chevre/repo/reservation.d.ts +2 -1
- package/lib/chevre/repo/reservation.js +13 -3
- package/lib/chevre/repo/schedule.d.ts +9 -2
- package/lib/chevre/repo/schedule.js +19 -6
- package/lib/chevre/repo/setting.d.ts +50 -0
- package/lib/chevre/repo/setting.js +60 -0
- package/lib/chevre/repository.d.ts +15 -0
- package/lib/chevre/repository.js +41 -2
- package/lib/chevre/service/aggregation/event/aggregateOffers.js +44 -29
- package/lib/chevre/service/aggregation/event/aggregateScreeningEvent.js +10 -4
- package/lib/chevre/service/aggregation/event/aggregateUseActionsOnEvent.js +17 -9
- package/lib/chevre/service/assetTransaction/pay.d.ts +6 -1
- package/lib/chevre/service/assetTransaction/pay.js +9 -4
- package/lib/chevre/service/assetTransaction/reserve/cancel.d.ts +2 -0
- package/lib/chevre/service/assetTransaction/reserve/cancel.js +4 -2
- package/lib/chevre/service/assetTransaction/reserve/confirm.d.ts +2 -0
- package/lib/chevre/service/assetTransaction/reserve/confirm.js +11 -11
- package/lib/chevre/service/assetTransaction/reserve/exportTasksById.js +31 -39
- package/lib/chevre/service/assetTransaction/reserve/start/factory/createReservation.d.ts +7 -3
- package/lib/chevre/service/assetTransaction/reserve/start/factory/createReservation.js +3 -1
- package/lib/chevre/service/assetTransaction/reserve/start.d.ts +2 -0
- package/lib/chevre/service/assetTransaction/reserve/start.js +6 -4
- package/lib/chevre/service/event.d.ts +3 -2
- package/lib/chevre/service/event.js +7 -7
- package/lib/chevre/service/offer/event/authorize/processStartReserve4chevre.d.ts +2 -0
- package/lib/chevre/service/offer/event/authorize.d.ts +2 -0
- package/lib/chevre/service/offer/event/voidTransaction/processVoidTransaction4chevre.d.ts +2 -0
- package/lib/chevre/service/offer/event/voidTransaction.d.ts +2 -0
- package/lib/chevre/service/offer/event/voidTransactionByActionId.d.ts +2 -0
- package/lib/chevre/service/offer/onEventChanged.d.ts +3 -2
- package/lib/chevre/service/offer/onEventChanged.js +22 -11
- package/lib/chevre/service/order/onAssetTransactionStatusChanged.d.ts +3 -0
- package/lib/chevre/service/order/onAssetTransactionStatusChanged.js +1 -1
- package/lib/chevre/service/order/onOrderStatusChanged/onOrderDelivered/factory.d.ts +2 -2
- package/lib/chevre/service/order/onOrderStatusChanged/onOrderDelivered/factory.js +5 -2
- package/lib/chevre/service/order/onOrderStatusChanged/onOrderDelivered.d.ts +3 -2
- package/lib/chevre/service/order/onOrderStatusChanged/onOrderDelivered.js +6 -2
- package/lib/chevre/service/order/onOrderStatusChanged/onOrderDeliveredPartially/factory.d.ts +2 -2
- package/lib/chevre/service/order/onOrderStatusChanged/onOrderDeliveredPartially/factory.js +5 -2
- package/lib/chevre/service/order/onOrderStatusChanged/onOrderDeliveredPartially.d.ts +3 -2
- package/lib/chevre/service/order/onOrderStatusChanged/onOrderDeliveredPartially.js +6 -2
- package/lib/chevre/service/order/onOrderStatusChanged/onOrderProcessing/factory.d.ts +2 -2
- package/lib/chevre/service/order/onOrderStatusChanged/onOrderProcessing/factory.js +5 -2
- package/lib/chevre/service/order/onOrderStatusChanged/onOrderProcessing.d.ts +2 -0
- package/lib/chevre/service/order/onOrderStatusChanged/onOrderProcessing.js +2 -1
- package/lib/chevre/service/order/onOrderStatusChanged/onOrderReturned/factory.d.ts +2 -2
- package/lib/chevre/service/order/onOrderStatusChanged/onOrderReturned/factory.js +5 -2
- package/lib/chevre/service/order/onOrderStatusChanged/onOrderReturned.d.ts +3 -2
- package/lib/chevre/service/order/onOrderStatusChanged/onOrderReturned.js +6 -2
- package/lib/chevre/service/order/onOrderUpdated/factory.d.ts +2 -2
- package/lib/chevre/service/order/onOrderUpdated/factory.js +5 -2
- package/lib/chevre/service/order/onOrderUpdated.d.ts +3 -2
- package/lib/chevre/service/order/onOrderUpdated.js +8 -2
- package/lib/chevre/service/order/payOrder.d.ts +2 -0
- package/lib/chevre/service/order/placeOrder.d.ts +2 -0
- package/lib/chevre/service/order/returnOrder.d.ts +3 -2
- package/lib/chevre/service/order/returnOrder.js +7 -5
- package/lib/chevre/service/order/sendOrder.d.ts +2 -0
- package/lib/chevre/service/order/sendOrder.js +5 -3
- package/lib/chevre/service/payment/any/onRefund.js +30 -17
- package/lib/chevre/service/payment/any/person2username.d.ts +2 -2
- package/lib/chevre/service/payment/any/person2username.js +10 -2
- package/lib/chevre/service/payment/any/verifyTicketTokenAsNeeded.d.ts +2 -1
- package/lib/chevre/service/payment/any/verifyTicketTokenAsNeeded.js +26 -17
- package/lib/chevre/service/payment/any.d.ts +5 -1
- package/lib/chevre/service/payment/any.js +31 -12
- package/lib/chevre/service/payment/movieTicket/authorize.d.ts +6 -1
- package/lib/chevre/service/payment/movieTicket/authorize.js +4 -2
- package/lib/chevre/service/payment/movieTicket/checkMovieTicket.d.ts +2 -0
- package/lib/chevre/service/payment/movieTicket/checkMovieTicket.js +9 -12
- package/lib/chevre/service/payment/movieTicket/factory.js +12 -16
- package/lib/chevre/service/payment/movieTicket/payMovieTicket.d.ts +2 -0
- package/lib/chevre/service/payment/movieTicket/payMovieTicket.js +2 -1
- package/lib/chevre/service/payment/movieTicket/processPurchaseNumberAuth.d.ts +2 -0
- package/lib/chevre/service/payment/movieTicket/processPurchaseNumberAuth.js +2 -1
- package/lib/chevre/service/payment/movieTicket/refundMovieTicket.d.ts +2 -0
- package/lib/chevre/service/payment/movieTicket/refundMovieTicket.js +2 -1
- package/lib/chevre/service/payment/movieTicket/validation.d.ts +5 -1
- package/lib/chevre/service/payment/movieTicket/validation.js +47 -40
- package/lib/chevre/service/payment/movieTicket/voidTransaction.d.ts +2 -0
- package/lib/chevre/service/payment.d.ts +13 -4
- package/lib/chevre/service/payment.js +15 -11
- package/lib/chevre/service/reserve/cancelReservation.d.ts +5 -3
- package/lib/chevre/service/reserve/cancelReservation.js +8 -4
- package/lib/chevre/service/reserve/checkInReservation.d.ts +3 -2
- package/lib/chevre/service/reserve/checkInReservation.js +18 -21
- package/lib/chevre/service/reserve/confirmReservation.d.ts +3 -2
- package/lib/chevre/service/reserve/confirmReservation.js +4 -2
- package/lib/chevre/service/reserve/potentialActions/onPendingReservationCanceled.d.ts +3 -2
- package/lib/chevre/service/reserve/potentialActions/onPendingReservationCanceled.js +8 -2
- package/lib/chevre/service/reserve/potentialActions/onReservationCanceled.d.ts +3 -2
- package/lib/chevre/service/reserve/potentialActions/onReservationCanceled.js +8 -2
- package/lib/chevre/service/reserve/potentialActions/onReservationCheckedIn.d.ts +6 -3
- package/lib/chevre/service/reserve/potentialActions/onReservationCheckedIn.js +10 -9
- package/lib/chevre/service/reserve/potentialActions/onReservationConfirmed.d.ts +3 -2
- package/lib/chevre/service/reserve/potentialActions/onReservationConfirmed.js +8 -2
- package/lib/chevre/service/reserve/potentialActions/onReservationUsed.d.ts +7 -3
- package/lib/chevre/service/reserve/potentialActions/onReservationUsed.js +28 -13
- package/lib/chevre/service/reserve/potentialActions/onReservationsCreated.d.ts +3 -2
- package/lib/chevre/service/reserve/potentialActions/onReservationsCreated.js +8 -2
- package/lib/chevre/service/reserve/useReservation.d.ts +3 -2
- package/lib/chevre/service/reserve/useReservation.js +11 -7
- package/lib/chevre/service/task/acceptCOAOffer.d.ts +1 -1
- package/lib/chevre/service/task/acceptCOAOffer.js +27 -4
- package/lib/chevre/service/task/authorizePayment.js +9 -0
- package/lib/chevre/service/task/cancelPendingReservation.js +12 -14
- package/lib/chevre/service/task/cancelReservation.js +12 -14
- package/lib/chevre/service/task/checkMovieTicket.js +12 -3
- package/lib/chevre/service/task/confirmReserveTransaction.d.ts +3 -1
- package/lib/chevre/service/task/confirmReserveTransaction.js +22 -6
- package/lib/chevre/service/task/createEvent/createEvent.d.ts +3 -2
- package/lib/chevre/service/task/createEvent/createEvent.js +5 -2
- package/lib/chevre/service/task/createEvent/createEventBySchedule.d.ts +3 -2
- package/lib/chevre/service/task/createEvent/createEventBySchedule.js +185 -94
- package/lib/chevre/service/task/createEvent.js +6 -2
- package/lib/chevre/service/task/deletePerson.js +28 -10
- package/lib/chevre/service/task/importEventCapacitiesFromCOA.d.ts +2 -2
- package/lib/chevre/service/task/importEventCapacitiesFromCOA.js +14 -5
- package/lib/chevre/service/task/importEventsFromCOA.d.ts +2 -2
- package/lib/chevre/service/task/importEventsFromCOA.js +14 -5
- package/lib/chevre/service/task/importOffersFromCOA.d.ts +2 -2
- package/lib/chevre/service/task/importOffersFromCOA.js +15 -6
- package/lib/chevre/service/task/onAssetTransactionStatusChanged.js +2 -0
- package/lib/chevre/service/task/onAuthorizationCreated.js +13 -12
- package/lib/chevre/service/task/onEventChanged.js +6 -2
- package/lib/chevre/service/task/onOrderPaymentCompleted.js +2 -0
- package/lib/chevre/service/task/onResourceUpdated/onAggregateOfferUpdated.d.ts +3 -3
- package/lib/chevre/service/task/onResourceUpdated/onAggregateOfferUpdated.js +7 -3
- package/lib/chevre/service/task/onResourceUpdated/onHasPOSUpdated.d.ts +3 -2
- package/lib/chevre/service/task/onResourceUpdated/onHasPOSUpdated.js +8 -3
- package/lib/chevre/service/task/onResourceUpdated/onOfferCatalogUpdated.d.ts +4 -3
- package/lib/chevre/service/task/onResourceUpdated/onOfferCatalogUpdated.js +7 -3
- package/lib/chevre/service/task/onResourceUpdated/onResourceDeleted.d.ts +3 -2
- package/lib/chevre/service/task/onResourceUpdated/onResourceDeleted.js +7 -3
- package/lib/chevre/service/task/onResourceUpdated.js +61 -33
- package/lib/chevre/service/task/pay.js +27 -2
- package/lib/chevre/service/task/placeOrder.js +2 -0
- package/lib/chevre/service/task/refund.js +10 -0
- package/lib/chevre/service/task/reserve.js +6 -2
- package/lib/chevre/service/task/returnOrder.js +6 -2
- package/lib/chevre/service/task/returnReserveTransaction.d.ts +1 -1
- package/lib/chevre/service/task/returnReserveTransaction.js +21 -7
- package/lib/chevre/service/task/sendOrder.js +2 -0
- package/lib/chevre/service/task/useReservation.js +6 -2
- package/lib/chevre/service/task/voidPayment.js +14 -1
- package/lib/chevre/service/task/voidReserveTransaction.d.ts +1 -1
- package/lib/chevre/service/task/voidReserveTransaction.js +21 -6
- package/lib/chevre/service/task.d.ts +0 -5
- package/lib/chevre/service/task.js +6 -0
- package/lib/chevre/service/transaction/placeOrder/confirm/potentialActions/sendEmailMessage.d.ts +2 -2
- package/lib/chevre/service/transaction/placeOrder/confirm/potentialActions/sendEmailMessage.js +5 -2
- package/lib/chevre/service/transaction/placeOrder/confirm/potentialActions.d.ts +2 -2
- package/lib/chevre/service/transaction/placeOrder/confirm/potentialActions.js +5 -2
- package/lib/chevre/service/transaction/placeOrder/confirm.d.ts +3 -2
- package/lib/chevre/service/transaction/placeOrder/confirm.js +11 -2
- package/lib/chevre/service/transaction/returnOrder/potentialActions/returnPaymentMethod.d.ts +2 -2
- package/lib/chevre/service/transaction/returnOrder/potentialActions/returnPaymentMethod.js +14 -7
- package/lib/chevre/service/transaction/returnOrder/potentialActions/sendEmailMessage.d.ts +2 -2
- package/lib/chevre/service/transaction/returnOrder/potentialActions/sendEmailMessage.js +4 -2
- package/lib/chevre/service/transaction/returnOrder/potentialActions.d.ts +2 -2
- package/lib/chevre/service/transaction/returnOrder/potentialActions.js +6 -3
- package/lib/chevre/service/transaction/returnOrder.d.ts +3 -1
- package/lib/chevre/service/transaction/returnOrder.js +10 -2
- package/lib/chevre/settings.d.ts +20 -66
- package/lib/chevre/settings.js +21 -10
- package/package.json +5 -5
- package/example/src/chevre/searchAssetTransactions.ts +0 -38
|
@@ -11,35 +11,64 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
exports.createEventBySchedule = void 0;
|
|
13
13
|
const createDebug = require("debug");
|
|
14
|
+
// import * as fs from 'fs';
|
|
14
15
|
const moment = require("moment-timezone");
|
|
15
16
|
const factory = require("../../../factory");
|
|
17
|
+
// import { Settings } from '../../../settings';
|
|
16
18
|
const event_1 = require("../../event");
|
|
17
19
|
const debug = createDebug('chevre-domain:service:task');
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
function
|
|
25
|
-
|
|
26
|
-
)
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
20
|
+
function createEvents(
|
|
21
|
+
// schedule: factory.schedule.ISchedule4ttts | factory.schedule.IEventWithSchedule,
|
|
22
|
+
schedule, createDate) {
|
|
23
|
+
// tslint:disable-next-line:cyclomatic-complexity max-func-body-length
|
|
24
|
+
return (repos
|
|
25
|
+
// settings: Settings
|
|
26
|
+
) => __awaiter(this, void 0, void 0, function* () {
|
|
27
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
28
|
+
// console.log(moment.duration(15, 'minute').toISOString());
|
|
29
|
+
// return;
|
|
30
|
+
const eventServiceId = (_b = (_a = schedule.offers) === null || _a === void 0 ? void 0 : _a.itemOffered) === null || _b === void 0 ? void 0 : _b.id;
|
|
31
|
+
const makesOffer = (_d = (_c = schedule.offers) === null || _c === void 0 ? void 0 : _c.seller) === null || _d === void 0 ? void 0 : _d.makesOffer;
|
|
32
|
+
const applicationIds = (Array.isArray(makesOffer))
|
|
33
|
+
? makesOffer.map(({ availableAtOrFrom }) => availableAtOrFrom.id)
|
|
34
|
+
: [];
|
|
35
|
+
const eventSeriesId = (_e = schedule.superEvent) === null || _e === void 0 ? void 0 : _e.id;
|
|
36
|
+
if (typeof eventServiceId !== 'string' || eventServiceId === '') {
|
|
37
|
+
throw new factory.errors.NotFound('schedule.offers.itemOffered.id');
|
|
38
|
+
}
|
|
39
|
+
if (typeof eventSeriesId !== 'string' || eventSeriesId === '') {
|
|
40
|
+
throw new factory.errors.NotFound('schedule.superEvent.id');
|
|
32
41
|
}
|
|
33
42
|
const project = schedule.project;
|
|
34
43
|
// 引数情報取得
|
|
35
|
-
|
|
44
|
+
if (schedule.eventSchedule === undefined) {
|
|
45
|
+
throw new factory.errors.NotFound('eventSchedule');
|
|
46
|
+
}
|
|
47
|
+
const targetInfo = getTargetInfoByEventWithSchedule(schedule, createDate);
|
|
36
48
|
debug(targetInfo.length, 'targetInfos ->', targetInfo);
|
|
49
|
+
// fs.writeFileSync(
|
|
50
|
+
// `${__dirname}/../../../../../targetInfo_${schedule.eventSchedule?.typeOf}.json`,
|
|
51
|
+
// JSON.stringify(targetInfo, null, ' ')
|
|
52
|
+
// );
|
|
53
|
+
// return;
|
|
54
|
+
// 施設コンテンツ検索
|
|
55
|
+
const screeningEventSeries = (yield repos.eventSeries.projectEventSeriesFields({
|
|
56
|
+
project: { id: { $eq: project.id } },
|
|
57
|
+
id: { $eq: eventSeriesId }
|
|
58
|
+
}, [
|
|
59
|
+
'location', 'additionalProperty', 'description', 'endDate', 'headline', 'kanaName', 'name',
|
|
60
|
+
'soundFormat', 'startDate', 'typeOf', 'videoFormat', 'workPerformed'
|
|
61
|
+
])).shift();
|
|
62
|
+
if (screeningEventSeries === undefined) {
|
|
63
|
+
throw new factory.errors.NotFound(factory.eventType.ScreeningEventSeries);
|
|
64
|
+
}
|
|
65
|
+
const workPerformedIdentifier = screeningEventSeries.workPerformed.identifier;
|
|
37
66
|
// 劇場検索
|
|
38
67
|
const movieTheaters = yield repos.movieTheater.projectFields({
|
|
39
68
|
limit: 1,
|
|
40
69
|
page: 1,
|
|
41
70
|
project: { id: { $eq: project.id } },
|
|
42
|
-
branchCode: { $eq:
|
|
71
|
+
branchCode: { $eq: screeningEventSeries.location.branchCode }
|
|
43
72
|
}, ['id', 'branchCode', 'offers', 'parentOrganization']);
|
|
44
73
|
const movieTheater = movieTheaters.shift();
|
|
45
74
|
if (movieTheater === undefined) {
|
|
@@ -56,41 +85,38 @@ function createEvents(schedule
|
|
|
56
85
|
if (screeningRoom === undefined) {
|
|
57
86
|
throw new factory.errors.NotFound(factory.placeType.ScreeningRoom);
|
|
58
87
|
}
|
|
59
|
-
// 施設コンテンツ検索
|
|
60
|
-
const workPerformedIdentifier = schedule.film;
|
|
61
|
-
const screeningEventSeries = (yield repos.eventSeries.projectEventSeriesFields({
|
|
62
|
-
project: { id: { $eq: project.id } },
|
|
63
|
-
workPerformed: { identifiers: [workPerformedIdentifier] }
|
|
64
|
-
}, [
|
|
65
|
-
'location', 'additionalProperty', 'description', 'endDate', 'headline', 'kanaName', 'name',
|
|
66
|
-
'soundFormat', 'startDate', 'typeOf', 'videoFormat', 'workPerformed'
|
|
67
|
-
])).shift();
|
|
68
|
-
if (screeningEventSeries === undefined) {
|
|
69
|
-
throw new factory.errors.NotFound(factory.eventType.ScreeningEventSeries);
|
|
70
|
-
}
|
|
71
88
|
// 興行検索
|
|
72
|
-
const eventServiceProductID = schedule.eventServiceProductID; // 興行設定に変更(2023-09-24~)
|
|
89
|
+
// const eventServiceProductID = schedule.eventServiceProductID; // 興行設定に変更(2023-09-24~)
|
|
73
90
|
const searchEventServicesResult = yield repos.product.projectFields({
|
|
74
91
|
limit: 1,
|
|
75
92
|
page: 1,
|
|
76
93
|
project: { id: { $eq: project.id } },
|
|
77
|
-
|
|
94
|
+
id: { $eq: eventServiceId }
|
|
95
|
+
// productID: { $eq: eventServiceProductID }
|
|
78
96
|
}, ['name']);
|
|
79
97
|
const eventService = searchEventServicesResult.shift();
|
|
80
98
|
if (typeof (eventService === null || eventService === void 0 ? void 0 : eventService.id) !== 'string') {
|
|
81
|
-
throw new Error(`EventService ${
|
|
99
|
+
throw new Error(`EventService ${eventServiceId} not found`);
|
|
100
|
+
}
|
|
101
|
+
let existingApplicationMembers = [];
|
|
102
|
+
if (applicationIds.length > 0) {
|
|
103
|
+
existingApplicationMembers = (yield repos.member.projectFields({
|
|
104
|
+
limit: 100,
|
|
105
|
+
page: 1,
|
|
106
|
+
project: { id: { $eq: project.id } },
|
|
107
|
+
member: {
|
|
108
|
+
typeOf: {
|
|
109
|
+
$eq: factory.creativeWorkType.WebApplication
|
|
110
|
+
},
|
|
111
|
+
id: { $in: applicationIds }
|
|
112
|
+
}
|
|
113
|
+
}, ['member']));
|
|
82
114
|
}
|
|
83
|
-
let existingApplicationMembers = yield repos.member.projectFields({
|
|
84
|
-
limit: 100,
|
|
85
|
-
page: 1,
|
|
86
|
-
project: { id: { $eq: project.id } },
|
|
87
|
-
member: { typeOf: { $eq: factory.creativeWorkType.WebApplication } }
|
|
88
|
-
}, ['member']);
|
|
89
115
|
// ロールで絞る(customer or pos)
|
|
90
|
-
existingApplicationMembers = existingApplicationMembers
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
});
|
|
116
|
+
// existingApplicationMembers = existingApplicationMembers
|
|
117
|
+
// .filter((m) => {
|
|
118
|
+
// return Array.isArray(m.member.hasRole) && m.member.hasRole.some((r) => AVAILABLE_ROLE_NAMES.includes(r.roleName));
|
|
119
|
+
// });
|
|
94
120
|
for (const performanceInfo of targetInfo) {
|
|
95
121
|
const id = [
|
|
96
122
|
// tslint:disable-next-line:no-magic-numbers
|
|
@@ -100,7 +126,7 @@ function createEvents(schedule
|
|
|
100
126
|
screeningRoom.branchCode,
|
|
101
127
|
performanceInfo.start_time
|
|
102
128
|
].join('');
|
|
103
|
-
const maxValue = (
|
|
129
|
+
const maxValue = (_g = (_f = movieTheater.offers) === null || _f === void 0 ? void 0 : _f.eligibleQuantity) === null || _g === void 0 ? void 0 : _g.maxValue;
|
|
104
130
|
const availabilityEnds = moment(performanceInfo.end_date)
|
|
105
131
|
.tz('Asia/Tokyo')
|
|
106
132
|
.endOf('date')
|
|
@@ -155,7 +181,7 @@ function createEvents(schedule
|
|
|
155
181
|
? { name: screeningEventSeries.location.name }
|
|
156
182
|
: undefined)
|
|
157
183
|
}
|
|
158
|
-
} }, { name: { ja: (typeof eventService.name === 'string') ? eventService.name : String((
|
|
184
|
+
} }, { name: { ja: (typeof eventService.name === 'string') ? eventService.name : String((_h = eventService.name) === null || _h === void 0 ? void 0 : _h.ja) } }), seller: offersSeller }, {
|
|
159
185
|
// availabilityEnds, // discontinue(2024-10-16~)
|
|
160
186
|
// availabilityStarts,
|
|
161
187
|
// validThrough,
|
|
@@ -201,7 +227,9 @@ function createEvents(schedule
|
|
|
201
227
|
attributes: eventAttributes,
|
|
202
228
|
project: { id: eventAttributes.project.id },
|
|
203
229
|
agent: eventAttributes.project
|
|
204
|
-
})(repos
|
|
230
|
+
})(repos
|
|
231
|
+
// settings
|
|
232
|
+
);
|
|
205
233
|
debug('event update(updateEvent4ttts)', id, eventAttributes.startDate);
|
|
206
234
|
}
|
|
207
235
|
debug(targetInfo.length, 'events updated');
|
|
@@ -210,71 +238,134 @@ function createEvents(schedule
|
|
|
210
238
|
/**
|
|
211
239
|
* パフォーマンス作成・作成対象情報取得
|
|
212
240
|
*/
|
|
213
|
-
function getTargetInfoForCreateFromSetting(
|
|
241
|
+
// function getTargetInfoForCreateFromSetting(
|
|
242
|
+
// settings: factory.schedule.ISchedule4ttts,
|
|
243
|
+
// createDate: Date
|
|
244
|
+
// ): ITargetPerformanceInfo[] {
|
|
245
|
+
// const performanceInfos: ITargetPerformanceInfo[] = [];
|
|
246
|
+
// const { days, duration, noPerformanceTimes, hours, minutes, tours } = settings;
|
|
247
|
+
// // 本日日付+開始日までの日数から作成開始日セット
|
|
248
|
+
// // 作成日数分の作成対象日付作成
|
|
249
|
+
// for (let index = 0; index < days; index = index + 1) {
|
|
250
|
+
// const now = (createDate instanceof Date)
|
|
251
|
+
// ? moment(createDate)
|
|
252
|
+
// .add(index, 'days')
|
|
253
|
+
// : moment()
|
|
254
|
+
// .add(index, 'days');
|
|
255
|
+
// hours.forEach((hourStr) => {
|
|
256
|
+
// // 2桁でない時は'0'詰め
|
|
257
|
+
// // tslint:disable-next-line:no-magic-numbers
|
|
258
|
+
// const hour = `0${hourStr}`.slice(-2);
|
|
259
|
+
// minutes.forEach((minute, minuteIndex) => {
|
|
260
|
+
// // ツアー情報作成
|
|
261
|
+
// const tourNumber = `${hour}${tours[minuteIndex]}`;
|
|
262
|
+
// const startDate = moment(
|
|
263
|
+
// `${now.tz('Asia/Tokyo')
|
|
264
|
+
// .format('YYYYMMDD')} ${hour}:${minute}:00+09:00`,
|
|
265
|
+
// 'YYYYMMDD HH:mm:ssZ'
|
|
266
|
+
// );
|
|
267
|
+
// const endDate = moment(startDate)
|
|
268
|
+
// .add(duration, 'minutes');
|
|
269
|
+
// const day = moment(startDate)
|
|
270
|
+
// .tz('Asia/Tokyo')
|
|
271
|
+
// .format('YYYYMMDD');
|
|
272
|
+
// const startTime = moment(startDate)
|
|
273
|
+
// .tz('Asia/Tokyo')
|
|
274
|
+
// .format('HHmm');
|
|
275
|
+
// const endTime = moment(endDate)
|
|
276
|
+
// .tz('Asia/Tokyo')
|
|
277
|
+
// .format('HHmm');
|
|
278
|
+
// // パフォーマンスを作成しない時刻に指定されていなかったら作成
|
|
279
|
+
// if (noPerformanceTimes.indexOf(`${hour}${minute}`) < 0) {
|
|
280
|
+
// performanceInfos.push({
|
|
281
|
+
// day: day,
|
|
282
|
+
// start_time: startTime,
|
|
283
|
+
// end_time: endTime,
|
|
284
|
+
// door_time: startDate.toDate(),
|
|
285
|
+
// start_date: startDate.toDate(),
|
|
286
|
+
// end_date: endDate.toDate(),
|
|
287
|
+
// tour_number: tourNumber,
|
|
288
|
+
// duration: moment.duration(duration, 'minutes')
|
|
289
|
+
// .toISOString()
|
|
290
|
+
// });
|
|
291
|
+
// }
|
|
292
|
+
// });
|
|
293
|
+
// });
|
|
294
|
+
// }
|
|
295
|
+
// return performanceInfos;
|
|
296
|
+
// }
|
|
297
|
+
function getTargetInfoByEventWithSchedule(settings, createDate) {
|
|
214
298
|
const performanceInfos = [];
|
|
215
|
-
const {
|
|
299
|
+
const { eventSchedule } = settings;
|
|
216
300
|
// 作成対象時間: 9,10,11など
|
|
217
301
|
// const hours: string[] = ['9', '10', '11', '12', '13', '14', '15', '16', '17', '18', '19', '20', '21', '22'];
|
|
218
|
-
// 作成開始が今日から何日後か: 30
|
|
219
|
-
// const start: number = 91;
|
|
220
|
-
// 何日分作成するか: 7
|
|
221
|
-
// const days: number = 1;
|
|
222
302
|
// const minutes = ['00', '15', '30', '45'];
|
|
223
303
|
// const tours = ['1', '2', '3', '4'];
|
|
224
|
-
//
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
304
|
+
// 1日分作成する
|
|
305
|
+
const now = (createDate instanceof Date)
|
|
306
|
+
? moment(createDate)
|
|
307
|
+
: moment();
|
|
308
|
+
let startDate = moment.tz(`${now.tz(eventSchedule.scheduleTimezone)
|
|
309
|
+
.format('YYYYMMDD')} ${eventSchedule.startTime}`, 'YYYYMMDD HH:mm:ss', eventSchedule.scheduleTimezone);
|
|
310
|
+
const startDateShouldBeLte = moment.tz(`${now.tz(eventSchedule.scheduleTimezone)
|
|
311
|
+
.format('YYYYMMDD')} ${eventSchedule.endTime}`, 'YYYYMMDD HH:mm:ss', eventSchedule.scheduleTimezone);
|
|
312
|
+
const frequencyInMinutes = moment.duration(eventSchedule.repeatFrequency)
|
|
313
|
+
.asMinutes();
|
|
314
|
+
// tslint:disable-next-line:no-magic-numbers
|
|
315
|
+
const repeatCountInHour = Math.floor(60 / frequencyInMinutes);
|
|
316
|
+
let i = 0;
|
|
317
|
+
while (startDate < startDateShouldBeLte) {
|
|
318
|
+
i += 1;
|
|
319
|
+
if (i > 1) {
|
|
320
|
+
startDate = moment(startDate)
|
|
321
|
+
.add(moment.duration(eventSchedule.repeatFrequency));
|
|
322
|
+
}
|
|
323
|
+
const hour = `0${moment(startDate)
|
|
324
|
+
.format('HH')}`
|
|
233
325
|
// 2桁でない時は'0'詰め
|
|
234
326
|
// tslint:disable-next-line:no-magic-numbers
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
tour_number: tourNumber,
|
|
262
|
-
duration: moment.duration(duration, 'minutes')
|
|
263
|
-
.toISOString()
|
|
264
|
-
});
|
|
265
|
-
}
|
|
266
|
-
});
|
|
327
|
+
.slice(-2);
|
|
328
|
+
let tourIndex = i % repeatCountInHour;
|
|
329
|
+
if (tourIndex === 0) {
|
|
330
|
+
tourIndex = repeatCountInHour;
|
|
331
|
+
}
|
|
332
|
+
const tourNumber = `${hour}${tourIndex}`;
|
|
333
|
+
const endDate = moment(startDate)
|
|
334
|
+
.add(moment.duration(eventSchedule.duration));
|
|
335
|
+
const day = moment(startDate)
|
|
336
|
+
.tz(eventSchedule.scheduleTimezone)
|
|
337
|
+
.format('YYYYMMDD');
|
|
338
|
+
const startTime = moment(startDate)
|
|
339
|
+
.tz(eventSchedule.scheduleTimezone)
|
|
340
|
+
.format('HHmm');
|
|
341
|
+
const endTime = moment(endDate)
|
|
342
|
+
.tz(eventSchedule.scheduleTimezone)
|
|
343
|
+
.format('HHmm');
|
|
344
|
+
performanceInfos.push({
|
|
345
|
+
day: day,
|
|
346
|
+
start_time: startTime,
|
|
347
|
+
end_time: endTime,
|
|
348
|
+
door_time: startDate.toDate(),
|
|
349
|
+
start_date: startDate.toDate(),
|
|
350
|
+
end_date: endDate.toDate(),
|
|
351
|
+
tour_number: tourNumber,
|
|
352
|
+
duration: eventSchedule.duration
|
|
267
353
|
});
|
|
268
354
|
}
|
|
269
355
|
return performanceInfos;
|
|
270
356
|
}
|
|
271
357
|
function createEventBySchedule(params) {
|
|
272
|
-
return (repos
|
|
273
|
-
|
|
358
|
+
return (repos
|
|
359
|
+
// settings: Settings
|
|
360
|
+
) => __awaiter(this, void 0, void 0, function* () {
|
|
361
|
+
const schedule = yield repos.schedule.findOne({
|
|
362
|
+
id: { $eq: params.object.eventSchedule.id },
|
|
363
|
+
project: { id: { $eq: params.project.id } }
|
|
364
|
+
});
|
|
274
365
|
if (schedule === null) {
|
|
275
366
|
throw new factory.errors.NotFound('Schedule');
|
|
276
367
|
}
|
|
277
|
-
yield createEvents(schedule)(repos
|
|
368
|
+
yield createEvents(schedule, (params.object.startDate instanceof Date) ? params.object.startDate : new Date())(repos);
|
|
278
369
|
});
|
|
279
370
|
}
|
|
280
371
|
exports.createEventBySchedule = createEventBySchedule;
|
|
@@ -19,13 +19,14 @@ const screeningRoom_1 = require("../../repo/place/screeningRoom");
|
|
|
19
19
|
const product_1 = require("../../repo/product");
|
|
20
20
|
const project_1 = require("../../repo/project");
|
|
21
21
|
const schedule_1 = require("../../repo/schedule");
|
|
22
|
+
const setting_1 = require("../../repo/setting");
|
|
22
23
|
const task_1 = require("../../repo/task");
|
|
23
24
|
const createEvent_1 = require("./createEvent/createEvent");
|
|
24
25
|
/**
|
|
25
26
|
* タスク実行関数
|
|
26
27
|
*/
|
|
27
28
|
function call(data) {
|
|
28
|
-
return ({ connection
|
|
29
|
+
return ({ connection }) => __awaiter(this, void 0, void 0, function* () {
|
|
29
30
|
yield (0, createEvent_1.createEvent)(data)({
|
|
30
31
|
action: new action_1.ActionRepo(connection),
|
|
31
32
|
event: new event_1.EventRepo(connection),
|
|
@@ -36,8 +37,11 @@ function call(data) {
|
|
|
36
37
|
product: new product_1.ProductRepo(connection),
|
|
37
38
|
project: new project_1.ProjectRepo(connection),
|
|
38
39
|
schedule: new schedule_1.ScheduleRepo(connection),
|
|
40
|
+
setting: new setting_1.SettingRepo(connection),
|
|
39
41
|
task: new task_1.TaskRepo(connection)
|
|
40
|
-
}
|
|
42
|
+
}
|
|
43
|
+
// settings
|
|
44
|
+
);
|
|
41
45
|
});
|
|
42
46
|
}
|
|
43
47
|
exports.call = call;
|
|
@@ -12,6 +12,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
12
12
|
exports.call = void 0;
|
|
13
13
|
const GMO = require("@motionpicture/gmo-service");
|
|
14
14
|
const factory = require("../../factory");
|
|
15
|
+
// import { Settings } from '../../settings';
|
|
15
16
|
const person2username_1 = require("../payment/any/person2username");
|
|
16
17
|
const account_1 = require("../../repo/account");
|
|
17
18
|
const action_1 = require("../../repo/action");
|
|
@@ -20,6 +21,7 @@ const creditCard_1 = require("../../repo/paymentMethod/creditCard");
|
|
|
20
21
|
const paymentService_1 = require("../../repo/paymentService");
|
|
21
22
|
const person_1 = require("../../repo/person");
|
|
22
23
|
const project_1 = require("../../repo/project");
|
|
24
|
+
const setting_1 = require("../../repo/setting");
|
|
23
25
|
const task_1 = require("../../repo/task");
|
|
24
26
|
const DEFAULT_PAYMENT_METHOD_TYPE_FOR_CREDIT_CARD = 'CreditCard';
|
|
25
27
|
let cognitoIdentityServiceProvider;
|
|
@@ -37,12 +39,18 @@ function call(params) {
|
|
|
37
39
|
credentials: fromEnv()
|
|
38
40
|
});
|
|
39
41
|
}
|
|
42
|
+
const settingRepo = new setting_1.SettingRepo(connection);
|
|
43
|
+
const setting = yield settingRepo.findOne({ project: { id: { $eq: '*' } } }, ['userPoolIdOld']);
|
|
44
|
+
if (typeof (setting === null || setting === void 0 ? void 0 : setting.userPoolIdOld) !== 'string') {
|
|
45
|
+
throw new factory.errors.NotFound('setting.userPoolIdOld');
|
|
46
|
+
}
|
|
40
47
|
const newPersonRepo = new person_1.PersonRepo({
|
|
41
48
|
userPoolId: params.data.userPoolId,
|
|
42
49
|
cognitoIdentityServiceProvider
|
|
43
50
|
});
|
|
44
51
|
const oldPersonRepo = new person_1.PersonRepo({
|
|
45
|
-
userPoolId: settings.userPoolIdOld,
|
|
52
|
+
// userPoolId: settings.userPoolIdOld,
|
|
53
|
+
userPoolId: setting.userPoolIdOld,
|
|
46
54
|
cognitoIdentityServiceProvider
|
|
47
55
|
});
|
|
48
56
|
const paymentServiceRepo = new paymentService_1.PaymentServiceRepo(connection);
|
|
@@ -63,7 +71,7 @@ function call(params) {
|
|
|
63
71
|
: 20000 // cronで実行の場合は長めに(2024-10-05~)
|
|
64
72
|
})
|
|
65
73
|
});
|
|
66
|
-
yield deleteById(params.data)({
|
|
74
|
+
yield deleteById(params.data, setting)({
|
|
67
75
|
account: new account_1.AccountRepo(connection),
|
|
68
76
|
action: new action_1.ActionRepo(connection),
|
|
69
77
|
creditCard: creditCardRepo,
|
|
@@ -74,16 +82,20 @@ function call(params) {
|
|
|
74
82
|
project: new project_1.ProjectRepo(connection),
|
|
75
83
|
task: new task_1.TaskRepo(connection),
|
|
76
84
|
cognitoIdentityServiceProvider
|
|
77
|
-
}
|
|
85
|
+
}
|
|
86
|
+
// settings
|
|
87
|
+
);
|
|
78
88
|
});
|
|
79
89
|
}
|
|
80
90
|
exports.call = call;
|
|
81
91
|
/**
|
|
82
92
|
* 会員削除処理
|
|
83
93
|
*/
|
|
84
|
-
function deleteById(params) {
|
|
94
|
+
function deleteById(params, setting) {
|
|
85
95
|
// tslint:disable-next-line:max-func-body-length
|
|
86
|
-
return (repos
|
|
96
|
+
return (repos
|
|
97
|
+
// settings: Settings
|
|
98
|
+
) => __awaiter(this, void 0, void 0, function* () {
|
|
87
99
|
const deleteMemberAction = {
|
|
88
100
|
agent: params.agent,
|
|
89
101
|
object: Object.assign({ id: params.id, typeOf: factory.personType.Person, migrate: params.migrate, physically: params.physically }, (typeof params.migratePersonRecipientUrl === 'string')
|
|
@@ -124,11 +136,13 @@ function deleteById(params) {
|
|
|
124
136
|
yield deleteCreditCardsById({
|
|
125
137
|
id: params.id,
|
|
126
138
|
useUsernameAsGMOMemberId: params.useUsernameAsGMOMemberId
|
|
127
|
-
})({
|
|
139
|
+
}, setting)({
|
|
128
140
|
person: repos.newPerson,
|
|
129
141
|
creditCard: repos.creditCard,
|
|
130
142
|
cognitoIdentityServiceProvider: repos.cognitoIdentityServiceProvider
|
|
131
|
-
}
|
|
143
|
+
}
|
|
144
|
+
// settings
|
|
145
|
+
);
|
|
132
146
|
}
|
|
133
147
|
// 所有権削除
|
|
134
148
|
// tslint:disable-next-line:no-console
|
|
@@ -361,8 +375,10 @@ function sleep(waitTime) {
|
|
|
361
375
|
}
|
|
362
376
|
const DELETE_CREDIT_CARD_MAX_RETRY_COUNT = 2;
|
|
363
377
|
const DELETE_CREDIT_CARD_RETRY_INTERVAL_IN_MS = 1000;
|
|
364
|
-
function deleteCreditCardsById(params) {
|
|
365
|
-
return (repos
|
|
378
|
+
function deleteCreditCardsById(params, setting) {
|
|
379
|
+
return (repos
|
|
380
|
+
// settings: Settings
|
|
381
|
+
) => __awaiter(this, void 0, void 0, function* () {
|
|
366
382
|
let retry = true;
|
|
367
383
|
let numberOfTry = 0;
|
|
368
384
|
while (numberOfTry >= 0) {
|
|
@@ -380,7 +396,9 @@ function deleteCreditCardsById(params) {
|
|
|
380
396
|
const person = yield repos.person.findById({ userId: params.id });
|
|
381
397
|
let oldUsername;
|
|
382
398
|
try {
|
|
383
|
-
oldUsername = yield (0, person2username_1.person2username)(person, repos.cognitoIdentityServiceProvider,
|
|
399
|
+
oldUsername = yield (0, person2username_1.person2username)(person, repos.cognitoIdentityServiceProvider,
|
|
400
|
+
// settings
|
|
401
|
+
setting);
|
|
384
402
|
}
|
|
385
403
|
catch (error) {
|
|
386
404
|
let throwsPerson2usernameError = true;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as factory from '../../factory';
|
|
2
|
-
import type { IOperationExecute } from '../task';
|
|
2
|
+
import type { ICallResult, IOperationExecute } from '../task';
|
|
3
3
|
/**
|
|
4
4
|
* タスク実行関数
|
|
5
5
|
*/
|
|
6
|
-
export declare function call(
|
|
6
|
+
export declare function call(params: factory.task.importEventCapacitiesFromCOA.ITask): IOperationExecute<ICallResult>;
|
|
@@ -11,22 +11,31 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
exports.call = void 0;
|
|
13
13
|
const COA = require("@motionpicture/coa-service");
|
|
14
|
-
const factory = require("../../factory");
|
|
15
14
|
const event_1 = require("../../repo/event");
|
|
15
|
+
const interface_1 = require("../../repo/interface");
|
|
16
|
+
const factory = require("../../factory");
|
|
16
17
|
const EventAggregationService = require("../aggregation/event");
|
|
18
|
+
let coaAuthClient;
|
|
17
19
|
/**
|
|
18
20
|
* タスク実行関数
|
|
19
21
|
*/
|
|
20
|
-
function call(
|
|
21
|
-
return ({ connection, settings
|
|
22
|
+
function call(params) {
|
|
23
|
+
return ({ connection, settings }) => __awaiter(this, void 0, void 0, function* () {
|
|
24
|
+
var _a;
|
|
22
25
|
if (coaAuthClient === undefined) {
|
|
23
|
-
|
|
26
|
+
const interfaceRepo = new interface_1.InterfaceRepo(connection);
|
|
27
|
+
const coaAPI = yield interfaceRepo.findOne({ project: { id: { $eq: params.project.id } } });
|
|
28
|
+
const credentials = (_a = coaAPI === null || coaAPI === void 0 ? void 0 : coaAPI.availableChannel) === null || _a === void 0 ? void 0 : _a.credentials;
|
|
29
|
+
if (typeof (credentials === null || credentials === void 0 ? void 0 : credentials.refreshToken) !== 'string') {
|
|
30
|
+
throw new factory.errors.NotFound('WebAPI');
|
|
31
|
+
}
|
|
32
|
+
coaAuthClient = new COA.auth.RefreshToken(credentials);
|
|
24
33
|
}
|
|
25
34
|
const reserveService = new COA.service.Reserve({
|
|
26
35
|
endpoint: coaAuthClient.options.endpoint,
|
|
27
36
|
auth: coaAuthClient
|
|
28
37
|
}, { timeout: settings.coa.timeout });
|
|
29
|
-
yield EventAggregationService.importFromCOA(data)({
|
|
38
|
+
yield EventAggregationService.importFromCOA(params.data)({
|
|
30
39
|
event: new event_1.EventRepo(connection),
|
|
31
40
|
reserveService
|
|
32
41
|
});
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as factory from '../../factory';
|
|
2
|
-
import type { IOperationExecute } from '../task';
|
|
2
|
+
import type { ICallResult, IOperationExecute } from '../task';
|
|
3
3
|
/**
|
|
4
4
|
* タスク実行関数
|
|
5
5
|
*/
|
|
6
|
-
export declare function call(
|
|
6
|
+
export declare function call(params: factory.task.importEventsFromCOA.ITask): IOperationExecute<ICallResult>;
|
|
@@ -11,29 +11,38 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
exports.call = void 0;
|
|
13
13
|
const COA = require("@motionpicture/coa-service");
|
|
14
|
-
const factory = require("../../factory");
|
|
15
14
|
const action_1 = require("../../repo/action");
|
|
16
15
|
const categoryCode_1 = require("../../repo/categoryCode");
|
|
17
16
|
const creativeWork_1 = require("../../repo/creativeWork");
|
|
18
17
|
const event_1 = require("../../repo/event");
|
|
19
18
|
const eventSeries_1 = require("../../repo/eventSeries");
|
|
19
|
+
const interface_1 = require("../../repo/interface");
|
|
20
20
|
const movieTheater_1 = require("../../repo/place/movieTheater");
|
|
21
21
|
const screeningRoom_1 = require("../../repo/place/screeningRoom");
|
|
22
22
|
const seller_1 = require("../../repo/seller");
|
|
23
|
+
const factory = require("../../factory");
|
|
23
24
|
const EventService = require("../event");
|
|
25
|
+
let coaAuthClient;
|
|
24
26
|
/**
|
|
25
27
|
* タスク実行関数
|
|
26
28
|
*/
|
|
27
|
-
function call(
|
|
28
|
-
return ({ connection, settings
|
|
29
|
+
function call(params) {
|
|
30
|
+
return ({ connection, settings }) => __awaiter(this, void 0, void 0, function* () {
|
|
31
|
+
var _a;
|
|
29
32
|
if (coaAuthClient === undefined) {
|
|
30
|
-
|
|
33
|
+
const interfaceRepo = new interface_1.InterfaceRepo(connection);
|
|
34
|
+
const coaAPI = yield interfaceRepo.findOne({ project: { id: { $eq: params.project.id } } });
|
|
35
|
+
const credentials = (_a = coaAPI === null || coaAPI === void 0 ? void 0 : coaAPI.availableChannel) === null || _a === void 0 ? void 0 : _a.credentials;
|
|
36
|
+
if (typeof (credentials === null || credentials === void 0 ? void 0 : credentials.refreshToken) !== 'string') {
|
|
37
|
+
throw new factory.errors.NotFound('WebAPI');
|
|
38
|
+
}
|
|
39
|
+
coaAuthClient = new COA.auth.RefreshToken(credentials);
|
|
31
40
|
}
|
|
32
41
|
const masterService = new COA.service.Master({
|
|
33
42
|
endpoint: coaAuthClient.options.endpoint,
|
|
34
43
|
auth: coaAuthClient
|
|
35
44
|
}, { timeout: settings.coa.timeout });
|
|
36
|
-
yield EventService.importFromCOA(data)({
|
|
45
|
+
yield EventService.importFromCOA(params.data)({
|
|
37
46
|
action: new action_1.ActionRepo(connection),
|
|
38
47
|
categoryCode: new categoryCode_1.CategoryCodeRepo(connection),
|
|
39
48
|
creativeWork: new creativeWork_1.CreativeWorkRepo(connection),
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as factory from '../../factory';
|
|
2
|
-
import type { IOperationExecute } from '../task';
|
|
2
|
+
import type { ICallResult, IOperationExecute } from '../task';
|
|
3
3
|
/**
|
|
4
4
|
* タスク実行関数
|
|
5
5
|
*/
|
|
6
|
-
export declare function call(
|
|
6
|
+
export declare function call(params: factory.task.importOffersFromCOA.ITask): IOperationExecute<ICallResult>;
|