@chevre/domain 21.8.0-alpha.59 → 21.8.0-alpha.60
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/searchEvents.ts +9 -7
- package/lib/chevre/service/reserve/checkInReservation.d.ts +2 -0
- package/lib/chevre/service/reserve/checkInReservation.js +1 -1
- package/lib/chevre/service/reserve/potentialActions/onReservationCheckedIn.d.ts +2 -0
- package/lib/chevre/service/reserve/potentialActions/onReservationCheckedIn.js +14 -7
- package/lib/chevre/service/task/onAuthorizationCreated.js +3 -0
- package/package.json +1 -1
|
@@ -12,15 +12,17 @@ async function main() {
|
|
|
12
12
|
|
|
13
13
|
const events = await eventRepo.search(
|
|
14
14
|
{
|
|
15
|
-
limit: 100,
|
|
16
|
-
page: 1,
|
|
17
|
-
sort: { startDate: 1 },
|
|
18
|
-
typeOf: chevre.factory.eventType.ScreeningEvent,
|
|
19
|
-
project: { id: { $eq: PROJECT_ID } },
|
|
20
|
-
id: { $eq: 'al6aff83y' }
|
|
15
|
+
// limit: 100,
|
|
16
|
+
// page: 1,
|
|
17
|
+
// sort: { startDate: 1 },
|
|
18
|
+
// typeOf: chevre.factory.eventType.ScreeningEvent,
|
|
19
|
+
// project: { id: { $eq: PROJECT_ID } },
|
|
20
|
+
id: { $eq: 'al6aff83y' },
|
|
21
|
+
typeOfIn: [chevre.factory.eventType.Event, chevre.factory.eventType.ScreeningEvent]
|
|
21
22
|
},
|
|
22
23
|
{
|
|
23
|
-
|
|
24
|
+
_id: 1
|
|
25
|
+
// name: 1
|
|
24
26
|
}
|
|
25
27
|
);
|
|
26
28
|
console.log(events);
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { MongoRepository as ActionRepo } from '../../repo/action';
|
|
2
2
|
import { MongoRepository as AssetTransactionRepo } from '../../repo/assetTransaction';
|
|
3
|
+
import { MongoRepository as EventRepo } from '../../repo/event';
|
|
3
4
|
import { MongoRepository as ReservationRepo } from '../../repo/reservation';
|
|
4
5
|
import { MongoRepository as TaskRepo } from '../../repo/task';
|
|
5
6
|
interface ICheckInReservationParams {
|
|
@@ -34,6 +35,7 @@ export declare function checkInReservation(params: ICheckInReservationParams & {
|
|
|
34
35
|
}): (repos: {
|
|
35
36
|
action: ActionRepo;
|
|
36
37
|
assetTransaction: AssetTransactionRepo;
|
|
38
|
+
event: EventRepo;
|
|
37
39
|
reservation: ReservationRepo;
|
|
38
40
|
task: TaskRepo;
|
|
39
41
|
}) => Promise<void>;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { MongoRepository as EventRepo } from '../../../repo/event';
|
|
1
2
|
import { MongoRepository as TaskRepo } from '../../../repo/task';
|
|
2
3
|
export declare function onReservationCheckedIn(params: {
|
|
3
4
|
project: {
|
|
@@ -27,5 +28,6 @@ export declare function onReservationCheckedIn(params: {
|
|
|
27
28
|
code: string;
|
|
28
29
|
};
|
|
29
30
|
}): (repos: {
|
|
31
|
+
event: EventRepo;
|
|
30
32
|
task: TaskRepo;
|
|
31
33
|
}) => Promise<void>;
|
|
@@ -107,15 +107,22 @@ function onReservationCheckedIn(params) {
|
|
|
107
107
|
// 冗長な作成を避ける
|
|
108
108
|
const reservationForIds = (_a = params.object.reservationFor) === null || _a === void 0 ? void 0 : _a.ids;
|
|
109
109
|
if (Array.isArray(reservationForIds)) {
|
|
110
|
-
//
|
|
110
|
+
// 集計タスクを追加
|
|
111
111
|
yield Promise.all(reservationForIds.map((reservationForId) => __awaiter(this, void 0, void 0, function* () {
|
|
112
112
|
var _b;
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
113
|
+
// すでにイベントが削除されているケースに備えて、イベント存在検証(2023-09-12~)
|
|
114
|
+
const existingEvents = yield repos.event.search({
|
|
115
|
+
id: { $eq: reservationForId },
|
|
116
|
+
typeOfIn: [factory.eventType.Event, factory.eventType.ScreeningEvent] // 指定しないとArgumentNullError
|
|
117
|
+
}, { _id: 1 });
|
|
118
|
+
if (existingEvents.length > 0) {
|
|
119
|
+
yield (0, offer_1.createAggregateScreeningEventIfNotExist)({
|
|
120
|
+
project: { id: params.project.id },
|
|
121
|
+
reservationFor: [{ id: reservationForId }],
|
|
122
|
+
force: false,
|
|
123
|
+
identifier: `onReservationCheckedIn:${(_b = params.purpose) === null || _b === void 0 ? void 0 : _b.code}`
|
|
124
|
+
})({ task: repos.task });
|
|
125
|
+
}
|
|
119
126
|
})));
|
|
120
127
|
}
|
|
121
128
|
});
|
|
@@ -14,6 +14,7 @@ const factory = require("../../factory");
|
|
|
14
14
|
const action_1 = require("../../repo/action");
|
|
15
15
|
const assetTransaction_1 = require("../../repo/assetTransaction");
|
|
16
16
|
const code_1 = require("../../repo/code");
|
|
17
|
+
const event_1 = require("../../repo/event");
|
|
17
18
|
const order_1 = require("../../repo/order");
|
|
18
19
|
const ownershipInfo_1 = require("../../repo/ownershipInfo");
|
|
19
20
|
const reservation_1 = require("../../repo/reservation");
|
|
@@ -28,6 +29,7 @@ function call(data) {
|
|
|
28
29
|
action: new action_1.MongoRepository(settings.connection),
|
|
29
30
|
assetTransaction: new assetTransaction_1.MongoRepository(settings.connection),
|
|
30
31
|
code: new code_1.MongoRepository(settings.connection),
|
|
32
|
+
event: new event_1.MongoRepository(settings.connection),
|
|
31
33
|
order: new order_1.MongoRepository(settings.connection),
|
|
32
34
|
ownershipInfo: new ownershipInfo_1.MongoRepository(settings.connection),
|
|
33
35
|
reservation: new reservation_1.MongoRepository(settings.connection),
|
|
@@ -103,6 +105,7 @@ function onAuthorizationCreated(params) {
|
|
|
103
105
|
})({
|
|
104
106
|
action: repos.action,
|
|
105
107
|
assetTransaction: repos.assetTransaction,
|
|
108
|
+
event: repos.event,
|
|
106
109
|
reservation: repos.reservation,
|
|
107
110
|
task: repos.task
|
|
108
111
|
});
|
package/package.json
CHANGED