@chevre/domain 22.6.0-alpha.16 → 22.6.0-alpha.18
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/onReservationUsed.d.ts +3 -1
- package/lib/chevre/service/reserve/potentialActions/onReservationUsed.js +25 -10
- package/lib/chevre/service/reserve/useReservation.js +3 -3
- package/lib/chevre/service/task/createEvent/createEventBySchedule.js +5 -13
- package/package.json +3 -3
|
@@ -6,6 +6,8 @@ export type IUseReservationAction = factory.action.consume.use.reservation.IActi
|
|
|
6
6
|
/**
|
|
7
7
|
* 予約使用
|
|
8
8
|
*/
|
|
9
|
-
export declare function onReservationUsed(attendedReservation: IAttendedReservation
|
|
9
|
+
export declare function onReservationUsed(attendedReservation: IAttendedReservation, action: factory.action.consume.use.reservation.IAttributes & {
|
|
10
|
+
id: string;
|
|
11
|
+
}): (repos: {
|
|
10
12
|
task: TaskRepo;
|
|
11
13
|
}, settings: Settings) => Promise<void>;
|
|
@@ -19,24 +19,39 @@ const factory_1 = require("../factory");
|
|
|
19
19
|
/**
|
|
20
20
|
* 予約使用
|
|
21
21
|
*/
|
|
22
|
-
function onReservationUsed(attendedReservation) {
|
|
22
|
+
function onReservationUsed(attendedReservation, action) {
|
|
23
23
|
// tslint:disable-next-line:max-func-body-length
|
|
24
24
|
return (repos, settings) => __awaiter(this, void 0, void 0, function* () {
|
|
25
|
+
var _a;
|
|
25
26
|
const tasks = [];
|
|
26
27
|
const now = new Date();
|
|
27
28
|
const informReservations = settings.onReservationStatusChanged.informReservation;
|
|
28
29
|
const informTaskRunsAt = now;
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
id:
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
30
|
+
// support notification.reservation.IUseAction(2024-11-11~)
|
|
31
|
+
let reservation4inform;
|
|
32
|
+
if (settings.useExperimentalFeature) {
|
|
33
|
+
reservation4inform = Object.assign({ typeOf: action.typeOf, project: action.project, id: action.id, object: {
|
|
34
|
+
typeOf: attendedReservation.typeOf,
|
|
35
|
+
id: attendedReservation.id,
|
|
36
|
+
modifiedTime: attendedReservation.modifiedTime,
|
|
37
|
+
reservedTicket: { dateUsed: attendedReservation.reservedTicket.dateUsed }
|
|
38
|
+
} }, (typeof ((_a = action.location) === null || _a === void 0 ? void 0 : _a.identifier) === 'string')
|
|
39
|
+
? { location: { identifier: action.location.identifier } }
|
|
40
|
+
: undefined);
|
|
41
|
+
}
|
|
42
|
+
else {
|
|
43
|
+
reservation4inform = {
|
|
44
|
+
typeOf: attendedReservation.typeOf,
|
|
45
|
+
project: attendedReservation.project,
|
|
46
|
+
id: attendedReservation.id,
|
|
47
|
+
attended: true,
|
|
48
|
+
modifiedTime: attendedReservation.modifiedTime,
|
|
49
|
+
reservedTicket: { dateUsed: attendedReservation.reservedTicket.dateUsed }
|
|
50
|
+
};
|
|
51
|
+
}
|
|
37
52
|
const modifiedTimeInMilliseconds = moment(attendedReservation.modifiedTime)
|
|
38
53
|
.valueOf();
|
|
39
|
-
const informIdentifier = `${attendedReservation.typeOf}:${
|
|
54
|
+
const informIdentifier = `${attendedReservation.typeOf}:${attendedReservation.id}:attended:${modifiedTimeInMilliseconds}`;
|
|
40
55
|
// inform galobally
|
|
41
56
|
if (Array.isArray(informReservations)) {
|
|
42
57
|
tasks.push(...informReservations.map((informReservation) => {
|
|
@@ -22,7 +22,7 @@ const debug = createDebug('chevre-domain:service:reserve:useReservation');
|
|
|
22
22
|
function useReservation(params) {
|
|
23
23
|
return (repos, settings) => __awaiter(this, void 0, void 0, function* () {
|
|
24
24
|
var _a, _b, _c;
|
|
25
|
-
const now = new Date();
|
|
25
|
+
// const now = new Date();
|
|
26
26
|
const reservationId = params.object.id;
|
|
27
27
|
const ticketToken = (_a = params === null || params === void 0 ? void 0 : params.instrument) === null || _a === void 0 ? void 0 : _a.ticketToken;
|
|
28
28
|
// const token = params?.instrument?.token;
|
|
@@ -60,7 +60,7 @@ function useReservation(params) {
|
|
|
60
60
|
let attendedReservation;
|
|
61
61
|
try {
|
|
62
62
|
// 使用日時と同時更新(2023-01-30~)
|
|
63
|
-
attendedReservation = yield repos.reservation.attendIfNotAttended({ id: reservationId, now });
|
|
63
|
+
attendedReservation = yield repos.reservation.attendIfNotAttended({ id: reservationId, now: action.startDate });
|
|
64
64
|
}
|
|
65
65
|
catch (error) {
|
|
66
66
|
try {
|
|
@@ -72,7 +72,7 @@ function useReservation(params) {
|
|
|
72
72
|
throw error;
|
|
73
73
|
}
|
|
74
74
|
yield repos.action.completeWithVoid({ typeOf: action.typeOf, id: action.id, result: {} });
|
|
75
|
-
yield (0, onReservationUsed_1.onReservationUsed)(attendedReservation)({ task: repos.task }, settings);
|
|
75
|
+
yield (0, onReservationUsed_1.onReservationUsed)(attendedReservation, Object.assign(Object.assign({}, actionAttributes), { id: action.id }))({ task: repos.task }, settings);
|
|
76
76
|
});
|
|
77
77
|
}
|
|
78
78
|
exports.useReservation = useReservation;
|
|
@@ -15,14 +15,7 @@ const moment = require("moment-timezone");
|
|
|
15
15
|
const factory = require("../../../factory");
|
|
16
16
|
const event_1 = require("../../event");
|
|
17
17
|
const debug = createDebug('chevre-domain:service:task');
|
|
18
|
-
|
|
19
|
-
// Customer = 'customer',
|
|
20
|
-
// POS = 'pos'
|
|
21
|
-
// }
|
|
22
|
-
// const AVAILABLE_ROLE_NAMES: string[] = [RoleName.Customer, RoleName.POS];
|
|
23
|
-
function createEvents(schedule
|
|
24
|
-
// createDate?: Date
|
|
25
|
-
) {
|
|
18
|
+
function createEvents(schedule, createDate) {
|
|
26
19
|
// tslint:disable-next-line:cyclomatic-complexity max-func-body-length
|
|
27
20
|
return (repos, settings) => __awaiter(this, void 0, void 0, function* () {
|
|
28
21
|
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
@@ -40,13 +33,12 @@ function createEvents(schedule
|
|
|
40
33
|
}
|
|
41
34
|
const project = schedule.project;
|
|
42
35
|
// 引数情報取得
|
|
43
|
-
const targetInfo = getTargetInfoForCreateFromSetting(schedule);
|
|
36
|
+
const targetInfo = getTargetInfoForCreateFromSetting(schedule, createDate);
|
|
44
37
|
debug(targetInfo.length, 'targetInfos ->', targetInfo);
|
|
45
38
|
// 施設コンテンツ検索
|
|
46
39
|
const screeningEventSeries = (yield repos.eventSeries.projectEventSeriesFields({
|
|
47
40
|
project: { id: { $eq: project.id } },
|
|
48
41
|
id: { $eq: eventSeriesId }
|
|
49
|
-
// workPerformed: { identifiers: [workPerformedIdentifier] }
|
|
50
42
|
}, [
|
|
51
43
|
'location', 'additionalProperty', 'description', 'endDate', 'headline', 'kanaName', 'name',
|
|
52
44
|
'soundFormat', 'startDate', 'typeOf', 'videoFormat', 'workPerformed'
|
|
@@ -228,9 +220,9 @@ function createEvents(schedule
|
|
|
228
220
|
/**
|
|
229
221
|
* パフォーマンス作成・作成対象情報取得
|
|
230
222
|
*/
|
|
231
|
-
function getTargetInfoForCreateFromSetting(settings) {
|
|
223
|
+
function getTargetInfoForCreateFromSetting(settings, createDate) {
|
|
232
224
|
const performanceInfos = [];
|
|
233
|
-
const { days, duration, noPerformanceTimes,
|
|
225
|
+
const { days, duration, noPerformanceTimes, hours, start, minutes, tours } = settings;
|
|
234
226
|
// 作成対象時間: 9,10,11など
|
|
235
227
|
// const hours: string[] = ['9', '10', '11', '12', '13', '14', '15', '16', '17', '18', '19', '20', '21', '22'];
|
|
236
228
|
// 作成開始が今日から何日後か: 30
|
|
@@ -295,7 +287,7 @@ function createEventBySchedule(params) {
|
|
|
295
287
|
if (schedule === null) {
|
|
296
288
|
throw new factory.errors.NotFound('Schedule');
|
|
297
289
|
}
|
|
298
|
-
yield createEvents(schedule)(repos, settings);
|
|
290
|
+
yield createEvents(schedule, (params.object.startDate instanceof Date) ? params.object.startDate : new Date())(repos, settings);
|
|
299
291
|
});
|
|
300
292
|
}
|
|
301
293
|
exports.createEventBySchedule = createEventBySchedule;
|
package/package.json
CHANGED
|
@@ -11,8 +11,8 @@
|
|
|
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.389.0-alpha.
|
|
15
|
-
"@cinerino/sdk": "10.16.0-alpha.
|
|
14
|
+
"@chevre/factory": "4.389.0-alpha.13",
|
|
15
|
+
"@cinerino/sdk": "10.16.0-alpha.8",
|
|
16
16
|
"@motionpicture/coa-service": "9.5.0",
|
|
17
17
|
"@motionpicture/gmo-service": "5.3.0",
|
|
18
18
|
"@sendgrid/mail": "6.4.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.6.0-alpha.
|
|
111
|
+
"version": "22.6.0-alpha.18"
|
|
112
112
|
}
|