@chevre/domain 21.30.0-alpha.12 → 21.30.0-alpha.14
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.
|
@@ -17,8 +17,8 @@ async function main() {
|
|
|
17
17
|
const updateResult = await actionRepo.unsetUnnecessaryFields({
|
|
18
18
|
filter: {
|
|
19
19
|
// typeOf: { $eq: chevre.factory.actionType.OrderAction },
|
|
20
|
-
'agent.typeOf': { $exists: true, $eq: chevre.factory.creativeWorkType.WebApplication },
|
|
21
|
-
|
|
20
|
+
// 'agent.typeOf': { $exists: true, $eq: chevre.factory.creativeWorkType.WebApplication },
|
|
21
|
+
'agent.typeOf': { $exists: true, $eq: chevre.factory.personType.Person },
|
|
22
22
|
startDate: {
|
|
23
23
|
// $exists: true,
|
|
24
24
|
$gte: moment()
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
// tslint:disable:no-console
|
|
2
|
+
import * as moment from 'moment-timezone';
|
|
3
|
+
|
|
4
|
+
const importFrom = '2024-04-23T22:45:00.414Z';
|
|
5
|
+
const importThrough = '2024-04-25T22:45:00.414Z';
|
|
6
|
+
const targetImportFrom = moment(importFrom)
|
|
7
|
+
.tz('Asia/Tokyo')
|
|
8
|
+
.startOf('day');
|
|
9
|
+
const targetImportThrough = moment(importThrough)
|
|
10
|
+
.tz('Asia/Tokyo')
|
|
11
|
+
.endOf('day');
|
|
12
|
+
console.log(targetImportFrom.toDate(), targetImportThrough.toDate());
|
|
13
|
+
|
|
14
|
+
const targetImportFrom2 = moment(`${moment(importFrom)
|
|
15
|
+
.tz('Asia/Tokyo')
|
|
16
|
+
.format('YYYY-MM-DD')}T00:00:00+09:00`);
|
|
17
|
+
const targetImportThrough2 = moment(`${moment(importThrough)
|
|
18
|
+
.tz('Asia/Tokyo')
|
|
19
|
+
.format('YYYY-MM-DD')}T00:00:00+09:00`)
|
|
20
|
+
.add(1, 'day');
|
|
21
|
+
console.log(targetImportFrom2.toDate(), targetImportThrough2.toDate());
|
|
@@ -77,19 +77,25 @@ function importFromCOA(params) {
|
|
|
77
77
|
// tslint:disable-next-line:max-func-body-length
|
|
78
78
|
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
79
79
|
const project = params.project;
|
|
80
|
-
const targetImportFrom = moment(`${moment(params.importFrom)
|
|
80
|
+
// const targetImportFrom = moment(`${moment(params.importFrom)
|
|
81
|
+
// .tz('Asia/Tokyo')
|
|
82
|
+
// .format('YYYY-MM-DD')}T00:00:00+09:00`);
|
|
83
|
+
// const targetImportThrough = moment(`${moment(params.importThrough)
|
|
84
|
+
// .tz('Asia/Tokyo')
|
|
85
|
+
// .format('YYYY-MM-DD')}T00:00:00+09:00`)
|
|
86
|
+
// .add(1, 'day');
|
|
87
|
+
const targetImportFrom = moment(params.importFrom)
|
|
81
88
|
.tz('Asia/Tokyo')
|
|
82
|
-
.
|
|
83
|
-
const targetImportThrough = moment(
|
|
89
|
+
.startOf('day');
|
|
90
|
+
const targetImportThrough = moment(params.importThrough)
|
|
84
91
|
.tz('Asia/Tokyo')
|
|
85
|
-
.
|
|
86
|
-
.add(1, 'day');
|
|
92
|
+
.endOf('day');
|
|
87
93
|
const begin = moment(targetImportFrom)
|
|
88
94
|
.add(-1, 'day') // 深夜帯スケジュールが前日検索の結果に含まれるため
|
|
89
95
|
.tz('Asia/Tokyo')
|
|
90
96
|
.format('YYYYMMDD'); // COAは日本時間で判断
|
|
91
97
|
const end = moment(targetImportThrough)
|
|
92
|
-
.add(-1, 'day')
|
|
98
|
+
// .add(-1, 'day')
|
|
93
99
|
.tz('Asia/Tokyo')
|
|
94
100
|
.format('YYYYMMDD'); // COAは日本時間で判断
|
|
95
101
|
debug('importing screening events...', targetImportFrom, targetImportThrough, begin, end);
|
|
@@ -97,8 +103,13 @@ function importFromCOA(params) {
|
|
|
97
103
|
project: { typeOf: factory.organizationType.Project, id: params.project.id },
|
|
98
104
|
typeOf: factory.actionType.UpdateAction,
|
|
99
105
|
agent: { typeOf: factory.organizationType.Project, id: params.project.id },
|
|
100
|
-
object: Object.assign(Object.assign({}, params), {
|
|
101
|
-
|
|
106
|
+
object: Object.assign(Object.assign({}, params), { typeOf: factory.eventType.ScreeningEvent }),
|
|
107
|
+
instrument: {
|
|
108
|
+
begin,
|
|
109
|
+
end,
|
|
110
|
+
typeOf: 'WebAPI',
|
|
111
|
+
identifier: factory.service.webAPI.Identifier.COA
|
|
112
|
+
}
|
|
102
113
|
};
|
|
103
114
|
const action = yield repos.action.start(actionAttributes);
|
|
104
115
|
let savedScreeningEventsCount = 0;
|
|
@@ -156,13 +167,13 @@ function importFromCOA(params) {
|
|
|
156
167
|
// イベント永続化
|
|
157
168
|
const screeningEvents = yield saveScreeningEvents({
|
|
158
169
|
locationBranchCode: params.locationBranchCode,
|
|
159
|
-
// movieTheater: movieTheater,
|
|
160
170
|
screeningRooms,
|
|
161
171
|
screeningEventSerieses: screeningEventSerieses,
|
|
162
172
|
project: project,
|
|
163
173
|
targetImportFrom: targetImportFrom.toDate(),
|
|
164
174
|
targetImportThrough: targetImportThrough.toDate(),
|
|
165
|
-
seller: { id: seller.id }
|
|
175
|
+
seller: { id: seller.id },
|
|
176
|
+
instrument: { begin, end }
|
|
166
177
|
})(repos);
|
|
167
178
|
savedScreeningEventsCount = screeningEvents.length;
|
|
168
179
|
// COAから削除されたイベントをキャンセル済ステータスへ変更
|
|
@@ -330,7 +341,6 @@ function saveScreeningEvents(params) {
|
|
|
330
341
|
}
|
|
331
342
|
function createScreeningEvents(params) {
|
|
332
343
|
return () => __awaiter(this, void 0, void 0, function* () {
|
|
333
|
-
// const movieTheater = params.movieTheater;
|
|
334
344
|
const screeningEventSerieses = params.screeningEventSerieses;
|
|
335
345
|
const project = params.project;
|
|
336
346
|
const masterService = new COA.service.Master({
|
|
@@ -340,14 +350,8 @@ function createScreeningEvents(params) {
|
|
|
340
350
|
// COAからイベント取得;
|
|
341
351
|
const schedulesFromCOA = yield masterService.schedule({
|
|
342
352
|
theaterCode: params.locationBranchCode,
|
|
343
|
-
begin:
|
|
344
|
-
|
|
345
|
-
.tz('Asia/Tokyo')
|
|
346
|
-
.format('YYYYMMDD'),
|
|
347
|
-
end: moment(params.targetImportThrough)
|
|
348
|
-
.add(-1, 'day')
|
|
349
|
-
.tz('Asia/Tokyo')
|
|
350
|
-
.format('YYYYMMDD') // COAは日本時間で判断
|
|
353
|
+
begin: params.instrument.begin,
|
|
354
|
+
end: params.instrument.end // COAは日本時間で判断
|
|
351
355
|
});
|
|
352
356
|
// COAから区分マスター抽出
|
|
353
357
|
const serviceKubuns = yield masterService.kubunName({
|
|
@@ -392,8 +396,14 @@ function createScreeningEvents(params) {
|
|
|
392
396
|
acousticKubuns: acousticKubuns,
|
|
393
397
|
seller: params.seller
|
|
394
398
|
});
|
|
395
|
-
|
|
399
|
+
// インポート期間で確実に絞る(2024-04-25~)
|
|
400
|
+
const isStartDateInTarget = moment(screeningEvent.startDate)
|
|
401
|
+
.isBetween(params.targetImportFrom, params.targetImportThrough, 'second', '[]');
|
|
402
|
+
if (isStartDateInTarget) {
|
|
403
|
+
screeningEvents.push(screeningEvent);
|
|
404
|
+
}
|
|
396
405
|
});
|
|
406
|
+
debug('createScreeningEvents processed', params.targetImportFrom, params.targetImportThrough, params.instrument.begin, params.instrument.end, 'schedulesFromCOA.length:', schedulesFromCOA.length, 'screeningEvents.length:', screeningEvents.length);
|
|
397
407
|
return screeningEvents;
|
|
398
408
|
});
|
|
399
409
|
}
|
package/package.json
CHANGED