@chevre/domain 21.8.0-alpha.53 → 21.8.0-alpha.55
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/repo/offer.d.ts +0 -6
- package/lib/chevre/repo/offer.js +17 -15
- package/lib/chevre/service/assetTransaction/reserve.js +3 -2
- package/lib/chevre/service/offer.d.ts +1 -0
- package/lib/chevre/service/offer.js +7 -1
- package/lib/chevre/service/reserve/checkInReservation.d.ts +6 -0
- package/lib/chevre/service/reserve/checkInReservation.js +2 -1
- package/lib/chevre/service/reserve/potentialActions/onReservationCanceled.js +3 -1
- package/lib/chevre/service/reserve/potentialActions/onReservationCheckedIn.d.ts +6 -0
- package/lib/chevre/service/reserve/potentialActions/onReservationCheckedIn.js +3 -1
- package/lib/chevre/service/reserve/potentialActions/onReservationConfirmed.js +2 -1
- package/lib/chevre/service/reserve/potentialActions/onReservationUsed.js +2 -1
- package/lib/chevre/service/task/onAuthorizationCreated.js +2 -1
- package/package.json +1 -1
|
@@ -82,12 +82,6 @@ export declare class MongoRepository {
|
|
|
82
82
|
*/
|
|
83
83
|
sortedOfferIds: string[];
|
|
84
84
|
}>;
|
|
85
|
-
findById(params: {
|
|
86
|
-
project: {
|
|
87
|
-
id: string;
|
|
88
|
-
};
|
|
89
|
-
id: string;
|
|
90
|
-
}): Promise<factory.unitPriceOffer.IUnitPriceOffer>;
|
|
91
85
|
findAggregateOfferById(params: {
|
|
92
86
|
project: {
|
|
93
87
|
id: string;
|
package/lib/chevre/repo/offer.js
CHANGED
|
@@ -825,21 +825,23 @@ class MongoRepository {
|
|
|
825
825
|
return { offers, sortedOfferIds };
|
|
826
826
|
});
|
|
827
827
|
}
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
}
|
|
828
|
+
// 不要なので廃止(2023-09-11~)
|
|
829
|
+
// public async findById(params: {
|
|
830
|
+
// project: { id: string };
|
|
831
|
+
// id: string;
|
|
832
|
+
// }): Promise<factory.unitPriceOffer.IUnitPriceOffer> {
|
|
833
|
+
// const offers = await this.search({
|
|
834
|
+
// limit: 1,
|
|
835
|
+
// page: 1,
|
|
836
|
+
// project: { id: { $eq: params.project.id } },
|
|
837
|
+
// id: { $eq: params.id }
|
|
838
|
+
// });
|
|
839
|
+
// const unitPriceOffer = offers.shift();
|
|
840
|
+
// if (unitPriceOffer === undefined) {
|
|
841
|
+
// throw new factory.errors.NotFound(factory.offerType.Offer);
|
|
842
|
+
// }
|
|
843
|
+
// return unitPriceOffer;
|
|
844
|
+
// }
|
|
843
845
|
findAggregateOfferById(params) {
|
|
844
846
|
return __awaiter(this, void 0, void 0, function* () {
|
|
845
847
|
const doc = yield this.aggregateOfferModel.findOne({
|
|
@@ -182,7 +182,7 @@ function addReservations(params) {
|
|
|
182
182
|
// await repos.reservation.createMany({ reservationFor, reservations: objectSubReservations });
|
|
183
183
|
// }
|
|
184
184
|
// ストックホルダー処理(stockHolderで残席数を集計しているので必要)
|
|
185
|
-
yield onReservationsCreated({ event })(repos);
|
|
185
|
+
yield onReservationsCreated({ event, transaction: { transactionNumber: transaction.transactionNumber } })(repos);
|
|
186
186
|
return { transaction, objectSubReservations, issuedThrough };
|
|
187
187
|
});
|
|
188
188
|
}
|
|
@@ -804,7 +804,8 @@ function onReservationsCreated(params) {
|
|
|
804
804
|
yield OfferService.createAggregateScreeningEventIfNotExist({
|
|
805
805
|
project: params.event.project,
|
|
806
806
|
reservationFor: [{ id: params.event.id }],
|
|
807
|
-
force: false
|
|
807
|
+
force: false,
|
|
808
|
+
identifier: `onReservationsCreated:${params.transaction.transactionNumber}`
|
|
808
809
|
})({ task: repos.task });
|
|
809
810
|
});
|
|
810
811
|
}
|
|
@@ -135,7 +135,8 @@ function onEventChanged(params) {
|
|
|
135
135
|
return { id };
|
|
136
136
|
}),
|
|
137
137
|
// 新規作成の場合は強制的に集計
|
|
138
|
-
force: params.isNew
|
|
138
|
+
force: params.isNew,
|
|
139
|
+
identifier: `onEventChanged`
|
|
139
140
|
})(repos);
|
|
140
141
|
}
|
|
141
142
|
// 通知タスク作成(2023-06-08~)
|
|
@@ -184,9 +185,12 @@ function createAggregateScreeningEventIfNotExist(params) {
|
|
|
184
185
|
const project = {
|
|
185
186
|
id: params.project.id, typeOf: factory.organizationType.Project
|
|
186
187
|
};
|
|
188
|
+
const nowInMilliseconds = Date.now();
|
|
187
189
|
if (params.force) {
|
|
188
190
|
aggregateTasks = params.reservationFor.map((reservationFor) => {
|
|
191
|
+
const taskIdentifier = `${params.project.id}:${factory.taskName.AggregateScreeningEvent}:${reservationFor.id}:${params.identifier}:${nowInMilliseconds}`;
|
|
189
192
|
return {
|
|
193
|
+
identifier: taskIdentifier,
|
|
190
194
|
project,
|
|
191
195
|
name: factory.taskName.AggregateScreeningEvent,
|
|
192
196
|
status: factory.taskStatus.Ready,
|
|
@@ -209,7 +213,9 @@ function createAggregateScreeningEventIfNotExist(params) {
|
|
|
209
213
|
}, { _id: 1 })
|
|
210
214
|
.exec();
|
|
211
215
|
if (readyAggregateScreeningEventTaskDoc === null) {
|
|
216
|
+
const taskIdentifier = `${params.project.id}:${factory.taskName.AggregateScreeningEvent}:${reservationFor.id}:${params.identifier}:${nowInMilliseconds}`;
|
|
212
217
|
aggregateTasks.push({
|
|
218
|
+
identifier: taskIdentifier,
|
|
213
219
|
project,
|
|
214
220
|
name: factory.taskName.AggregateScreeningEvent,
|
|
215
221
|
status: factory.taskStatus.Ready,
|
|
@@ -32,6 +32,7 @@ useInformReservation,
|
|
|
32
32
|
*/
|
|
33
33
|
reservationFor) {
|
|
34
34
|
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
35
|
+
var _a;
|
|
35
36
|
if (Array.isArray(canceledReservations) && canceledReservations.length > 0) {
|
|
36
37
|
const now = new Date();
|
|
37
38
|
const project = canceledReservations[0].project;
|
|
@@ -96,7 +97,8 @@ reservationFor) {
|
|
|
96
97
|
yield (0, offer_1.createAggregateScreeningEventIfNotExist)({
|
|
97
98
|
project: { id: reservationFor.project.id },
|
|
98
99
|
reservationFor: [{ id: reservationFor.id }],
|
|
99
|
-
force: false
|
|
100
|
+
force: false,
|
|
101
|
+
identifier: `onReservationCanceled:${(_a = canceledReservations === null || canceledReservations === void 0 ? void 0 : canceledReservations[0]) === null || _a === void 0 ? void 0 : _a.reservationNumber}`
|
|
100
102
|
})({ task: repos.task });
|
|
101
103
|
}
|
|
102
104
|
});
|
|
@@ -109,10 +109,12 @@ function onReservationCheckedIn(params) {
|
|
|
109
109
|
if (Array.isArray(reservationForIds)) {
|
|
110
110
|
// イベント集計タスクを追加
|
|
111
111
|
yield Promise.all(reservationForIds.map((reservationForId) => __awaiter(this, void 0, void 0, function* () {
|
|
112
|
+
var _b;
|
|
112
113
|
yield (0, offer_1.createAggregateScreeningEventIfNotExist)({
|
|
113
114
|
project: { id: params.project.id },
|
|
114
115
|
reservationFor: [{ id: reservationForId }],
|
|
115
|
-
force: false
|
|
116
|
+
force: false,
|
|
117
|
+
identifier: `onReservationCheckedIn:${(_b = params.purpose) === null || _b === void 0 ? void 0 : _b.code}`
|
|
116
118
|
})({ task: repos.task });
|
|
117
119
|
})));
|
|
118
120
|
}
|
|
@@ -70,7 +70,8 @@ function onReservationConfirmed(confirmedReservations) {
|
|
|
70
70
|
yield (0, offer_1.createAggregateScreeningEventIfNotExist)({
|
|
71
71
|
project: confirmedReservations[0].project,
|
|
72
72
|
reservationFor: [{ id: confirmedReservations[0].reservationFor.id }],
|
|
73
|
-
force: false
|
|
73
|
+
force: false,
|
|
74
|
+
identifier: `onReservationConfirmed:${confirmedReservations[0].reservationNumber}`
|
|
74
75
|
})({ task: repos.task });
|
|
75
76
|
const now = new Date();
|
|
76
77
|
const taskAttributes = [];
|
|
@@ -99,7 +99,8 @@ function onReservationUsed(action, attendedReservation) {
|
|
|
99
99
|
yield (0, offer_1.createAggregateScreeningEventIfNotExist)({
|
|
100
100
|
project: attendedReservation.project,
|
|
101
101
|
reservationFor: [{ id: attendedReservation.reservationFor.id }],
|
|
102
|
-
force: false
|
|
102
|
+
force: false,
|
|
103
|
+
identifier: `onReservationUsed:${attendedReservation.id}`
|
|
103
104
|
})({ task: repos.task });
|
|
104
105
|
});
|
|
105
106
|
}
|
|
@@ -98,7 +98,8 @@ function onAuthorizationCreated(params) {
|
|
|
98
98
|
reservationNumbers: reservationNumbers,
|
|
99
99
|
reservationFor: { ids: reservationForIds }
|
|
100
100
|
},
|
|
101
|
-
reserveIfNotYet: params.reserveIfNotYet
|
|
101
|
+
reserveIfNotYet: params.reserveIfNotYet,
|
|
102
|
+
purpose: { code: params.code }
|
|
102
103
|
})({
|
|
103
104
|
action: repos.action,
|
|
104
105
|
assetTransaction: repos.assetTransaction,
|
package/package.json
CHANGED