@chevre/domain 21.2.0-alpha.99 → 21.3.0-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/example/src/chevre/aggregateEventReservation.ts +1 -1
- package/example/src/chevre/aggregateSellerPaymentAccepted.ts +27 -0
- package/example/src/chevre/aggregation/aggregateSystem.ts +53 -22
- package/example/src/chevre/countDelayedTasks.ts +7 -2
- package/example/src/chevre/createManyEventsIfNotExist.ts +199 -46
- package/example/src/chevre/findScreeningRoomsByBranchCode.ts +2 -2
- package/example/src/chevre/giveUpStartDatePassedCertainPeriod.ts +56 -0
- package/example/src/chevre/lockStockHolder.ts +5 -2
- package/example/src/chevre/migrateCategoryCodeAdditionalProperties.ts +116 -0
- package/example/src/chevre/migrateScreeningEventSeriesVersion.ts +79 -0
- package/example/src/chevre/ownershipInfosCsv2peopleJson.ts +1 -1
- package/example/src/chevre/processRegisterMembership.ts +8 -4
- package/example/src/chevre/processRegisterPaymentCard.ts +8 -4
- package/example/src/chevre/processReserve.ts +1 -1
- package/example/src/chevre/searchAbortedTasks.ts +4 -6
- package/example/src/chevre/searchEventSeats.ts +5 -2
- package/example/src/chevre/searchHoldReservations.ts +38 -0
- package/example/src/chevre/searchPermissions.ts +54 -0
- package/example/src/chevre/searchScreeningRooms.ts +33 -0
- package/example/src/chevre/sendEmailMessage.ts +1 -2
- package/example/src/chevre/syncScreeningRooms.ts +21 -0
- package/example/src/chevre/syncScreeningRoomsAll.ts +41 -0
- package/example/src/chevre/unsetContainsInPlaceFromMovieTheater.ts +41 -0
- package/lib/chevre/factory/order.d.ts +4 -1
- package/lib/chevre/factory/order.js +19 -6
- package/lib/chevre/repo/account.js +3 -2
- package/lib/chevre/repo/accountTransaction.js +2 -1
- package/lib/chevre/repo/accountingReport.d.ts +1 -3
- package/lib/chevre/repo/action.d.ts +50 -1
- package/lib/chevre/repo/action.js +53 -2
- package/lib/chevre/repo/additionalProperty.js +2 -1
- package/lib/chevre/repo/aggregation.d.ts +3 -0
- package/lib/chevre/repo/aggregation.js +3 -0
- package/lib/chevre/repo/assetTransaction.js +6 -5
- package/lib/chevre/repo/categoryCode.d.ts +1 -1
- package/lib/chevre/repo/categoryCode.js +37 -25
- package/lib/chevre/repo/code.js +3 -2
- package/lib/chevre/repo/comment.js +2 -1
- package/lib/chevre/repo/creativeWork.d.ts +1 -1
- package/lib/chevre/repo/creativeWork.js +35 -12
- package/lib/chevre/repo/customer.js +2 -1
- package/lib/chevre/repo/emailMessage.js +2 -1
- package/lib/chevre/repo/event.d.ts +30 -2
- package/lib/chevre/repo/event.js +87 -36
- package/lib/chevre/repo/member.d.ts +14 -0
- package/lib/chevre/repo/member.js +31 -3
- package/lib/chevre/repo/merchantReturnPolicy.js +2 -1
- package/lib/chevre/repo/mongoose/schemas/assetTransaction.d.ts +3 -3
- package/lib/chevre/repo/mongoose/schemas/holdReservation.d.ts +75 -0
- package/lib/chevre/repo/mongoose/schemas/holdReservation.js +93 -0
- package/lib/chevre/repo/mongoose/schemas/offer.d.ts +3 -3
- package/lib/chevre/repo/mongoose/schemas/order.d.ts +21 -21
- package/lib/chevre/repo/mongoose/schemas/place.d.ts +6 -0
- package/lib/chevre/repo/mongoose/schemas/place.js +16 -1
- package/lib/chevre/repo/mongoose/schemas/product.js +6 -0
- package/lib/chevre/repo/mongoose/schemas/reservation.d.ts +9 -9
- package/lib/chevre/repo/mongoose/schemas/transaction.d.ts +3 -3
- package/lib/chevre/repo/offer.js +3 -2
- package/lib/chevre/repo/offerCatalog.js +0 -27
- package/lib/chevre/repo/offerItemCondition.js +2 -1
- package/lib/chevre/repo/order.js +8 -7
- package/lib/chevre/repo/ownershipInfo.js +2 -7
- package/lib/chevre/repo/paymentServiceProvider.d.ts +65 -0
- package/lib/chevre/repo/paymentServiceProvider.js +156 -0
- package/lib/chevre/repo/place.d.ts +143 -27
- package/lib/chevre/repo/place.js +445 -282
- package/lib/chevre/repo/priceSpecification.js +3 -2
- package/lib/chevre/repo/product.d.ts +5 -3
- package/lib/chevre/repo/product.js +92 -5
- package/lib/chevre/repo/project.js +2 -1
- package/lib/chevre/repo/reservation.d.ts +9 -1
- package/lib/chevre/repo/reservation.js +29 -20
- package/lib/chevre/repo/role.d.ts +7 -0
- package/lib/chevre/repo/role.js +39 -2
- package/lib/chevre/repo/seller.d.ts +22 -2
- package/lib/chevre/repo/seller.js +82 -6
- package/lib/chevre/repo/serviceOutput.js +2 -1
- package/lib/chevre/repo/stockHolder.d.ts +143 -7
- package/lib/chevre/repo/stockHolder.js +622 -104
- package/lib/chevre/repo/task.d.ts +12 -1
- package/lib/chevre/repo/task.js +17 -7
- package/lib/chevre/repo/transaction.js +6 -5
- package/lib/chevre/repo/trip.js +2 -1
- package/lib/chevre/repository.d.ts +6 -0
- package/lib/chevre/repository.js +8 -1
- package/lib/chevre/service/aggregation/event/aggregateScreeningEvent.js +16 -7
- package/lib/chevre/service/aggregation/event/aggregateUseActionsOnEvent.js +19 -8
- package/lib/chevre/service/aggregation/system.d.ts +43 -1
- package/lib/chevre/service/aggregation/system.js +112 -2
- package/lib/chevre/service/assetTransaction/moneyTransfer.js +1 -1
- package/lib/chevre/service/assetTransaction/pay/account/validation.js +1 -1
- package/lib/chevre/service/assetTransaction/pay.js +2 -2
- package/lib/chevre/service/assetTransaction/refund.js +1 -1
- package/lib/chevre/service/assetTransaction/reserve.js +9 -2
- package/lib/chevre/service/event.d.ts +3 -0
- package/lib/chevre/service/event.js +52 -22
- package/lib/chevre/service/iam.d.ts +6 -2
- package/lib/chevre/service/iam.js +23 -9
- package/lib/chevre/service/offer/event/factory.js +22 -13
- package/lib/chevre/service/offer/event/importFromCOA.js +2 -2
- package/lib/chevre/service/offer/eventServiceByCOA/factory.js +15 -8
- package/lib/chevre/service/offer/eventServiceByCOA.js +7 -9
- package/lib/chevre/service/offer/product/factory.js +13 -6
- package/lib/chevre/service/offer/product.js +2 -2
- package/lib/chevre/service/offer.d.ts +16 -8
- package/lib/chevre/service/offer.js +70 -7
- package/lib/chevre/service/order/createAccountingReportIfNotExist.js +31 -17
- package/lib/chevre/service/order/onOrderStatusChanged/factory.js +1 -1
- package/lib/chevre/service/order/onOrderStatusChanged.js +2 -2
- package/lib/chevre/service/order/placeOrder.js +4 -4
- package/lib/chevre/service/order/returnOrder.js +1 -1
- package/lib/chevre/service/order/sendOrder.js +3 -3
- package/lib/chevre/service/payment/any/onPaymentStatusChanged.js +4 -6
- package/lib/chevre/service/payment/any/onRefund.js +46 -42
- package/lib/chevre/service/payment/creditCard.js +2 -2
- package/lib/chevre/service/payment/movieTicket/checkByIdentifier.d.ts +1 -1
- package/lib/chevre/service/payment/movieTicket/factory.d.ts +1 -1
- package/lib/chevre/service/payment/movieTicket/getCredentials.d.ts +1 -1
- package/lib/chevre/service/payment/movieTicket/getCredentials.js +1 -1
- package/lib/chevre/service/payment/movieTicket/validation.js +16 -9
- package/lib/chevre/service/payment/movieTicket.js +2 -2
- package/lib/chevre/service/reserve/cancelReservation.js +15 -3
- package/lib/chevre/service/reserve/confirmReservation.js +19 -11
- package/lib/chevre/service/task/aggregateScreeningEvent.js +1 -1
- package/lib/chevre/service/task/cancelPendingReservation.js +1 -1
- package/lib/chevre/service/task/cancelReservation.js +1 -1
- package/lib/chevre/service/task/deleteTransaction.js +2 -0
- package/lib/chevre/service/task/onEventChanged.d.ts +7 -0
- package/lib/chevre/service/task/onEventChanged.js +29 -0
- package/lib/chevre/service/task/onResourceUpdated.d.ts +7 -0
- package/lib/chevre/service/task/onResourceUpdated.js +396 -0
- package/lib/chevre/service/task/syncScreeningRooms.d.ts +7 -0
- package/lib/chevre/service/task/syncScreeningRooms.js +23 -0
- package/lib/chevre/service/task/voidReserveTransaction.js +1 -1
- package/lib/chevre/service/transaction/deleteTransaction.d.ts +2 -0
- package/lib/chevre/service/transaction/deleteTransaction.js +129 -1
- package/lib/chevre/service/transaction/moneyTransfer/exportTasks/factory.js +1 -0
- package/lib/chevre/service/transaction/moneyTransfer/factory.d.ts +1 -1
- package/lib/chevre/service/transaction/moneyTransfer.js +1 -1
- package/lib/chevre/service/transaction/orderProgramMembership/findCreditCard.js +1 -1
- package/lib/chevre/service/transaction/orderProgramMembership/findPaymentCardPermit.js +1 -1
- package/lib/chevre/service/transaction/orderProgramMembership.js +1 -1
- package/lib/chevre/service/transaction/placeOrder/exportTasks/factory.js +1 -0
- package/lib/chevre/service/transaction/placeOrderInProgress/potentialActions/givePointAward.js +1 -1
- package/lib/chevre/service/transaction/placeOrderInProgress/potentialActions/moneyTransfer.js +1 -1
- package/lib/chevre/service/transaction/placeOrderInProgress/potentialActions/registerService.js +1 -1
- package/lib/chevre/service/transaction/placeOrderInProgress/potentialActions/sendEmailMessage.js +4 -4
- package/lib/chevre/service/transaction/placeOrderInProgress/potentialActions.js +3 -4
- package/lib/chevre/service/transaction/placeOrderInProgress/result/acceptedOffers.js +8 -12
- package/lib/chevre/service/transaction/placeOrderInProgress.js +6 -4
- package/lib/chevre/service/transaction/returnOrder/exportTasks/factory.js +1 -0
- package/lib/chevre/service/transaction/returnOrder/potentialActions/returnMoneyTransfer.js +2 -2
- package/lib/chevre/service/transaction/returnOrder/potentialActions/returnPaymentMethod.js +5 -5
- package/lib/chevre/service/transaction/returnOrder/potentialActions/returnPointAward.js +2 -2
- package/lib/chevre/service/transaction/returnOrder/potentialActions/sendEmailMessage.js +3 -3
- package/lib/chevre/service/transaction/returnOrder/potentialActions.js +1 -1
- package/lib/chevre/service/transaction/returnOrder.js +3 -1
- package/lib/chevre/settings.d.ts +9 -0
- package/lib/chevre/settings.js +42 -2
- package/package.json +3 -3
- package/example/src/chevre/eventCatalog2eventService.ts +0 -123
- package/example/src/chevre/migrateOrderAdditionalProperties.ts +0 -85
- package/example/src/chevre/migrateStockHolderKeys.ts +0 -89
|
@@ -22,7 +22,6 @@ const moment = require("moment-timezone");
|
|
|
22
22
|
const credentials_1 = require("../credentials");
|
|
23
23
|
const factory = require("../factory");
|
|
24
24
|
const offer_1 = require("./offer");
|
|
25
|
-
// const customsearch = google.customsearch('v1');
|
|
26
25
|
const debug = createDebug('chevre-domain:service:event');
|
|
27
26
|
const coaAuthClient = new COA.auth.RefreshToken({
|
|
28
27
|
endpoint: credentials_1.credentials.coa.endpoint,
|
|
@@ -94,23 +93,34 @@ function importFromCOA(params) {
|
|
|
94
93
|
limit: 1,
|
|
95
94
|
page: 1,
|
|
96
95
|
branchCode: { $eq: params.locationBranchCode }
|
|
97
|
-
});
|
|
96
|
+
}, ['_id'], []);
|
|
98
97
|
const seller = sellersWithSameBranchCode.shift();
|
|
99
98
|
if (typeof (seller === null || seller === void 0 ? void 0 : seller.id) !== 'string') {
|
|
100
99
|
throw new factory.errors.NotFound('Seller', `Seller with branchCod '${params.locationBranchCode}' not found`);
|
|
101
100
|
}
|
|
102
|
-
// 施設取得
|
|
103
|
-
let movieTheater = createMovieTheaterFromCOA(project, { id: seller.id }, yield masterService.theater({ theaterCode: params.locationBranchCode }), yield masterService.screen({ theaterCode: params.locationBranchCode }));
|
|
104
101
|
// saveMovieTheater:trueの場合のみ、施設保管(2022-10-10~)
|
|
105
102
|
if (params.saveMovieTheater === true) {
|
|
106
|
-
|
|
103
|
+
const savingMovieTheater = createMovieTheaterFromCOA(project, { id: seller.id }, yield masterService.theater({ theaterCode: params.locationBranchCode }), yield masterService.screen({ theaterCode: params.locationBranchCode }));
|
|
104
|
+
yield repos.place.saveMovieTheaterByBranchCode4coa(savingMovieTheater);
|
|
105
|
+
// } else {
|
|
106
|
+
// movieTheater = await repos.place.findMovieTheaterByBranchCode({
|
|
107
|
+
// project: { id: project.id },
|
|
108
|
+
// branchCode: creatingMovieTheater.branchCode
|
|
109
|
+
// });
|
|
107
110
|
}
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
}
|
|
111
|
+
const movieTheaters = yield repos.place.searchMovieTheaters({
|
|
112
|
+
limit: 1,
|
|
113
|
+
page: 1,
|
|
114
|
+
project: { id: { $eq: project.id } },
|
|
115
|
+
branchCode: { $eq: params.locationBranchCode }
|
|
116
|
+
}, ['_id', 'typeOf', 'branchCode', 'name', 'kanaName'], []);
|
|
117
|
+
const movieTheater = movieTheaters.shift();
|
|
118
|
+
if (movieTheater === undefined) {
|
|
119
|
+
throw new factory.errors.NotFound(factory.placeType.MovieTheater);
|
|
113
120
|
}
|
|
121
|
+
const screeningRooms = yield repos.place.searchScreeningRooms({
|
|
122
|
+
containedInPlace: { branchCode: { $eq: movieTheater.branchCode } }
|
|
123
|
+
});
|
|
114
124
|
const targetImportFrom = moment(`${moment(params.importFrom)
|
|
115
125
|
.tz('Asia/Tokyo')
|
|
116
126
|
.format('YYYY-MM-DD')}T00:00:00+09:00`);
|
|
@@ -121,7 +131,7 @@ function importFromCOA(params) {
|
|
|
121
131
|
debug('importing screening events...', targetImportFrom, targetImportThrough);
|
|
122
132
|
const { screeningEventSerieses, savedEventsCount } = yield saveScreeningEventSeries({
|
|
123
133
|
locationBranchCode: params.locationBranchCode,
|
|
124
|
-
movieTheater
|
|
134
|
+
movieTheater,
|
|
125
135
|
project: project,
|
|
126
136
|
saveScreeningEventSeries: params.saveScreeningEventSeries
|
|
127
137
|
})(repos);
|
|
@@ -130,7 +140,8 @@ function importFromCOA(params) {
|
|
|
130
140
|
// イベント永続化
|
|
131
141
|
const screeningEvents = yield saveScreeningEvents({
|
|
132
142
|
locationBranchCode: params.locationBranchCode,
|
|
133
|
-
movieTheater: movieTheater,
|
|
143
|
+
// movieTheater: movieTheater,
|
|
144
|
+
screeningRooms,
|
|
134
145
|
screeningEventSerieses: screeningEventSerieses,
|
|
135
146
|
project: project,
|
|
136
147
|
targetImportFrom: targetImportFrom.toDate(),
|
|
@@ -183,7 +194,6 @@ function importFromCOA(params) {
|
|
|
183
194
|
exports.importFromCOA = importFromCOA;
|
|
184
195
|
function saveScreeningEventSeries(params) {
|
|
185
196
|
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
186
|
-
const movieTheater = params.movieTheater;
|
|
187
197
|
const project = params.project;
|
|
188
198
|
const masterService = new COA.service.Master({
|
|
189
199
|
endpoint: credentials_1.credentials.coa.endpoint,
|
|
@@ -214,12 +224,12 @@ function saveScreeningEventSeries(params) {
|
|
|
214
224
|
const availablePaymentMethodTypes = yield repos.categoryCode.search({
|
|
215
225
|
project: { id: { $eq: params.project.id } },
|
|
216
226
|
inCodeSet: { identifier: { $eq: factory.categoryCode.CategorySetIdentifier.PaymentMethodType } }
|
|
217
|
-
});
|
|
227
|
+
}, [], []);
|
|
218
228
|
const screeningEventSerieses = filmsFromCOA.map((filmFromCOA) => {
|
|
219
229
|
return createScreeningEventSeriesFromCOA({
|
|
220
230
|
project: project,
|
|
221
231
|
filmFromCOA: filmFromCOA,
|
|
222
|
-
movieTheater: movieTheater,
|
|
232
|
+
movieTheater: params.movieTheater,
|
|
223
233
|
eirinKubuns: eirinKubuns,
|
|
224
234
|
eizouKubuns: eizouKubuns,
|
|
225
235
|
joueihousikiKubuns: joueihousikiKubuns,
|
|
@@ -293,7 +303,7 @@ function saveScreeningEvents(params) {
|
|
|
293
303
|
}
|
|
294
304
|
function createScreeningEvents(params) {
|
|
295
305
|
return () => __awaiter(this, void 0, void 0, function* () {
|
|
296
|
-
const movieTheater = params.movieTheater;
|
|
306
|
+
// const movieTheater = params.movieTheater;
|
|
297
307
|
const screeningEventSerieses = params.screeningEventSerieses;
|
|
298
308
|
const project = params.project;
|
|
299
309
|
const masterService = new COA.service.Master({
|
|
@@ -329,8 +339,11 @@ function createScreeningEvents(params) {
|
|
|
329
339
|
titleCode: scheduleFromCOA.titleCode,
|
|
330
340
|
titleBranchNum: scheduleFromCOA.titleBranchNum
|
|
331
341
|
});
|
|
332
|
-
//
|
|
333
|
-
const screenRoom =
|
|
342
|
+
// ルーム存在チェック
|
|
343
|
+
const screenRoom = params.screeningRooms.find((place) => place.branchCode === scheduleFromCOA.screenCode);
|
|
344
|
+
// const screenRoom = <factory.place.screeningRoom.IPlace | undefined>movieTheater.containsPlace.find(
|
|
345
|
+
// (place) => place.branchCode === scheduleFromCOA.screenCode
|
|
346
|
+
// );
|
|
334
347
|
if (screenRoom === undefined) {
|
|
335
348
|
// tslint:disable-next-line:no-console
|
|
336
349
|
console.error('screenRoom not found.', scheduleFromCOA.screenCode);
|
|
@@ -448,7 +461,15 @@ function createScreeningEventFromCOA(params) {
|
|
|
448
461
|
typeOf: 'WebAPI',
|
|
449
462
|
identifier: factory.service.webAPI.Identifier.COA
|
|
450
463
|
},
|
|
451
|
-
priceCurrency: factory.priceCurrency.JPY
|
|
464
|
+
priceCurrency: factory.priceCurrency.JPY,
|
|
465
|
+
itemOffered: {
|
|
466
|
+
serviceOutput: {
|
|
467
|
+
reservedTicket: {
|
|
468
|
+
typeOf: 'Ticket',
|
|
469
|
+
ticketedSeat: { typeOf: factory.placeType.Seat }
|
|
470
|
+
}
|
|
471
|
+
}
|
|
472
|
+
}
|
|
452
473
|
};
|
|
453
474
|
const { additionalProperty, coaInfo } = createScreeningEventAdditionalPropertyFromCOA(params);
|
|
454
475
|
return {
|
|
@@ -586,7 +607,10 @@ function createScreeningEventSeriesFromCOA(params) {
|
|
|
586
607
|
endDate: endDate,
|
|
587
608
|
startDate: startDate,
|
|
588
609
|
coaInfo,
|
|
589
|
-
offers: Object.assign({
|
|
610
|
+
offers: Object.assign({
|
|
611
|
+
// 不要なので廃止(2023-06-09~)
|
|
612
|
+
// project: { typeOf: params.project.typeOf, id: params.project.id },
|
|
613
|
+
typeOf: factory.offerType.Offer, priceCurrency: factory.priceCurrency.JPY }, (Array.isArray(unacceptedPaymentMethod)) ? { unacceptedPaymentMethod: unacceptedPaymentMethod } : undefined),
|
|
590
614
|
additionalProperty
|
|
591
615
|
};
|
|
592
616
|
}
|
|
@@ -767,8 +791,14 @@ function updateEvent4ttts(params) {
|
|
|
767
791
|
throw error;
|
|
768
792
|
}
|
|
769
793
|
// アクション完了
|
|
770
|
-
yield repos.action.complete({ typeOf: action.typeOf, id: action.id, result: {} });
|
|
771
|
-
yield (0, offer_1.onEventChanged)({
|
|
794
|
+
yield repos.action.complete({ typeOf: action.typeOf, id: action.id, result: { id: event.id } });
|
|
795
|
+
yield (0, offer_1.onEventChanged)({
|
|
796
|
+
id: [event.id],
|
|
797
|
+
project: { id: event.project.id },
|
|
798
|
+
typeOf: event.typeOf,
|
|
799
|
+
isNew: false,
|
|
800
|
+
useInform: true
|
|
801
|
+
})({
|
|
772
802
|
event: repos.event,
|
|
773
803
|
project: repos.project,
|
|
774
804
|
task: repos.task
|
|
@@ -18,6 +18,10 @@ export declare function searchPermissions(params: {
|
|
|
18
18
|
member: MemberRepo;
|
|
19
19
|
role: RoleRepo;
|
|
20
20
|
}) => Promise<{
|
|
21
|
-
|
|
22
|
-
|
|
21
|
+
hasRole: {
|
|
22
|
+
roleName: string;
|
|
23
|
+
}[];
|
|
24
|
+
permissions: {
|
|
25
|
+
_id: string;
|
|
26
|
+
}[];
|
|
23
27
|
}>;
|
|
@@ -16,18 +16,32 @@ exports.searchPermissions = void 0;
|
|
|
16
16
|
function searchPermissions(params) {
|
|
17
17
|
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
18
18
|
let permissions = [];
|
|
19
|
-
|
|
20
|
-
const projectMembers = yield repos.member.search({
|
|
19
|
+
const hasRole = yield repos.member.aggregateRoleNames({
|
|
21
20
|
project: { id: { $eq: params.project.id } },
|
|
22
21
|
member: { id: { $eq: params.member.id } }
|
|
23
22
|
});
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
23
|
+
if (hasRole.length > 0) {
|
|
24
|
+
permissions = yield repos.role.aggregatePermissions({ roleName: { $in: hasRole.map((r) => r.roleName) } });
|
|
25
|
+
}
|
|
26
|
+
return { hasRole, permissions };
|
|
27
|
+
// let permissions: IPermission[] = [];
|
|
28
|
+
// const projectMembers = await repos.member.search({
|
|
29
|
+
// project: { id: { $eq: params.project.id } },
|
|
30
|
+
// member: { id: { $eq: params.member.id } }
|
|
31
|
+
// });
|
|
32
|
+
// // 持っているロールを検索
|
|
33
|
+
// const roleNames = projectMembers.reduce<string[]>(
|
|
34
|
+
// (a, b) => [...a, ...(Array.isArray(b.member.hasRole)) ? b.member.hasRole.map((r) => r.roleName) : []],
|
|
35
|
+
// []
|
|
36
|
+
// );
|
|
37
|
+
// const roles = await repos.role.search({ roleName: { $in: roleNames } });
|
|
38
|
+
// // 権限をまとめる
|
|
39
|
+
// permissions = roles.reduce<string[]>(
|
|
40
|
+
// (a, b) => [...a, ...b.permissions],
|
|
41
|
+
// []
|
|
42
|
+
// );
|
|
43
|
+
// permissions = [...new Set(permissions)];
|
|
44
|
+
// return { roleNames, permissions };
|
|
31
45
|
});
|
|
32
46
|
}
|
|
33
47
|
exports.searchPermissions = searchPermissions;
|
|
@@ -156,7 +156,6 @@ function responseBody2acceptedOffers4result(params) {
|
|
|
156
156
|
// 予約取引からacceptedOffers4resultを生成する
|
|
157
157
|
if (Array.isArray(params.objectSubReservations)) {
|
|
158
158
|
acceptedOffers4result = params.objectSubReservations.map((itemOffered) => {
|
|
159
|
-
var _a;
|
|
160
159
|
const reservation = createReservation({
|
|
161
160
|
project: params.project,
|
|
162
161
|
itemOffered,
|
|
@@ -184,7 +183,8 @@ function responseBody2acceptedOffers4result(params) {
|
|
|
184
183
|
}
|
|
185
184
|
: undefined);
|
|
186
185
|
});
|
|
187
|
-
|
|
186
|
+
// tslint:disable-next-line:no-unnecessary-local-variable
|
|
187
|
+
const resultAcceptedOffer = {
|
|
188
188
|
typeOf: factory.offerType.Offer,
|
|
189
189
|
id: itemOffered.reservedTicket.ticketType.id,
|
|
190
190
|
name: itemOffered.reservedTicket.ticketType.name,
|
|
@@ -195,17 +195,20 @@ function responseBody2acceptedOffers4result(params) {
|
|
|
195
195
|
priceCurrency: priceSpecification.priceCurrency,
|
|
196
196
|
typeOf: priceSpecification.typeOf,
|
|
197
197
|
valueAddedTaxIncluded: priceSpecification.valueAddedTaxIncluded
|
|
198
|
-
},
|
|
199
|
-
priceCurrency: (typeof itemOffered.priceCurrency === 'string')
|
|
200
|
-
? itemOffered.priceCurrency
|
|
201
|
-
: factory.priceCurrency.JPY,
|
|
202
|
-
seller: {
|
|
203
|
-
typeOf: params.seller.typeOf,
|
|
204
|
-
name: (typeof params.seller.name === 'string')
|
|
205
|
-
? params.seller.name
|
|
206
|
-
: String((_a = params.seller.name) === null || _a === void 0 ? void 0 : _a.ja)
|
|
207
198
|
}
|
|
199
|
+
// 不要なので廃止(2023-07-01~)
|
|
200
|
+
// priceCurrency: (typeof itemOffered.priceCurrency === 'string')
|
|
201
|
+
// ? itemOffered.priceCurrency
|
|
202
|
+
// : factory.priceCurrency.JPY,
|
|
203
|
+
// 不要なので廃止(2023-07-01~)
|
|
204
|
+
// seller: {
|
|
205
|
+
// typeOf: params.seller.typeOf,
|
|
206
|
+
// name: (typeof params.seller.name === 'string')
|
|
207
|
+
// ? params.seller.name
|
|
208
|
+
// : String(params.seller.name?.ja)
|
|
209
|
+
// }
|
|
208
210
|
};
|
|
211
|
+
return resultAcceptedOffer;
|
|
209
212
|
});
|
|
210
213
|
}
|
|
211
214
|
return acceptedOffers4result;
|
|
@@ -252,7 +255,10 @@ function createReservation(params) {
|
|
|
252
255
|
if (params.issuedThrough.typeOf !== factory.product.ProductType.EventService) {
|
|
253
256
|
throw new factory.errors.Argument('issuedThrough', `issuedThrough.typeOf must be ${factory.product.ProductType.EventService}`);
|
|
254
257
|
}
|
|
255
|
-
reservationItem = Object.assign({
|
|
258
|
+
reservationItem = Object.assign({
|
|
259
|
+
// 不要なので廃止(2023-07-01~)
|
|
260
|
+
// project: itemOffered.project,
|
|
261
|
+
typeOf: itemOffered.typeOf, additionalProperty: itemOffered.additionalProperty, additionalTicketText: itemOffered.additionalTicketText, id: itemOffered.id, issuedThrough: params.issuedThrough, reservationNumber: itemOffered.reservationNumber, reservationFor,
|
|
256
262
|
reservedTicket }, (typeof ((_a = itemOffered.programMembershipUsed) === null || _a === void 0 ? void 0 : _a.typeOf) === 'string')
|
|
257
263
|
? { programMembershipUsed: itemOffered.programMembershipUsed }
|
|
258
264
|
: undefined);
|
|
@@ -280,7 +286,10 @@ function createReservation(params) {
|
|
|
280
286
|
if (params.issuedThrough.typeOf !== factory.product.ProductType.Transportation) {
|
|
281
287
|
throw new factory.errors.Argument('issuedThrough', `issuedThrough.typeOf must be ${factory.product.ProductType.Transportation}`);
|
|
282
288
|
}
|
|
283
|
-
reservationItem = Object.assign({
|
|
289
|
+
reservationItem = Object.assign({
|
|
290
|
+
// 不要なので廃止(2023-07-01~)
|
|
291
|
+
// project: itemOffered.project,
|
|
292
|
+
typeOf: itemOffered.typeOf, additionalProperty: itemOffered.additionalProperty, additionalTicketText: itemOffered.additionalTicketText, id: itemOffered.id, issuedThrough: params.issuedThrough, reservationNumber: itemOffered.reservationNumber, reservationFor,
|
|
284
293
|
reservedTicket }, (typeof ((_d = itemOffered.programMembershipUsed) === null || _d === void 0 ? void 0 : _d.typeOf) === 'string')
|
|
285
294
|
? { programMembershipUsed: itemOffered.programMembershipUsed }
|
|
286
295
|
: undefined);
|
|
@@ -20,7 +20,7 @@ function importFromCOA(params) {
|
|
|
20
20
|
page: 1,
|
|
21
21
|
project: { id: { $eq: params.project.id } },
|
|
22
22
|
inCodeSet: { identifier: { $eq: factory.categoryCode.CategorySetIdentifier.CurrencyType } }
|
|
23
|
-
});
|
|
23
|
+
}, [], []);
|
|
24
24
|
const defaultCurrencyType = currencyTypes.shift();
|
|
25
25
|
// メンバーシップ区分検索
|
|
26
26
|
const membershipTypes = yield repos.categoryCode.search({
|
|
@@ -28,7 +28,7 @@ function importFromCOA(params) {
|
|
|
28
28
|
page: 1,
|
|
29
29
|
project: { id: { $eq: params.project.id } },
|
|
30
30
|
inCodeSet: { identifier: { $eq: factory.categoryCode.CategorySetIdentifier.MembershipType } }
|
|
31
|
-
});
|
|
31
|
+
}, [], []);
|
|
32
32
|
const defaultMembershipType = membershipTypes.shift();
|
|
33
33
|
try {
|
|
34
34
|
const ticketResults = yield repos.masterService.ticket({ theaterCode: params.theaterCode });
|
|
@@ -171,7 +171,10 @@ function responseBody2acceptedOffers4result(params) {
|
|
|
171
171
|
}
|
|
172
172
|
}
|
|
173
173
|
};
|
|
174
|
-
const reservation = Object.assign(Object.assign(Object.assign({
|
|
174
|
+
const reservation = Object.assign(Object.assign(Object.assign({
|
|
175
|
+
// 不要なので廃止(2023-07-01~)
|
|
176
|
+
// project: { typeOf: event.project.typeOf, id: event.project.id },
|
|
177
|
+
typeOf: factory.reservationType.EventReservation, id: reservationId, issuedThrough, bookingTime: params.bookingTime }, (Array.isArray(additionalProperty)) ? { additionalProperty } : undefined), (typeof additionalTicketText === 'string') ? { additionalTicketText } : undefined), {
|
|
175
178
|
// numSeats: 1, // 廃止(2022-08-18~)
|
|
176
179
|
reservationFor: reservationFor, reservationNumber: reservationNumber, reservedTicket: reservedTicket });
|
|
177
180
|
if (requestedOffer.priceSpecification === undefined) {
|
|
@@ -183,19 +186,23 @@ function responseBody2acceptedOffers4result(params) {
|
|
|
183
186
|
valueAddedTaxIncluded: requestedOffer.priceSpecification.valueAddedTaxIncluded,
|
|
184
187
|
priceComponent: requestedOffer.priceSpecification.priceComponent
|
|
185
188
|
};
|
|
186
|
-
|
|
189
|
+
// tslint:disable-next-line:no-unnecessary-local-variable
|
|
190
|
+
const resultAcceptedOffer = {
|
|
187
191
|
typeOf: factory.offerType.Offer,
|
|
188
192
|
id: requestedOffer.id,
|
|
189
193
|
name: requestedOffer.name,
|
|
190
194
|
itemOffered: reservation,
|
|
191
195
|
offeredThrough: { typeOf: 'WebAPI', identifier: factory.service.webAPI.Identifier.COA },
|
|
192
|
-
priceSpecification
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
196
|
+
priceSpecification
|
|
197
|
+
// 不要なので廃止(2023-07-01~)
|
|
198
|
+
// priceCurrency: factory.priceCurrency.JPY,
|
|
199
|
+
// 不要なので廃止(2023-07-01~)
|
|
200
|
+
// seller: {
|
|
201
|
+
// typeOf: params.seller.typeOf,
|
|
202
|
+
// name: params.seller.name
|
|
203
|
+
// }
|
|
198
204
|
};
|
|
205
|
+
return resultAcceptedOffer;
|
|
199
206
|
}));
|
|
200
207
|
return acceptedOffers4result;
|
|
201
208
|
}
|
|
@@ -29,21 +29,19 @@ function authorize(params) {
|
|
|
29
29
|
throw new factory.errors.Forbidden('Transaction not yours');
|
|
30
30
|
}
|
|
31
31
|
// イベント取得属性最適化(2023-01-23~)
|
|
32
|
-
const screeningEvent = yield repos.event.findMinimizedIndividualEventById({
|
|
33
|
-
id: params.object.event.id
|
|
34
|
-
});
|
|
32
|
+
const screeningEvent = yield repos.event.findMinimizedIndividualEventById({ id: params.object.event.id });
|
|
35
33
|
const availablePaymentMethodTypes = yield repos.categoryCode.search({
|
|
36
34
|
project: { id: { $eq: transaction.project.id } },
|
|
37
35
|
inCodeSet: { identifier: { $eq: factory.categoryCode.CategorySetIdentifier.PaymentMethodType } }
|
|
38
|
-
});
|
|
36
|
+
}, [], []);
|
|
39
37
|
const seatingTypes = yield repos.categoryCode.search({
|
|
40
38
|
project: { id: { $eq: transaction.project.id } },
|
|
41
39
|
inCodeSet: { identifier: { $eq: factory.categoryCode.CategorySetIdentifier.SeatingType } }
|
|
42
|
-
});
|
|
40
|
+
}, [], []);
|
|
43
41
|
const videoFormatTypes = yield repos.categoryCode.search({
|
|
44
42
|
project: { id: { $eq: transaction.project.id } },
|
|
45
43
|
inCodeSet: { identifier: { $eq: factory.categoryCode.CategorySetIdentifier.VideoFormatType } }
|
|
46
|
-
});
|
|
44
|
+
}, [], []);
|
|
47
45
|
// COA仮予約後にリクエストが来る前提
|
|
48
46
|
const { acceptedOffers } = yield (0, validateAcceptedOffers_1.validateAcceptedOffers)({
|
|
49
47
|
object: params.object,
|
|
@@ -183,15 +181,15 @@ function changeOffers(params) {
|
|
|
183
181
|
const availablePaymentMethodTypes = yield repos.categoryCode.search({
|
|
184
182
|
project: { id: { $eq: transaction.project.id } },
|
|
185
183
|
inCodeSet: { identifier: { $eq: factory.categoryCode.CategorySetIdentifier.PaymentMethodType } }
|
|
186
|
-
});
|
|
184
|
+
}, [], []);
|
|
187
185
|
const seatingTypes = yield repos.categoryCode.search({
|
|
188
186
|
project: { id: { $eq: transaction.project.id } },
|
|
189
187
|
inCodeSet: { identifier: { $eq: factory.categoryCode.CategorySetIdentifier.SeatingType } }
|
|
190
|
-
});
|
|
188
|
+
}, [], []);
|
|
191
189
|
const videoFormatTypes = yield repos.categoryCode.search({
|
|
192
190
|
project: { id: { $eq: transaction.project.id } },
|
|
193
191
|
inCodeSet: { identifier: { $eq: factory.categoryCode.CategorySetIdentifier.VideoFormatType } }
|
|
194
|
-
});
|
|
192
|
+
}, [], []);
|
|
195
193
|
// COA仮予約後にリクエストが来る前提
|
|
196
194
|
const { acceptedOffers } = yield (0, validateAcceptedOffers_1.validateAcceptedOffers)({
|
|
197
195
|
object: params.object,
|
|
@@ -78,6 +78,7 @@ function acceptedOffers2amount(params) {
|
|
|
78
78
|
return a + priceSpecification.priceComponent.reduce((a2, b2) => a2 + Number(b2.price), 0);
|
|
79
79
|
}, 0);
|
|
80
80
|
}
|
|
81
|
+
// tslint:disable-next-line:max-func-body-length
|
|
81
82
|
function responseBody2resultAcceptedOffer(params) {
|
|
82
83
|
let acceptedOffers = [];
|
|
83
84
|
if (Array.isArray(params.responseBody.object)) {
|
|
@@ -90,7 +91,10 @@ function responseBody2resultAcceptedOffer(params) {
|
|
|
90
91
|
}
|
|
91
92
|
// itemOfferedを最小限に最適化
|
|
92
93
|
const permitByResponse = responseBodyObject.itemOffered.serviceOutput;
|
|
93
|
-
const itemOffered = Object.assign(Object.assign({
|
|
94
|
+
const itemOffered = Object.assign(Object.assign({
|
|
95
|
+
// 不要なので廃止(2023-07-01~)
|
|
96
|
+
// project: permitByResponse.project,
|
|
97
|
+
typeOf: permitByResponse.typeOf, identifier: permitByResponse.identifier, issuedThrough: permitByResponse.issuedThrough, name: permitByResponse.name }, (typeof permitByResponse.validFor === 'string') ? { validFor: permitByResponse.validFor } : undefined), (typeof ((_c = permitByResponse.amount) === null || _c === void 0 ? void 0 : _c.typeOf) === 'string') ? { amount: permitByResponse.amount } : undefined);
|
|
94
98
|
const offer = params.acceptedOffer.find((o) => o.id === responseBodyObject.id);
|
|
95
99
|
if (offer === undefined) {
|
|
96
100
|
throw new factory.errors.ServiceUnavailable(`Offer ${responseBodyObject.id} from registerService not found`);
|
|
@@ -132,16 +136,19 @@ function responseBody2resultAcceptedOffer(params) {
|
|
|
132
136
|
}
|
|
133
137
|
})
|
|
134
138
|
};
|
|
135
|
-
|
|
136
|
-
|
|
139
|
+
// tslint:disable-next-line:no-unnecessary-local-variable
|
|
140
|
+
const permitAcceptedOffer = {
|
|
137
141
|
typeOf: responseBodyObject.typeOf,
|
|
138
142
|
id: offer.id,
|
|
139
143
|
name: offer.name,
|
|
140
144
|
itemOffered,
|
|
141
|
-
priceSpecification
|
|
142
|
-
|
|
143
|
-
|
|
145
|
+
priceSpecification
|
|
146
|
+
// 不要なので廃止(2023-07-01~)
|
|
147
|
+
// priceCurrency: offer.priceCurrency,
|
|
148
|
+
// 不要なので廃止(2023-07-01~)
|
|
149
|
+
// seller: { name: offer.seller.name, typeOf: offer.seller.typeOf }
|
|
144
150
|
};
|
|
151
|
+
return permitAcceptedOffer;
|
|
145
152
|
});
|
|
146
153
|
}
|
|
147
154
|
return acceptedOffers;
|
|
@@ -32,7 +32,7 @@ function search(params) {
|
|
|
32
32
|
page: 1,
|
|
33
33
|
project: { id: { $eq: params.project.id } },
|
|
34
34
|
id: { $eq: params.itemOffered.id }
|
|
35
|
-
});
|
|
35
|
+
}, [], []);
|
|
36
36
|
const product = searchProductsResult.shift();
|
|
37
37
|
if (product === undefined) {
|
|
38
38
|
throw new factory.errors.NotFound('Product');
|
|
@@ -206,7 +206,7 @@ function fixProductAndOffers(params) {
|
|
|
206
206
|
page: 1,
|
|
207
207
|
project: { id: { $eq: params.project.id } },
|
|
208
208
|
id: { $eq: productId }
|
|
209
|
-
});
|
|
209
|
+
}, [], []);
|
|
210
210
|
const product = searchProductsResult.shift();
|
|
211
211
|
if (product === undefined) {
|
|
212
212
|
throw new factory.errors.NotFound('Product');
|
|
@@ -47,19 +47,17 @@ export declare function searchEventSeatOffersWithPaging(params: {
|
|
|
47
47
|
stockHolder: StockHolderRepo;
|
|
48
48
|
place: PlaceRepo;
|
|
49
49
|
}) => Promise<factory.place.seat.IPlaceWithOffer[]>;
|
|
50
|
-
interface IChangedEvent {
|
|
51
|
-
id: string;
|
|
52
|
-
typeOf: factory.eventType;
|
|
53
|
-
project: {
|
|
54
|
-
id: string;
|
|
55
|
-
};
|
|
56
|
-
}
|
|
57
50
|
/**
|
|
58
51
|
* イベント変更時処理
|
|
59
52
|
*/
|
|
60
53
|
export declare function onEventChanged(params: {
|
|
61
|
-
|
|
54
|
+
id: string[];
|
|
55
|
+
typeOf: factory.eventType;
|
|
56
|
+
project: {
|
|
57
|
+
id: string;
|
|
58
|
+
};
|
|
62
59
|
isNew: boolean;
|
|
60
|
+
useInform?: boolean;
|
|
63
61
|
}): (repos: {
|
|
64
62
|
event: EventRepo;
|
|
65
63
|
project: ProjectRepo;
|
|
@@ -76,3 +74,13 @@ export declare function createAggregateScreeningEventIfNotExist(params: {
|
|
|
76
74
|
}): (repos: {
|
|
77
75
|
task: TaskRepo;
|
|
78
76
|
}) => Promise<void>;
|
|
77
|
+
export declare function createInformTasks(params: {
|
|
78
|
+
project: {
|
|
79
|
+
id: string;
|
|
80
|
+
};
|
|
81
|
+
ids: string[];
|
|
82
|
+
typeOf: factory.eventType;
|
|
83
|
+
}): (repos: {
|
|
84
|
+
event: EventRepo;
|
|
85
|
+
task: TaskRepo;
|
|
86
|
+
}) => Promise<void>;
|
|
@@ -9,7 +9,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
9
9
|
});
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.createAggregateScreeningEventIfNotExist = exports.onEventChanged = exports.searchEventSeatOffersWithPaging = exports.addOffers2Seat = exports.product = exports.moneyTransfer = exports.eventServiceByCOA = exports.event = void 0;
|
|
12
|
+
exports.createInformTasks = exports.createAggregateScreeningEventIfNotExist = exports.onEventChanged = exports.searchEventSeatOffersWithPaging = exports.addOffers2Seat = exports.product = exports.moneyTransfer = exports.eventServiceByCOA = exports.event = void 0;
|
|
13
13
|
const moment = require("moment");
|
|
14
14
|
const factory = require("../factory");
|
|
15
15
|
const EventOfferService = require("./offer/event");
|
|
@@ -20,6 +20,8 @@ const MoneyTransferOfferService = require("./offer/moneyTransfer");
|
|
|
20
20
|
exports.moneyTransfer = MoneyTransferOfferService;
|
|
21
21
|
const ProductOfferService = require("./offer/product");
|
|
22
22
|
exports.product = ProductOfferService;
|
|
23
|
+
const settings_1 = require("../settings");
|
|
24
|
+
const informEvents = settings_1.settings.onEventChanged.informEvent;
|
|
23
25
|
/**
|
|
24
26
|
* 座席にオファー情報を付加する
|
|
25
27
|
*/
|
|
@@ -89,9 +91,11 @@ function searchEventSeatOffersWithPaging(params) {
|
|
|
89
91
|
} }));
|
|
90
92
|
if (seats.length > 0) {
|
|
91
93
|
const availabilities = yield repos.stockHolder.searchHolders({
|
|
94
|
+
project: { id: event.project.id },
|
|
92
95
|
eventId: params.event.id,
|
|
93
96
|
startDate: moment(event.startDate)
|
|
94
97
|
.toDate(),
|
|
98
|
+
hasTicketedSeat: true,
|
|
95
99
|
offers: seats.map((s) => {
|
|
96
100
|
var _a;
|
|
97
101
|
return {
|
|
@@ -117,24 +121,33 @@ function searchEventSeatOffersWithPaging(params) {
|
|
|
117
121
|
});
|
|
118
122
|
}
|
|
119
123
|
exports.searchEventSeatOffersWithPaging = searchEventSeatOffersWithPaging;
|
|
124
|
+
// type IChangedEvent = factory.task.onEventChanged.IChangedEvent;
|
|
120
125
|
/**
|
|
121
126
|
* イベント変更時処理
|
|
122
127
|
*/
|
|
123
128
|
function onEventChanged(params) {
|
|
124
129
|
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
125
|
-
const changedEvents = (Array.isArray(params.event)) ? params.event : [params.event];
|
|
126
|
-
if (
|
|
130
|
+
// const changedEvents = (Array.isArray(params.event)) ? params.event : [params.event];
|
|
131
|
+
if (params.id.length > 0) {
|
|
127
132
|
// ScreeningEventであれば集計タスク
|
|
128
|
-
if (
|
|
133
|
+
if (params.typeOf === factory.eventType.ScreeningEvent) {
|
|
129
134
|
yield createAggregateScreeningEventIfNotExist({
|
|
130
|
-
project: { id:
|
|
131
|
-
reservationFor:
|
|
132
|
-
return { id
|
|
135
|
+
project: { id: params.project.id },
|
|
136
|
+
reservationFor: params.id.map((id) => {
|
|
137
|
+
return { id };
|
|
133
138
|
}),
|
|
134
139
|
// 新規作成の場合は強制的に集計
|
|
135
140
|
force: params.isNew
|
|
136
141
|
})(repos);
|
|
137
142
|
}
|
|
143
|
+
// 通知タスク作成(2023-06-08~)
|
|
144
|
+
if (params.useInform === true) {
|
|
145
|
+
yield createInformTasks({
|
|
146
|
+
project: { id: params.project.id },
|
|
147
|
+
ids: params.id,
|
|
148
|
+
typeOf: params.typeOf
|
|
149
|
+
})(repos);
|
|
150
|
+
}
|
|
138
151
|
}
|
|
139
152
|
});
|
|
140
153
|
}
|
|
@@ -191,3 +204,53 @@ function createAggregateScreeningEventIfNotExist(params) {
|
|
|
191
204
|
});
|
|
192
205
|
}
|
|
193
206
|
exports.createAggregateScreeningEventIfNotExist = createAggregateScreeningEventIfNotExist;
|
|
207
|
+
function createInformTasks(params) {
|
|
208
|
+
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
209
|
+
const events4inform = yield repos.event.search({
|
|
210
|
+
id: { $in: params.ids },
|
|
211
|
+
typeOf: params.typeOf
|
|
212
|
+
}, {
|
|
213
|
+
aggregateEntranceGate: 0, aggregateOffer: 0, aggregateReservation: 0,
|
|
214
|
+
remainingAttendeeCapacity: 0, checkInCount: 0, attendeeCount: 0
|
|
215
|
+
});
|
|
216
|
+
if (events4inform.length > 0) {
|
|
217
|
+
const taskRunsAt = new Date();
|
|
218
|
+
const informTasks = [];
|
|
219
|
+
informEvents === null || informEvents === void 0 ? void 0 : informEvents.forEach((informEvent) => {
|
|
220
|
+
var _a;
|
|
221
|
+
const informUrl = String((_a = informEvent.recipient) === null || _a === void 0 ? void 0 : _a.url);
|
|
222
|
+
events4inform.forEach((event4inform) => {
|
|
223
|
+
var _a;
|
|
224
|
+
// _idは不要であり、存在すると予期せぬ影響を及ぼす可能性がある
|
|
225
|
+
delete event4inform._id;
|
|
226
|
+
const informActionAttributes = {
|
|
227
|
+
agent: event4inform.project,
|
|
228
|
+
object: event4inform,
|
|
229
|
+
project: event4inform.project,
|
|
230
|
+
recipient: {
|
|
231
|
+
id: '',
|
|
232
|
+
name: String((_a = informEvent.recipient) === null || _a === void 0 ? void 0 : _a.name),
|
|
233
|
+
typeOf: factory.creativeWorkType.WebApplication,
|
|
234
|
+
url: informUrl
|
|
235
|
+
},
|
|
236
|
+
typeOf: factory.actionType.InformAction
|
|
237
|
+
};
|
|
238
|
+
informTasks.push({
|
|
239
|
+
project: event4inform.project,
|
|
240
|
+
name: factory.taskName.TriggerWebhook,
|
|
241
|
+
status: factory.taskStatus.Ready,
|
|
242
|
+
runsAt: taskRunsAt,
|
|
243
|
+
remainingNumberOfTries: 10,
|
|
244
|
+
numberOfTried: 0,
|
|
245
|
+
executionResults: [],
|
|
246
|
+
data: informActionAttributes
|
|
247
|
+
});
|
|
248
|
+
});
|
|
249
|
+
});
|
|
250
|
+
if (informTasks.length > 0) {
|
|
251
|
+
yield repos.task.saveMany(informTasks, { emitImmediately: true });
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
});
|
|
255
|
+
}
|
|
256
|
+
exports.createInformTasks = createInformTasks;
|