@chevre/domain 22.5.0-alpha.44 → 22.5.0-alpha.46
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/lib/chevre/service/reserve/potentialActions/onPendingReservationCanceled.js +11 -8
- package/lib/chevre/service/reserve/potentialActions/onReservationCanceled.js +10 -7
- package/lib/chevre/service/reserve/potentialActions/onReservationCheckedIn.js +23 -20
- package/lib/chevre/service/reserve/potentialActions/onReservationConfirmed.js +9 -6
- package/lib/chevre/service/reserve/potentialActions/onReservationUsed.js +10 -7
- package/lib/chevre/service/reserve/potentialActions/onReservationsCreated.js +10 -7
- package/lib/chevre/settings.d.ts +2 -0
- package/lib/chevre/settings.js +2 -1
- package/package.json +2 -2
|
@@ -16,14 +16,17 @@ const factory_1 = require("../factory");
|
|
|
16
16
|
function onPendingReservationCanceled(params) {
|
|
17
17
|
return (repos, settings) => __awaiter(this, void 0, void 0, function* () {
|
|
18
18
|
const { project, reservationFor, reservationNumber } = params;
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
19
|
+
// migrate to agg(2024-10-29~)
|
|
20
|
+
if (!settings.useAggregationOnAggService) {
|
|
21
|
+
if (typeof (reservationFor === null || reservationFor === void 0 ? void 0 : reservationFor.id) === 'string') {
|
|
22
|
+
// 冗長な作成を避ける
|
|
23
|
+
yield (0, onEventChanged_1.createAggregateScreeningEventIfNotExist)({
|
|
24
|
+
project: { id: project.id },
|
|
25
|
+
reservationFor: [{ id: reservationFor.id }],
|
|
26
|
+
force: false,
|
|
27
|
+
identifier: `onPendingReservationCanceled:${reservationNumber}`
|
|
28
|
+
})({ task: repos.task });
|
|
29
|
+
}
|
|
27
30
|
}
|
|
28
31
|
// inform(2024-10-25~)
|
|
29
32
|
const informReservations = settings.onReservationStatusChanged.informReservation;
|
|
@@ -102,13 +102,16 @@ reservationFor) {
|
|
|
102
102
|
}
|
|
103
103
|
}
|
|
104
104
|
if (typeof (reservationFor === null || reservationFor === void 0 ? void 0 : reservationFor.id) === 'string') {
|
|
105
|
-
//
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
105
|
+
// migrate to agg(2024-10-29~)
|
|
106
|
+
if (!settings.useAggregationOnAggService) {
|
|
107
|
+
// 冗長な作成を避ける
|
|
108
|
+
yield (0, onEventChanged_1.createAggregateScreeningEventIfNotExist)({
|
|
109
|
+
project: { id: reservationFor.project.id },
|
|
110
|
+
reservationFor: [{ id: reservationFor.id }],
|
|
111
|
+
force: false,
|
|
112
|
+
identifier: `onReservationCanceled:${(_a = canceledReservations === null || canceledReservations === void 0 ? void 0 : canceledReservations[0]) === null || _a === void 0 ? void 0 : _a.reservationNumber}`
|
|
113
|
+
})({ task: repos.task });
|
|
114
|
+
}
|
|
112
115
|
}
|
|
113
116
|
});
|
|
114
117
|
}
|
|
@@ -107,26 +107,29 @@ function onReservationCheckedIn(params) {
|
|
|
107
107
|
if (tasks.length > 0) {
|
|
108
108
|
yield repos.task.saveMany(tasks, { emitImmediately: true });
|
|
109
109
|
}
|
|
110
|
-
//
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
110
|
+
// migrate to agg(2024-10-29~)
|
|
111
|
+
if (!settings.useAggregationOnAggService) {
|
|
112
|
+
// 冗長な作成を避ける
|
|
113
|
+
const reservationForIds = (_a = params.object.reservationFor) === null || _a === void 0 ? void 0 : _a.ids;
|
|
114
|
+
if (Array.isArray(reservationForIds)) {
|
|
115
|
+
// 集計タスクを追加
|
|
116
|
+
yield Promise.all(reservationForIds.map((reservationForId) => __awaiter(this, void 0, void 0, function* () {
|
|
117
|
+
var _b;
|
|
118
|
+
// すでにイベントが削除されているケースに備えて、イベント存在検証(2023-09-12~)
|
|
119
|
+
const existingEvents = yield repos.event.projectEventFields({
|
|
120
|
+
id: { $eq: reservationForId },
|
|
121
|
+
typeOfIn: [factory.eventType.Event, factory.eventType.ScreeningEvent] // 指定しないとArgumentNullError
|
|
122
|
+
}, ['typeOf']);
|
|
123
|
+
if (existingEvents.length > 0) {
|
|
124
|
+
yield (0, onEventChanged_1.createAggregateScreeningEventIfNotExist)({
|
|
125
|
+
project: { id: params.project.id },
|
|
126
|
+
reservationFor: [{ id: reservationForId }],
|
|
127
|
+
force: false,
|
|
128
|
+
identifier: `onReservationCheckedIn:${(_b = params.purpose) === null || _b === void 0 ? void 0 : _b.code}`
|
|
129
|
+
})({ task: repos.task });
|
|
130
|
+
}
|
|
131
|
+
})));
|
|
132
|
+
}
|
|
130
133
|
}
|
|
131
134
|
});
|
|
132
135
|
}
|
|
@@ -57,12 +57,15 @@ function onReservationConfirmed(confirmedReservations) {
|
|
|
57
57
|
if (Array.isArray(confirmedReservations) && confirmedReservations.length > 0) {
|
|
58
58
|
// ひとつめの予約からReservationPackageの共有属性を取り出す
|
|
59
59
|
const { bookingTime, issuedThrough, project, provider, reservationFor, reservationNumber, underName } = confirmedReservations[0];
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
60
|
+
// migrate to agg(2024-10-29~)
|
|
61
|
+
if (!settings.useAggregationOnAggService) {
|
|
62
|
+
yield (0, onEventChanged_1.createAggregateScreeningEventIfNotExist)({
|
|
63
|
+
project,
|
|
64
|
+
reservationFor: [{ id: reservationFor.id }],
|
|
65
|
+
force: false,
|
|
66
|
+
identifier: `onReservationConfirmed:${reservationNumber}`
|
|
67
|
+
})({ task: repos.task });
|
|
68
|
+
}
|
|
66
69
|
const now = new Date();
|
|
67
70
|
const taskAttributes = [];
|
|
68
71
|
const subReservations4inform = confirmedReservations.map((r) => {
|
|
@@ -133,13 +133,16 @@ function onReservationUsed(attendedReservation) {
|
|
|
133
133
|
if (tasks.length > 0) {
|
|
134
134
|
yield repos.task.saveMany(tasks, { emitImmediately: true });
|
|
135
135
|
}
|
|
136
|
-
//
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
136
|
+
// migrate to agg(2024-10-29~)
|
|
137
|
+
if (!settings.useAggregationOnAggService) {
|
|
138
|
+
// 冗長な作成を避ける
|
|
139
|
+
yield (0, onEventChanged_1.createAggregateScreeningEventIfNotExist)({
|
|
140
|
+
project: attendedReservation.project,
|
|
141
|
+
reservationFor: [{ id: attendedReservation.reservationFor.id }],
|
|
142
|
+
force: false,
|
|
143
|
+
identifier: `onReservationUsed:${attendedReservation.id}`
|
|
144
|
+
})({ task: repos.task });
|
|
145
|
+
}
|
|
143
146
|
});
|
|
144
147
|
}
|
|
145
148
|
exports.onReservationUsed = onReservationUsed;
|
|
@@ -18,13 +18,16 @@ const factory_1 = require("../factory");
|
|
|
18
18
|
*/
|
|
19
19
|
function onReservationsCreated(params) {
|
|
20
20
|
return (repos, settings) => __awaiter(this, void 0, void 0, function* () {
|
|
21
|
-
//
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
21
|
+
// migrate to agg(2024-10-29~)
|
|
22
|
+
if (!settings.useAggregationOnAggService) {
|
|
23
|
+
// 集計タスク
|
|
24
|
+
yield (0, onEventChanged_1.createAggregateScreeningEventIfNotExist)({
|
|
25
|
+
project: { id: params.project.id },
|
|
26
|
+
reservationFor: [{ id: params.event.id }],
|
|
27
|
+
force: false,
|
|
28
|
+
identifier: `onReservationsCreated:${params.transaction.transactionNumber}`
|
|
29
|
+
})({ task: repos.task });
|
|
30
|
+
}
|
|
28
31
|
// inform(2024-10-25~)
|
|
29
32
|
const informReservations = settings.onReservationStatusChanged.informReservation;
|
|
30
33
|
const now = new Date();
|
package/lib/chevre/settings.d.ts
CHANGED
|
@@ -73,6 +73,7 @@ interface IOptions {
|
|
|
73
73
|
*/
|
|
74
74
|
minIntervalBetweenPayAndRefund: number;
|
|
75
75
|
};
|
|
76
|
+
useAggregationOnAggService?: boolean;
|
|
76
77
|
useAssetTransactionSyncProcessing: boolean;
|
|
77
78
|
useExperimentalFeature: boolean;
|
|
78
79
|
notification: IWebhookSettings;
|
|
@@ -133,6 +134,7 @@ declare class Settings {
|
|
|
133
134
|
*/
|
|
134
135
|
minIntervalBetweenPayAndRefund: number;
|
|
135
136
|
};
|
|
137
|
+
readonly useAggregationOnAggService: boolean;
|
|
136
138
|
readonly useAssetTransactionSyncProcessing: boolean;
|
|
137
139
|
readonly useExperimentalFeature: boolean;
|
|
138
140
|
/**
|
package/lib/chevre/settings.js
CHANGED
|
@@ -12,7 +12,7 @@ class Settings {
|
|
|
12
12
|
// useAggregateEntranceGateProjects,
|
|
13
13
|
// useAggregateOfferProjects,
|
|
14
14
|
// useOfferRateLimitProjects,
|
|
15
|
-
abortedTasksWithoutReport, numTryConfirmReserveTransaction, transaction, defaultSenderEmail, deliverOrderLimit, coa, gmo, movieticketReserve, useAssetTransactionSyncProcessing, useExperimentalFeature, notification } = options;
|
|
15
|
+
abortedTasksWithoutReport, numTryConfirmReserveTransaction, transaction, defaultSenderEmail, deliverOrderLimit, coa, gmo, movieticketReserve, useAggregationOnAggService, useAssetTransactionSyncProcessing, useExperimentalFeature, notification } = options;
|
|
16
16
|
this.onEventChanged = onEventChanged;
|
|
17
17
|
this.onOrderStatusChanged = onOrderStatusChanged;
|
|
18
18
|
this.onResourceUpdated = onResourceUpdated;
|
|
@@ -30,6 +30,7 @@ class Settings {
|
|
|
30
30
|
this.coa = coa;
|
|
31
31
|
this.gmo = gmo;
|
|
32
32
|
this.movieticketReserve = movieticketReserve;
|
|
33
|
+
this.useAggregationOnAggService = useAggregationOnAggService === true;
|
|
33
34
|
this.useAssetTransactionSyncProcessing = useAssetTransactionSyncProcessing;
|
|
34
35
|
this.useExperimentalFeature = useExperimentalFeature;
|
|
35
36
|
this.notification = notification;
|
package/package.json
CHANGED
|
@@ -11,7 +11,7 @@
|
|
|
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": "4.388.0-alpha.
|
|
14
|
+
"@chevre/factory": "4.388.0-alpha.7",
|
|
15
15
|
"@cinerino/sdk": "10.16.0-alpha.3",
|
|
16
16
|
"@motionpicture/coa-service": "9.5.0",
|
|
17
17
|
"@motionpicture/gmo-service": "5.3.0",
|
|
@@ -108,5 +108,5 @@
|
|
|
108
108
|
"postversion": "git push origin --tags",
|
|
109
109
|
"prepublishOnly": "npm run clean && npm run build && npm test && npm run doc"
|
|
110
110
|
},
|
|
111
|
-
"version": "22.5.0-alpha.
|
|
111
|
+
"version": "22.5.0-alpha.46"
|
|
112
112
|
}
|