@chevre/domain 21.4.0-alpha.22 → 21.4.0-alpha.24
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.
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import * as factory from '../../factory';
|
|
2
2
|
import { MongoRepository as ActionRepo } from '../../repo/action';
|
|
3
3
|
import { MongoRepository as EventRepo } from '../../repo/event';
|
|
4
|
+
import { MongoRepository as PlaceRepo } from '../../repo/place';
|
|
4
5
|
import { MongoRepository as TaskRepo } from '../../repo/task';
|
|
5
6
|
export declare function createEvent(params: factory.task.createEvent.IData): (repos: {
|
|
6
7
|
action: ActionRepo;
|
|
7
8
|
event: EventRepo;
|
|
9
|
+
place: PlaceRepo;
|
|
8
10
|
task: TaskRepo;
|
|
9
11
|
}) => Promise<void>;
|
|
@@ -11,33 +11,59 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
exports.createEvent = void 0;
|
|
13
13
|
const factory = require("../../factory");
|
|
14
|
-
// tslint:disable-next-line:max-func-body-length
|
|
15
14
|
function createEvent(params) {
|
|
15
|
+
// tslint:disable-next-line:max-func-body-length
|
|
16
16
|
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
17
|
-
var _a;
|
|
17
|
+
var _a, _b;
|
|
18
18
|
const actionAttributes = params;
|
|
19
19
|
const action = yield repos.action.start(actionAttributes);
|
|
20
20
|
let eventIds = [];
|
|
21
21
|
let eventType;
|
|
22
22
|
try {
|
|
23
|
-
if (
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
23
|
+
if (actionAttributes.object.length > 0) {
|
|
24
|
+
if (((_a = actionAttributes.instrument) === null || _a === void 0 ? void 0 : _a.createScreeningEventSeriesIfNotExistByWorkPerformed) === true) {
|
|
25
|
+
const createScreeningEventSeriesOnAllLocation = ((_b = actionAttributes.instrument) === null || _b === void 0 ? void 0 : _b.createScreeningEventSeriesOnAllLocation) === true;
|
|
26
|
+
let creatingEventParams = actionAttributes.object.map((p) => {
|
|
27
|
+
if (p.typeOf !== factory.eventType.ScreeningEventSeries) {
|
|
28
|
+
throw new factory.errors.Argument('typeOf', `must be ${factory.eventType.ScreeningEventSeries}`);
|
|
29
|
+
}
|
|
30
|
+
return { attributes: p };
|
|
31
|
+
});
|
|
32
|
+
// 全施設対応(2023-07-21~)
|
|
33
|
+
if (createScreeningEventSeriesOnAllLocation) {
|
|
34
|
+
if (creatingEventParams.length !== 1) {
|
|
35
|
+
throw new factory.errors.NotImplemented('creatingEventAttributes.length must be 1');
|
|
36
|
+
}
|
|
37
|
+
const firstCreatingEventParams = creatingEventParams[0];
|
|
38
|
+
const movieTheaters = yield repos.place.searchMovieTheaters({
|
|
39
|
+
project: { id: { $eq: actionAttributes.project.id } }
|
|
40
|
+
}, ['_id', 'branchCode', 'kanaName', 'name'], []);
|
|
41
|
+
creatingEventParams = movieTheaters.map((movieTheater) => {
|
|
42
|
+
const location = {
|
|
43
|
+
branchCode: movieTheater.branchCode,
|
|
44
|
+
id: movieTheater.id,
|
|
45
|
+
kanaName: movieTheater.kanaName,
|
|
46
|
+
name: movieTheater.name,
|
|
47
|
+
typeOf: factory.placeType.MovieTheater
|
|
48
|
+
};
|
|
49
|
+
return {
|
|
50
|
+
attributes: Object.assign(Object.assign({}, firstCreatingEventParams.attributes), { location })
|
|
51
|
+
};
|
|
52
|
+
});
|
|
27
53
|
}
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
54
|
+
const bulkWriteResult = yield repos.event.createScreeningEventSeriesIfNotExistByWorkPerformed(creatingEventParams);
|
|
55
|
+
let upsertedIds;
|
|
56
|
+
if (bulkWriteResult !== undefined) {
|
|
57
|
+
upsertedIds = bulkWriteResult.getUpsertedIds()
|
|
58
|
+
.map((doc) => doc._id.toString());
|
|
59
|
+
}
|
|
60
|
+
eventIds = (Array.isArray(upsertedIds)) ? upsertedIds : [];
|
|
61
|
+
eventType = factory.eventType.ScreeningEventSeries;
|
|
62
|
+
}
|
|
63
|
+
else {
|
|
64
|
+
// no op
|
|
65
|
+
throw new factory.errors.NotImplemented('only createScreeningEventSeriesIfNotExistByWorkPerformed implemented');
|
|
34
66
|
}
|
|
35
|
-
eventIds = (Array.isArray(upsertedIds)) ? upsertedIds : [];
|
|
36
|
-
eventType = factory.eventType.ScreeningEventSeries;
|
|
37
|
-
}
|
|
38
|
-
else {
|
|
39
|
-
// no op
|
|
40
|
-
throw new factory.errors.NotImplemented('only createScreeningEventSeriesIfNotExistByWorkPerformed implemented');
|
|
41
67
|
}
|
|
42
68
|
}
|
|
43
69
|
catch (error) {
|
|
@@ -61,7 +87,7 @@ function createEvent(params) {
|
|
|
61
87
|
})
|
|
62
88
|
: undefined
|
|
63
89
|
});
|
|
64
|
-
if (Array.isArray(eventIds) && eventIds.length > 0) {
|
|
90
|
+
if (Array.isArray(eventIds) && eventIds.length > 0 && typeof eventType === 'string') {
|
|
65
91
|
// 非同期に変更(2023-06-08~)
|
|
66
92
|
const onEventChangedTask = {
|
|
67
93
|
project: actionAttributes.project,
|
|
@@ -116,8 +116,10 @@ function reserveIfNotYet(params, options) {
|
|
|
116
116
|
}
|
|
117
117
|
}
|
|
118
118
|
else {
|
|
119
|
+
// 旧予約取引に対して本処理が走る可能性がなくはないが、
|
|
120
|
+
// それらについては実質Confirmedの予約はすでに存在するはずなので、何もしない
|
|
119
121
|
// 完全廃止(2023-07-19~)
|
|
120
|
-
throw new factory.errors.NotImplemented('disablePendingReservations must be true');
|
|
122
|
+
// throw new factory.errors.NotImplemented('disablePendingReservations must be true');
|
|
121
123
|
}
|
|
122
124
|
}
|
|
123
125
|
else {
|
|
@@ -12,6 +12,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
12
12
|
exports.call = void 0;
|
|
13
13
|
const action_1 = require("../../repo/action");
|
|
14
14
|
const event_1 = require("../../repo/event");
|
|
15
|
+
const place_1 = require("../../repo/place");
|
|
15
16
|
const task_1 = require("../../repo/task");
|
|
16
17
|
const EventService = require("../event");
|
|
17
18
|
/**
|
|
@@ -22,6 +23,7 @@ function call(data) {
|
|
|
22
23
|
yield EventService.createEvent(data)({
|
|
23
24
|
action: new action_1.MongoRepository(settings.connection),
|
|
24
25
|
event: new event_1.MongoRepository(settings.connection),
|
|
26
|
+
place: new place_1.MongoRepository(settings.connection),
|
|
25
27
|
task: new task_1.MongoRepository(settings.connection)
|
|
26
28
|
});
|
|
27
29
|
});
|
package/package.json
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
}
|
|
10
10
|
],
|
|
11
11
|
"dependencies": {
|
|
12
|
-
"@chevre/factory": "4.316.0-alpha.
|
|
12
|
+
"@chevre/factory": "4.316.0-alpha.4",
|
|
13
13
|
"@cinerino/sdk": "3.161.0-alpha.0",
|
|
14
14
|
"@motionpicture/coa-service": "9.2.0",
|
|
15
15
|
"@motionpicture/gmo-service": "5.2.0",
|
|
@@ -117,5 +117,5 @@
|
|
|
117
117
|
"postversion": "git push origin --tags",
|
|
118
118
|
"prepublishOnly": "npm run clean && npm run build && npm test && npm run doc"
|
|
119
119
|
},
|
|
120
|
-
"version": "21.4.0-alpha.
|
|
120
|
+
"version": "21.4.0-alpha.24"
|
|
121
121
|
}
|