@chevre/domain 21.5.0-alpha.0 → 21.5.0-alpha.1
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/factory/event.d.ts +6 -0
- package/lib/chevre/factory/event.js +47 -0
- package/lib/chevre/repo/event.d.ts +17 -0
- package/lib/chevre/repo/event.js +31 -0
- package/lib/chevre/repo/mongoose/schemas/event.d.ts +6 -6
- package/lib/chevre/service/offer.d.ts +7 -7
- package/lib/chevre/service/offer.js +27 -3
- package/lib/chevre/service.d.ts +2 -0
- package/lib/chevre/service.js +3 -0
- package/package.json +2 -2
|
@@ -1,2 +1,8 @@
|
|
|
1
1
|
import * as factory from '../factory';
|
|
2
2
|
export type IMinimizedIndividualEvent<T extends factory.eventType.ScreeningEvent | factory.eventType.Event> = T extends factory.eventType.ScreeningEvent ? Pick<factory.event.IEvent<T>, 'project' | 'organizer' | 'id' | 'typeOf' | 'additionalProperty' | 'name' | 'doorTime' | 'endDate' | 'eventStatus' | 'location' | 'startDate' | 'superEvent' | 'offers' | 'coaInfo' | 'identifier'> : T extends factory.eventType.Event ? Pick<factory.event.IEvent<T>, 'project' | 'organizer' | 'id' | 'typeOf' | 'additionalProperty' | 'name' | 'doorTime' | 'endDate' | 'eventStatus' | 'location' | 'startDate' | 'offers'> : never;
|
|
3
|
+
/**
|
|
4
|
+
* 興行イベントのsuperEventを作成する
|
|
5
|
+
*/
|
|
6
|
+
export declare function minimizeSuperEvent(params: {
|
|
7
|
+
superEventFromDB: factory.event.screeningEventSeries.IEvent;
|
|
8
|
+
}): factory.event.screeningEvent.ISuperEvent;
|
|
@@ -1,2 +1,49 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.minimizeSuperEvent = void 0;
|
|
4
|
+
const factory = require("../factory");
|
|
5
|
+
/**
|
|
6
|
+
* 興行イベントのsuperEventを作成する
|
|
7
|
+
*/
|
|
8
|
+
function minimizeSuperEvent(params) {
|
|
9
|
+
const workPerformed = Object.assign(Object.assign(Object.assign(Object.assign({
|
|
10
|
+
// 不要なので廃止(2022-12-19~)
|
|
11
|
+
// project: { typeOf: chevre.factory.organizationType.Project, id: params.project.id },
|
|
12
|
+
typeOf: factory.creativeWorkType.Movie, identifier: String(params.superEventFromDB.workPerformed.identifier) }, (typeof params.superEventFromDB.workPerformed.id === 'string')
|
|
13
|
+
? { id: params.superEventFromDB.workPerformed.id }
|
|
14
|
+
: undefined), (params.superEventFromDB.workPerformed.name !== undefined)
|
|
15
|
+
? { name: params.superEventFromDB.workPerformed.name }
|
|
16
|
+
: undefined), (typeof params.superEventFromDB.workPerformed.duration === 'string')
|
|
17
|
+
? { duration: params.superEventFromDB.workPerformed.duration }
|
|
18
|
+
: undefined), (typeof params.superEventFromDB.workPerformed.contentRating === 'string')
|
|
19
|
+
? { contentRating: params.superEventFromDB.workPerformed.contentRating }
|
|
20
|
+
: undefined);
|
|
21
|
+
const location = Object.assign(Object.assign({
|
|
22
|
+
// 不要なので廃止(2022-12-19~)
|
|
23
|
+
// project: { typeOf: chevre.factory.organizationType.Project, id: params.project.id },
|
|
24
|
+
typeOf: factory.placeType.MovieTheater, id: params.superEventFromDB.location.id, branchCode: params.superEventFromDB.location.branchCode }, (params.superEventFromDB.location.name !== undefined)
|
|
25
|
+
? { name: params.superEventFromDB.location.name }
|
|
26
|
+
: undefined), (typeof params.superEventFromDB.location.kanaName === 'string')
|
|
27
|
+
? { kanaName: params.superEventFromDB.location.kanaName }
|
|
28
|
+
: undefined);
|
|
29
|
+
return Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({ typeOf: factory.eventType.ScreeningEventSeries,
|
|
30
|
+
// 不要なので廃止(2023-06-09~)
|
|
31
|
+
// project: { typeOf: chevre.factory.organizationType.Project, id: params.project.id },
|
|
32
|
+
id: params.superEventFromDB.id, videoFormat: params.superEventFromDB.videoFormat, soundFormat: params.superEventFromDB.soundFormat, workPerformed,
|
|
33
|
+
location, kanaName: params.superEventFromDB.kanaName, name: Object.assign(Object.assign({}, (typeof params.superEventFromDB.name.en === 'string') ? { en: params.superEventFromDB.name.en } : undefined), (typeof params.superEventFromDB.name.ja === 'string') ? { ja: params.superEventFromDB.name.ja } : undefined) }, (Array.isArray(params.superEventFromDB.additionalProperty))
|
|
34
|
+
? { additionalProperty: params.superEventFromDB.additionalProperty }
|
|
35
|
+
: undefined), (params.superEventFromDB.startDate instanceof Date)
|
|
36
|
+
? { startDate: params.superEventFromDB.startDate }
|
|
37
|
+
: undefined), (params.superEventFromDB.endDate instanceof Date)
|
|
38
|
+
? { endDate: params.superEventFromDB.endDate }
|
|
39
|
+
: undefined), (params.superEventFromDB.description !== undefined)
|
|
40
|
+
? { description: params.superEventFromDB.description }
|
|
41
|
+
: undefined), (params.superEventFromDB.headline !== undefined)
|
|
42
|
+
? { headline: params.superEventFromDB.headline }
|
|
43
|
+
: undefined), (params.superEventFromDB.dubLanguage !== undefined)
|
|
44
|
+
? { dubLanguage: params.superEventFromDB.dubLanguage }
|
|
45
|
+
: undefined), (params.superEventFromDB.subtitleLanguage !== undefined)
|
|
46
|
+
? { subtitleLanguage: params.superEventFromDB.subtitleLanguage }
|
|
47
|
+
: undefined);
|
|
48
|
+
}
|
|
49
|
+
exports.minimizeSuperEvent = minimizeSuperEvent;
|
|
@@ -163,6 +163,23 @@ export declare class MongoRepository {
|
|
|
163
163
|
};
|
|
164
164
|
id: string;
|
|
165
165
|
}): Promise<void>;
|
|
166
|
+
/**
|
|
167
|
+
* 興行イベントのsuperEventを最新の情報に同期する
|
|
168
|
+
*/
|
|
169
|
+
syncScreeningEventSeries2screeningEvents(params: {
|
|
170
|
+
project: {
|
|
171
|
+
id: string;
|
|
172
|
+
};
|
|
173
|
+
superEvent: {
|
|
174
|
+
/**
|
|
175
|
+
* 施設コンテンツID
|
|
176
|
+
*/
|
|
177
|
+
id: string;
|
|
178
|
+
};
|
|
179
|
+
startDate: {
|
|
180
|
+
$gte: Date;
|
|
181
|
+
};
|
|
182
|
+
}): Promise<void>;
|
|
166
183
|
deleteById(params: {
|
|
167
184
|
project: {
|
|
168
185
|
id: string;
|
package/lib/chevre/repo/event.js
CHANGED
|
@@ -23,6 +23,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
23
23
|
exports.MongoRepository = exports.PROJECTION_MINIMIZED_EVENT = void 0;
|
|
24
24
|
const uniqid = require("uniqid");
|
|
25
25
|
const factory = require("../factory");
|
|
26
|
+
const EventFactory = require("../factory/event");
|
|
26
27
|
const event_1 = require("./mongoose/schemas/event");
|
|
27
28
|
const errorHandler_1 = require("../errorHandler");
|
|
28
29
|
const settings_1 = require("../settings");
|
|
@@ -842,6 +843,36 @@ class MongoRepository {
|
|
|
842
843
|
.exec();
|
|
843
844
|
});
|
|
844
845
|
}
|
|
846
|
+
/**
|
|
847
|
+
* 興行イベントのsuperEventを最新の情報に同期する
|
|
848
|
+
*/
|
|
849
|
+
syncScreeningEventSeries2screeningEvents(params) {
|
|
850
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
851
|
+
const superEvents = yield this.search({
|
|
852
|
+
limit: 1,
|
|
853
|
+
page: 1,
|
|
854
|
+
typeOf: factory.eventType.ScreeningEventSeries,
|
|
855
|
+
id: { $eq: params.superEvent.id },
|
|
856
|
+
project: { id: { $eq: params.project.id } }
|
|
857
|
+
});
|
|
858
|
+
const superEventFromDB = superEvents.shift();
|
|
859
|
+
if (superEventFromDB === undefined) {
|
|
860
|
+
throw new factory.errors.NotFound(factory.eventType.ScreeningEventSeries);
|
|
861
|
+
}
|
|
862
|
+
const superEvent = EventFactory.minimizeSuperEvent({ superEventFromDB });
|
|
863
|
+
yield this.eventModel.updateMany({
|
|
864
|
+
typeOf: { $eq: factory.eventType.ScreeningEvent },
|
|
865
|
+
'project.id': { $eq: params.project.id },
|
|
866
|
+
'superEvent.id': { $exists: true, $eq: params.superEvent.id },
|
|
867
|
+
startDate: { $gte: params.startDate.$gte }
|
|
868
|
+
}, {
|
|
869
|
+
$set: {
|
|
870
|
+
superEvent
|
|
871
|
+
}
|
|
872
|
+
})
|
|
873
|
+
.exec();
|
|
874
|
+
});
|
|
875
|
+
}
|
|
845
876
|
deleteById(params) {
|
|
846
877
|
return __awaiter(this, void 0, void 0, function* () {
|
|
847
878
|
yield this.eventModel.findOneAndDelete({
|
|
@@ -82,9 +82,9 @@ declare const schema: Schema<any, import("mongoose").Model<any, any, any, any, a
|
|
|
82
82
|
remainingAttendeeCapacity?: number | undefined;
|
|
83
83
|
videoFormat?: any;
|
|
84
84
|
soundFormat?: any;
|
|
85
|
-
subtitleLanguage?: any;
|
|
86
|
-
dubLanguage?: any;
|
|
87
85
|
kanaName?: string | undefined;
|
|
86
|
+
dubLanguage?: any;
|
|
87
|
+
subtitleLanguage?: any;
|
|
88
88
|
}, import("mongoose").Document<unknown, {}, import("mongoose").FlatRecord<{
|
|
89
89
|
typeOf: string;
|
|
90
90
|
project: any;
|
|
@@ -116,9 +116,9 @@ declare const schema: Schema<any, import("mongoose").Model<any, any, any, any, a
|
|
|
116
116
|
remainingAttendeeCapacity?: number | undefined;
|
|
117
117
|
videoFormat?: any;
|
|
118
118
|
soundFormat?: any;
|
|
119
|
-
subtitleLanguage?: any;
|
|
120
|
-
dubLanguage?: any;
|
|
121
119
|
kanaName?: string | undefined;
|
|
120
|
+
dubLanguage?: any;
|
|
121
|
+
subtitleLanguage?: any;
|
|
122
122
|
}>> & Omit<import("mongoose").FlatRecord<{
|
|
123
123
|
typeOf: string;
|
|
124
124
|
project: any;
|
|
@@ -150,9 +150,9 @@ declare const schema: Schema<any, import("mongoose").Model<any, any, any, any, a
|
|
|
150
150
|
remainingAttendeeCapacity?: number | undefined;
|
|
151
151
|
videoFormat?: any;
|
|
152
152
|
soundFormat?: any;
|
|
153
|
-
subtitleLanguage?: any;
|
|
154
|
-
dubLanguage?: any;
|
|
155
153
|
kanaName?: string | undefined;
|
|
154
|
+
dubLanguage?: any;
|
|
155
|
+
subtitleLanguage?: any;
|
|
156
156
|
}> & Required<{
|
|
157
157
|
_id: string;
|
|
158
158
|
}>, never>>;
|
|
@@ -50,18 +50,18 @@ export declare function searchEventSeatOffersWithPaging(params: {
|
|
|
50
50
|
/**
|
|
51
51
|
* イベント変更時処理
|
|
52
52
|
*/
|
|
53
|
-
export declare function onEventChanged(params: {
|
|
54
|
-
|
|
55
|
-
|
|
53
|
+
export declare function onEventChanged(params: factory.task.onEventChanged.IData): (repos: {
|
|
54
|
+
event: EventRepo;
|
|
55
|
+
project: ProjectRepo;
|
|
56
|
+
task: TaskRepo;
|
|
57
|
+
}) => Promise<void>;
|
|
58
|
+
export declare function syncEventSeries2screeningEvents(params: {
|
|
56
59
|
project: {
|
|
57
60
|
id: string;
|
|
58
61
|
};
|
|
59
|
-
|
|
60
|
-
useInform?: boolean;
|
|
62
|
+
ids: string[];
|
|
61
63
|
}): (repos: {
|
|
62
64
|
event: EventRepo;
|
|
63
|
-
project: ProjectRepo;
|
|
64
|
-
task: TaskRepo;
|
|
65
65
|
}) => Promise<void>;
|
|
66
66
|
export declare function createAggregateScreeningEventIfNotExist(params: {
|
|
67
67
|
project: {
|
|
@@ -9,7 +9,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
9
9
|
});
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.createInformTasks = exports.createAggregateScreeningEventIfNotExist = exports.onEventChanged = exports.searchEventSeatOffersWithPaging = exports.addOffers2Seat = exports.product = exports.moneyTransfer = exports.eventServiceByCOA = exports.event = void 0;
|
|
12
|
+
exports.createInformTasks = exports.createAggregateScreeningEventIfNotExist = exports.syncEventSeries2screeningEvents = exports.onEventChanged = exports.searchEventSeatOffersWithPaging = exports.addOffers2Seat = exports.product = exports.moneyTransfer = exports.eventServiceByCOA = exports.event = void 0;
|
|
13
13
|
const moment = require("moment");
|
|
14
14
|
const factory = require("../factory");
|
|
15
15
|
const EventOfferService = require("./offer/event");
|
|
@@ -121,13 +121,11 @@ function searchEventSeatOffersWithPaging(params) {
|
|
|
121
121
|
});
|
|
122
122
|
}
|
|
123
123
|
exports.searchEventSeatOffersWithPaging = searchEventSeatOffersWithPaging;
|
|
124
|
-
// type IChangedEvent = factory.task.onEventChanged.IChangedEvent;
|
|
125
124
|
/**
|
|
126
125
|
* イベント変更時処理
|
|
127
126
|
*/
|
|
128
127
|
function onEventChanged(params) {
|
|
129
128
|
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
130
|
-
// const changedEvents = (Array.isArray(params.event)) ? params.event : [params.event];
|
|
131
129
|
if (params.id.length > 0) {
|
|
132
130
|
// ScreeningEventであれば集計タスク
|
|
133
131
|
if (params.typeOf === factory.eventType.ScreeningEvent) {
|
|
@@ -148,10 +146,36 @@ function onEventChanged(params) {
|
|
|
148
146
|
typeOf: params.typeOf
|
|
149
147
|
})(repos);
|
|
150
148
|
}
|
|
149
|
+
if (params.useSync === true) {
|
|
150
|
+
switch (params.typeOf) {
|
|
151
|
+
case factory.eventType.ScreeningEventSeries:
|
|
152
|
+
// 施設コンテンツを興行イベントへ同期(2023-07-28~)
|
|
153
|
+
yield syncEventSeries2screeningEvents({
|
|
154
|
+
project: { id: params.project.id },
|
|
155
|
+
ids: params.id
|
|
156
|
+
})(repos);
|
|
157
|
+
break;
|
|
158
|
+
default:
|
|
159
|
+
// no op
|
|
160
|
+
}
|
|
161
|
+
}
|
|
151
162
|
}
|
|
152
163
|
});
|
|
153
164
|
}
|
|
154
165
|
exports.onEventChanged = onEventChanged;
|
|
166
|
+
function syncEventSeries2screeningEvents(params) {
|
|
167
|
+
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
168
|
+
const now = new Date();
|
|
169
|
+
for (const eventSeriesId of params.ids) {
|
|
170
|
+
yield repos.event.syncScreeningEventSeries2screeningEvents({
|
|
171
|
+
project: { id: params.project.id },
|
|
172
|
+
superEvent: { id: eventSeriesId },
|
|
173
|
+
startDate: { $gte: now }
|
|
174
|
+
});
|
|
175
|
+
}
|
|
176
|
+
});
|
|
177
|
+
}
|
|
178
|
+
exports.syncEventSeries2screeningEvents = syncEventSeries2screeningEvents;
|
|
155
179
|
function createAggregateScreeningEventIfNotExist(params) {
|
|
156
180
|
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
157
181
|
let aggregateTasks = [];
|
package/lib/chevre/service.d.ts
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
* service module
|
|
3
3
|
*/
|
|
4
4
|
import * as AccountTransactionIdentifierFactory from './factory/accountTransactionIdentifier';
|
|
5
|
+
import * as EventFactory from './factory/event';
|
|
5
6
|
import * as OrderFactory from './factory/order';
|
|
6
7
|
import * as ReservedAgentIdentifireNamesFactory from './factory/reservedAgentIdentifireNames';
|
|
7
8
|
import * as AccountService from './service/account';
|
|
@@ -46,6 +47,7 @@ export import transaction = TransactionService;
|
|
|
46
47
|
export import util = UtilService;
|
|
47
48
|
export declare namespace factory {
|
|
48
49
|
export import accountTransactionIdentifier = AccountTransactionIdentifierFactory;
|
|
50
|
+
export import event = EventFactory;
|
|
49
51
|
export import order = OrderFactory;
|
|
50
52
|
export import reservedAgentIdentifireNames = ReservedAgentIdentifireNamesFactory;
|
|
51
53
|
}
|
package/lib/chevre/service.js
CHANGED
|
@@ -5,6 +5,7 @@ exports.factory = exports.util = exports.transaction = exports.task = exports.re
|
|
|
5
5
|
* service module
|
|
6
6
|
*/
|
|
7
7
|
const AccountTransactionIdentifierFactory = require("./factory/accountTransactionIdentifier");
|
|
8
|
+
const EventFactory = require("./factory/event");
|
|
8
9
|
const OrderFactory = require("./factory/order");
|
|
9
10
|
const ReservedAgentIdentifireNamesFactory = require("./factory/reservedAgentIdentifireNames");
|
|
10
11
|
const AccountService = require("./service/account");
|
|
@@ -52,6 +53,8 @@ var factory;
|
|
|
52
53
|
(function (factory) {
|
|
53
54
|
factory.accountTransactionIdentifier = AccountTransactionIdentifierFactory;
|
|
54
55
|
// tslint:disable-next-line:no-shadowed-variable
|
|
56
|
+
factory.event = EventFactory;
|
|
57
|
+
// tslint:disable-next-line:no-shadowed-variable
|
|
55
58
|
factory.order = OrderFactory;
|
|
56
59
|
factory.reservedAgentIdentifireNames = ReservedAgentIdentifireNamesFactory;
|
|
57
60
|
})(factory = exports.factory || (exports.factory = {}));
|
package/package.json
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
}
|
|
10
10
|
],
|
|
11
11
|
"dependencies": {
|
|
12
|
-
"@chevre/factory": "4.
|
|
12
|
+
"@chevre/factory": "4.319.0",
|
|
13
13
|
"@cinerino/sdk": "3.162.0-alpha.6",
|
|
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.5.0-alpha.
|
|
120
|
+
"version": "21.5.0-alpha.1"
|
|
121
121
|
}
|