@chevre/domain 26.0.0-alpha.27 → 26.0.0-alpha.29
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/repo/action.d.ts +3 -19
- package/lib/chevre/repo/action.js +0 -298
- package/lib/chevre/repo/adminAssetTransaction.d.ts +0 -6
- package/lib/chevre/repo/adminAssetTransaction.js +0 -13
- package/lib/chevre/repo/adminTask.d.ts +0 -8
- package/lib/chevre/repo/adminTask.js +0 -16
- package/lib/chevre/repo/aggregation.d.ts +0 -8
- package/lib/chevre/repo/aggregation.js +0 -10
- package/lib/chevre/repo/authorization.d.ts +0 -6
- package/lib/chevre/repo/authorization.js +0 -12
- package/lib/chevre/repo/message.d.ts +0 -7
- package/lib/chevre/repo/message.js +0 -38
- package/lib/chevre/repo/mongoose/schemas/action.d.ts +1 -1
- package/lib/chevre/repo/mongoose/schemas/action.js +1 -1
- package/lib/chevre/repo/mongoose/schemas/assetTransaction.js +85 -76
- package/lib/chevre/repo/mongoose/schemas/updateAction.d.ts +12 -0
- package/lib/chevre/repo/mongoose/schemas/updateAction.js +107 -0
- package/lib/chevre/repo/ticket.d.ts +0 -6
- package/lib/chevre/repo/ticket.js +0 -11
- package/lib/chevre/repo/updateAction.d.ts +56 -0
- package/lib/chevre/repo/updateAction.js +173 -0
- package/lib/chevre/repository.d.ts +5 -0
- package/lib/chevre/repository.js +12 -1
- package/lib/chevre/service/event/processUpdateMovieTheater.d.ts +2 -2
- package/lib/chevre/service/event/processUpdateMovieTheater.js +3 -3
- package/lib/chevre/service/event.d.ts +2 -2
- package/lib/chevre/service/event.js +3 -3
- package/lib/chevre/service/task/deleteTransaction.js +4 -35
- package/lib/chevre/service/task/importEventsFromCOA.js +2 -2
- package/lib/chevre/service/task/onResourceDeleted/deleteResourcesByAggregateOffer.d.ts +2 -2
- package/lib/chevre/service/task/onResourceDeleted/deleteResourcesByAggregateOffer.js +4 -4
- package/lib/chevre/service/task/onResourceDeleted/deleteResourcesByEventSeries.d.ts +2 -2
- package/lib/chevre/service/task/onResourceDeleted/deleteResourcesByEventSeries.js +4 -4
- package/lib/chevre/service/task/onResourceDeleted/deleteResourcesByMovieTheater.d.ts +2 -2
- package/lib/chevre/service/task/onResourceDeleted/deleteResourcesByMovieTheater.js +4 -4
- package/lib/chevre/service/task/onResourceDeleted/deleteResourcesByOfferCatalog.d.ts +2 -2
- package/lib/chevre/service/task/onResourceDeleted/deleteResourcesByOfferCatalog.js +4 -4
- package/lib/chevre/service/task/onResourceDeleted/deleteResourcesByProduct.d.ts +2 -2
- package/lib/chevre/service/task/onResourceDeleted/deleteResourcesByProduct.js +4 -4
- package/lib/chevre/service/task/onResourceDeleted/deleteResourcesByRoom.d.ts +2 -2
- package/lib/chevre/service/task/onResourceDeleted/deleteResourcesByRoom.js +4 -4
- package/lib/chevre/service/task/onResourceDeleted/deleteResourcesBySeller.d.ts +2 -2
- package/lib/chevre/service/task/onResourceDeleted/deleteResourcesBySeller.js +4 -4
- package/lib/chevre/service/task/onResourceDeleted.js +2 -3
- package/lib/chevre/service/task/syncResourcesFromCOA.js +26 -18
- package/lib/chevre/service/transaction/deleteTransaction.d.ts +2 -0
- package/lib/chevre/service/transaction/deleteTransaction.js +3 -3
- package/package.json +2 -2
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* マスターデータ同期サービス
|
|
3
3
|
*/
|
|
4
4
|
import type { COA } from '@motionpicture/coa-service';
|
|
5
|
-
import type {
|
|
5
|
+
import type { UpdateActionRepo } from '../repo/updateAction';
|
|
6
6
|
import type { CategoryCodeRepo } from '../repo/categoryCode';
|
|
7
7
|
import type { CreativeWorkRepo } from '../repo/creativeWork';
|
|
8
8
|
import type { EventRepo } from '../repo/event';
|
|
@@ -17,7 +17,7 @@ import { saveScreeningEventSeries } from './event/saveScreeningEventSeries';
|
|
|
17
17
|
* イベントをインポートする
|
|
18
18
|
*/
|
|
19
19
|
declare function importFromCOA(params: IImportFromCOAParams): (repos: {
|
|
20
|
-
|
|
20
|
+
updateAction: UpdateActionRepo;
|
|
21
21
|
categoryCode: CategoryCodeRepo;
|
|
22
22
|
creativeWork: CreativeWorkRepo;
|
|
23
23
|
event: EventRepo;
|
|
@@ -70,7 +70,7 @@ function importFromCOA(params) {
|
|
|
70
70
|
instrument,
|
|
71
71
|
targetCollection: { typeOf: factory_1.factory.eventType.ScreeningEvent }
|
|
72
72
|
};
|
|
73
|
-
const action = await repos.
|
|
73
|
+
const action = await repos.updateAction.startUpdateAction(actionAttributes);
|
|
74
74
|
let savedScreeningEventsCount = 0;
|
|
75
75
|
let savedScreeningEventSeriesCount = 0;
|
|
76
76
|
let cancelledIds = [];
|
|
@@ -131,7 +131,7 @@ function importFromCOA(params) {
|
|
|
131
131
|
}
|
|
132
132
|
catch (error) {
|
|
133
133
|
try {
|
|
134
|
-
await repos.
|
|
134
|
+
await repos.updateAction.giveUpUpdateAction({ typeOf: action.typeOf, id: action.id, error });
|
|
135
135
|
}
|
|
136
136
|
catch (__) {
|
|
137
137
|
// 失敗したら仕方ない
|
|
@@ -144,7 +144,7 @@ function importFromCOA(params) {
|
|
|
144
144
|
savedScreeningEventSeriesCount,
|
|
145
145
|
...(processTime !== undefined) ? { processTime } : undefined
|
|
146
146
|
};
|
|
147
|
-
await repos.
|
|
147
|
+
await repos.updateAction.completeUpdateAction({ typeOf: action.typeOf, id: action.id, result: actionResult });
|
|
148
148
|
};
|
|
149
149
|
}
|
|
150
150
|
function cancelDeletedEvents(params) {
|
|
@@ -1,42 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
-
var ownKeys = function(o) {
|
|
20
|
-
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
-
var ar = [];
|
|
22
|
-
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
-
return ar;
|
|
24
|
-
};
|
|
25
|
-
return ownKeys(o);
|
|
26
|
-
};
|
|
27
|
-
return function (mod) {
|
|
28
|
-
if (mod && mod.__esModule) return mod;
|
|
29
|
-
var result = {};
|
|
30
|
-
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
-
__setModuleDefault(result, mod);
|
|
32
|
-
return result;
|
|
33
|
-
};
|
|
34
|
-
})();
|
|
35
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
3
|
exports.call = call;
|
|
37
4
|
const acceptedOffer_1 = require("../../repo/acceptedOffer");
|
|
38
5
|
const accountingReport_1 = require("../../repo/accountingReport");
|
|
39
6
|
const action_1 = require("../../repo/action");
|
|
7
|
+
const updateAction_1 = require("../../repo/updateAction");
|
|
40
8
|
const adminTransaction_1 = require("../../repo/adminTransaction");
|
|
41
9
|
const assetTransaction_1 = require("../../repo/assetTransaction");
|
|
42
10
|
const note_1 = require("../../repo/note");
|
|
@@ -44,17 +12,18 @@ const order_1 = require("../../repo/order");
|
|
|
44
12
|
const reservation_1 = require("../../repo/reservation");
|
|
45
13
|
const placeOrder_1 = require("../../repo/transaction/placeOrder");
|
|
46
14
|
const returnOrder_1 = require("../../repo/transaction/returnOrder");
|
|
47
|
-
const
|
|
15
|
+
const transaction_1 = require("../transaction");
|
|
48
16
|
/**
|
|
49
17
|
* タスク実行関数
|
|
50
18
|
*/
|
|
51
19
|
function call(params) {
|
|
52
20
|
return async ({ connection }) => {
|
|
53
21
|
const { data } = params;
|
|
54
|
-
await
|
|
22
|
+
await (0, transaction_1.deleteTransaction)(data)({
|
|
55
23
|
acceptedOffer: new acceptedOffer_1.AcceptedOfferRepo(connection),
|
|
56
24
|
accountingReport: new accountingReport_1.AccountingReportRepo(connection),
|
|
57
25
|
action: new action_1.ActionRepo(connection),
|
|
26
|
+
updateAction: new updateAction_1.UpdateActionRepo(connection),
|
|
58
27
|
adminTransaction: new adminTransaction_1.AdminTransactionRepo(connection),
|
|
59
28
|
assetTransaction: new assetTransaction_1.AssetTransactionRepo(connection),
|
|
60
29
|
note: new note_1.NoteRepo(connection),
|
|
@@ -35,7 +35,7 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
35
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
36
|
exports.call = call;
|
|
37
37
|
const coa_service_1 = require("@motionpicture/coa-service");
|
|
38
|
-
const
|
|
38
|
+
const updateAction_1 = require("../../repo/updateAction");
|
|
39
39
|
const categoryCode_1 = require("../../repo/categoryCode");
|
|
40
40
|
const creativeWork_1 = require("../../repo/creativeWork");
|
|
41
41
|
const event_1 = require("../../repo/event");
|
|
@@ -71,7 +71,7 @@ function call(params) {
|
|
|
71
71
|
...params.data,
|
|
72
72
|
project: { id: params.project.id, typeOf: factory_1.factory.organizationType.Project }
|
|
73
73
|
})({
|
|
74
|
-
|
|
74
|
+
updateAction: new updateAction_1.UpdateActionRepo(connection),
|
|
75
75
|
categoryCode: new categoryCode_1.CategoryCodeRepo(connection),
|
|
76
76
|
creativeWork: new creativeWork_1.CreativeWorkRepo(connection),
|
|
77
77
|
event: new event_1.EventRepo(connection),
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { UpdateActionRepo } from '../../../repo/updateAction';
|
|
2
2
|
import type { OfferCatalogRepo } from '../../../repo/offerCatalog';
|
|
3
3
|
import type { OfferCatalogItemRepo } from '../../../repo/offerCatalogItem';
|
|
4
4
|
export declare function deleteResourcesByAggregateOffer(params: {
|
|
@@ -7,7 +7,7 @@ export declare function deleteResourcesByAggregateOffer(params: {
|
|
|
7
7
|
};
|
|
8
8
|
ids: string[];
|
|
9
9
|
}): (repos: {
|
|
10
|
-
|
|
10
|
+
updateAction: UpdateActionRepo;
|
|
11
11
|
offerCatalog: OfferCatalogRepo;
|
|
12
12
|
offerCatalogItem: OfferCatalogItemRepo;
|
|
13
13
|
}) => Promise<void>;
|
|
@@ -14,8 +14,8 @@ function deleteResourcesByAggregateOffer(params) {
|
|
|
14
14
|
project: { id: params.project.id, typeOf: factory_1.factory.organizationType.Project },
|
|
15
15
|
typeOf: factory_1.factory.actionType.DeleteAction
|
|
16
16
|
};
|
|
17
|
-
let deleteResult;
|
|
18
|
-
const action = await repos.
|
|
17
|
+
let deleteResult;
|
|
18
|
+
const action = await repos.updateAction.startUpdateAction(deleteActionAttributes);
|
|
19
19
|
try {
|
|
20
20
|
// カタログからpullItemListElement
|
|
21
21
|
const updateCatalogResult = await repos.offerCatalog.pullItemListElement({
|
|
@@ -31,14 +31,14 @@ function deleteResourcesByAggregateOffer(params) {
|
|
|
31
31
|
}
|
|
32
32
|
catch (error) {
|
|
33
33
|
try {
|
|
34
|
-
await repos.
|
|
34
|
+
await repos.updateAction.giveUpUpdateAction({ typeOf: deleteActionAttributes.typeOf, id: action.id, error });
|
|
35
35
|
}
|
|
36
36
|
catch (_) {
|
|
37
37
|
// no op
|
|
38
38
|
}
|
|
39
39
|
throw error;
|
|
40
40
|
}
|
|
41
|
-
await repos.
|
|
41
|
+
await repos.updateAction.completeUpdateAction({ typeOf: deleteActionAttributes.typeOf, id: action.id, result: deleteResult });
|
|
42
42
|
}
|
|
43
43
|
};
|
|
44
44
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { UpdateActionRepo } from '../../../repo/updateAction';
|
|
2
2
|
import type { EventRepo } from '../../../repo/event';
|
|
3
3
|
export declare function deleteResourcesByEventSeries(params: {
|
|
4
4
|
project: {
|
|
@@ -6,6 +6,6 @@ export declare function deleteResourcesByEventSeries(params: {
|
|
|
6
6
|
};
|
|
7
7
|
ids: string[];
|
|
8
8
|
}): (repos: {
|
|
9
|
-
|
|
9
|
+
updateAction: UpdateActionRepo;
|
|
10
10
|
event: EventRepo;
|
|
11
11
|
}) => Promise<void>;
|
|
@@ -14,8 +14,8 @@ function deleteResourcesByEventSeries(params) {
|
|
|
14
14
|
project: { id: params.project.id, typeOf: factory_1.factory.organizationType.Project },
|
|
15
15
|
typeOf: factory_1.factory.actionType.DeleteAction
|
|
16
16
|
};
|
|
17
|
-
let deleteResult;
|
|
18
|
-
const action = await repos.
|
|
17
|
+
let deleteResult;
|
|
18
|
+
const action = await repos.updateAction.startUpdateAction(deleteActionAttributes);
|
|
19
19
|
try {
|
|
20
20
|
// イベント削除
|
|
21
21
|
const deleteScreeningEventResult = await repos.event.deleteManyBySuperEventId({
|
|
@@ -28,14 +28,14 @@ function deleteResourcesByEventSeries(params) {
|
|
|
28
28
|
}
|
|
29
29
|
catch (error) {
|
|
30
30
|
try {
|
|
31
|
-
await repos.
|
|
31
|
+
await repos.updateAction.giveUpUpdateAction({ typeOf: deleteActionAttributes.typeOf, id: action.id, error });
|
|
32
32
|
}
|
|
33
33
|
catch (_) {
|
|
34
34
|
// no op
|
|
35
35
|
}
|
|
36
36
|
throw error;
|
|
37
37
|
}
|
|
38
|
-
await repos.
|
|
38
|
+
await repos.updateAction.completeUpdateAction({ typeOf: deleteActionAttributes.typeOf, id: action.id, result: deleteResult });
|
|
39
39
|
}
|
|
40
40
|
};
|
|
41
41
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { UpdateActionRepo } from '../../../repo/updateAction';
|
|
2
2
|
import type { EventRepo } from '../../../repo/event';
|
|
3
3
|
import type { EventSeriesRepo } from '../../../repo/eventSeries';
|
|
4
4
|
import type { ScreeningRoomRepo } from '../../../repo/place/screeningRoom';
|
|
@@ -8,7 +8,7 @@ export declare function deleteResourcesByMovieTheater(params: {
|
|
|
8
8
|
};
|
|
9
9
|
ids: string[];
|
|
10
10
|
}): (repos: {
|
|
11
|
-
|
|
11
|
+
updateAction: UpdateActionRepo;
|
|
12
12
|
event: EventRepo;
|
|
13
13
|
eventSeries: EventSeriesRepo;
|
|
14
14
|
screeningRoom: ScreeningRoomRepo;
|
|
@@ -14,8 +14,8 @@ function deleteResourcesByMovieTheater(params) {
|
|
|
14
14
|
project: { id: params.project.id, typeOf: factory_1.factory.organizationType.Project },
|
|
15
15
|
typeOf: factory_1.factory.actionType.DeleteAction
|
|
16
16
|
};
|
|
17
|
-
let deleteResult;
|
|
18
|
-
const action = await repos.
|
|
17
|
+
let deleteResult;
|
|
18
|
+
const action = await repos.updateAction.startUpdateAction(deleteActionAttributes);
|
|
19
19
|
try {
|
|
20
20
|
// イベント削除
|
|
21
21
|
const deleteScreeningEventResult = await repos.event.deleteManyBySuperEventLocationId({
|
|
@@ -36,14 +36,14 @@ function deleteResourcesByMovieTheater(params) {
|
|
|
36
36
|
}
|
|
37
37
|
catch (error) {
|
|
38
38
|
try {
|
|
39
|
-
await repos.
|
|
39
|
+
await repos.updateAction.giveUpUpdateAction({ typeOf: deleteActionAttributes.typeOf, id: action.id, error });
|
|
40
40
|
}
|
|
41
41
|
catch (_) {
|
|
42
42
|
// no op
|
|
43
43
|
}
|
|
44
44
|
throw error;
|
|
45
45
|
}
|
|
46
|
-
await repos.
|
|
46
|
+
await repos.updateAction.completeUpdateAction({ typeOf: deleteActionAttributes.typeOf, id: action.id, result: deleteResult });
|
|
47
47
|
}
|
|
48
48
|
};
|
|
49
49
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { UpdateActionRepo } from '../../../repo/updateAction';
|
|
2
2
|
import type { AggregateOfferRepo } from '../../../repo/aggregateOffer';
|
|
3
3
|
import type { EventRepo } from '../../../repo/event';
|
|
4
4
|
import type { OfferCatalogRepo } from '../../../repo/offerCatalog';
|
|
@@ -9,7 +9,7 @@ export declare function deleteResourcesByOfferCatalog(params: {
|
|
|
9
9
|
};
|
|
10
10
|
ids: string[];
|
|
11
11
|
}): (repos: {
|
|
12
|
-
|
|
12
|
+
updateAction: UpdateActionRepo;
|
|
13
13
|
aggregateOffer: AggregateOfferRepo;
|
|
14
14
|
event: EventRepo;
|
|
15
15
|
offerCatalog: OfferCatalogRepo;
|
|
@@ -14,8 +14,8 @@ function deleteResourcesByOfferCatalog(params) {
|
|
|
14
14
|
project: { id: params.project.id, typeOf: factory_1.factory.organizationType.Project },
|
|
15
15
|
typeOf: factory_1.factory.actionType.DeleteAction
|
|
16
16
|
};
|
|
17
|
-
let deleteResult;
|
|
18
|
-
const action = await repos.
|
|
17
|
+
let deleteResult;
|
|
18
|
+
const action = await repos.updateAction.startUpdateAction(deleteActionAttributes);
|
|
19
19
|
try {
|
|
20
20
|
// カタログからプロダクト検索
|
|
21
21
|
const productsWithCatalog = await repos.product.projectFields({
|
|
@@ -53,14 +53,14 @@ function deleteResourcesByOfferCatalog(params) {
|
|
|
53
53
|
}
|
|
54
54
|
catch (error) {
|
|
55
55
|
try {
|
|
56
|
-
await repos.
|
|
56
|
+
await repos.updateAction.giveUpUpdateAction({ typeOf: deleteActionAttributes.typeOf, id: action.id, error });
|
|
57
57
|
}
|
|
58
58
|
catch (_) {
|
|
59
59
|
// no op
|
|
60
60
|
}
|
|
61
61
|
throw error;
|
|
62
62
|
}
|
|
63
|
-
await repos.
|
|
63
|
+
await repos.updateAction.completeUpdateAction({ typeOf: deleteActionAttributes.typeOf, id: action.id, result: deleteResult });
|
|
64
64
|
}
|
|
65
65
|
};
|
|
66
66
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { factory } from '../../../factory';
|
|
2
|
-
import type {
|
|
2
|
+
import type { UpdateActionRepo } from '../../../repo/updateAction';
|
|
3
3
|
import type { AggregateOfferRepo } from '../../../repo/aggregateOffer';
|
|
4
4
|
import type { EventRepo } from '../../../repo/event';
|
|
5
5
|
import type { NoteRepo } from '../../../repo/note';
|
|
@@ -11,7 +11,7 @@ export declare function deleteResourcesByProduct(params: {
|
|
|
11
11
|
ids: string[];
|
|
12
12
|
typeOf: factory.product.ProductType;
|
|
13
13
|
}): (repos: {
|
|
14
|
-
|
|
14
|
+
updateAction: UpdateActionRepo;
|
|
15
15
|
aggregateOffer: AggregateOfferRepo;
|
|
16
16
|
event: EventRepo;
|
|
17
17
|
note: NoteRepo;
|
|
@@ -14,8 +14,8 @@ function deleteResourcesByProduct(params) {
|
|
|
14
14
|
project: { id: params.project.id, typeOf: factory_1.factory.organizationType.Project },
|
|
15
15
|
typeOf: factory_1.factory.actionType.DeleteAction
|
|
16
16
|
};
|
|
17
|
-
let deleteResult;
|
|
18
|
-
const action = await repos.
|
|
17
|
+
let deleteResult;
|
|
18
|
+
const action = await repos.updateAction.startUpdateAction(deleteActionAttributes);
|
|
19
19
|
try {
|
|
20
20
|
// 興行を設定されたイベント削除
|
|
21
21
|
const deleteEventResult = await repos.event.deleteManyEventsByItemOfferedId({
|
|
@@ -35,14 +35,14 @@ function deleteResourcesByProduct(params) {
|
|
|
35
35
|
}
|
|
36
36
|
catch (error) {
|
|
37
37
|
try {
|
|
38
|
-
await repos.
|
|
38
|
+
await repos.updateAction.giveUpUpdateAction({ typeOf: deleteActionAttributes.typeOf, id: action.id, error });
|
|
39
39
|
}
|
|
40
40
|
catch (_) {
|
|
41
41
|
// no op
|
|
42
42
|
}
|
|
43
43
|
throw error;
|
|
44
44
|
}
|
|
45
|
-
await repos.
|
|
45
|
+
await repos.updateAction.completeUpdateAction({ typeOf: deleteActionAttributes.typeOf, id: action.id, result: deleteResult });
|
|
46
46
|
}
|
|
47
47
|
};
|
|
48
48
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { UpdateActionRepo } from '../../../repo/updateAction';
|
|
2
2
|
import type { EventRepo } from '../../../repo/event';
|
|
3
3
|
export declare function deleteResourcesByRoom(params: {
|
|
4
4
|
project: {
|
|
@@ -15,6 +15,6 @@ export declare function deleteResourcesByRoom(params: {
|
|
|
15
15
|
id: string;
|
|
16
16
|
};
|
|
17
17
|
}): (repos: {
|
|
18
|
-
|
|
18
|
+
updateAction: UpdateActionRepo;
|
|
19
19
|
event: EventRepo;
|
|
20
20
|
}) => Promise<void>;
|
|
@@ -15,8 +15,8 @@ function deleteResourcesByRoom(params) {
|
|
|
15
15
|
project: { id: params.project.id, typeOf: factory_1.factory.organizationType.Project },
|
|
16
16
|
typeOf: factory_1.factory.actionType.DeleteAction
|
|
17
17
|
};
|
|
18
|
-
let deleteResult;
|
|
19
|
-
const action = await repos.
|
|
18
|
+
let deleteResult;
|
|
19
|
+
const action = await repos.updateAction.startUpdateAction(deleteActionAttributes);
|
|
20
20
|
try {
|
|
21
21
|
// イベント削除
|
|
22
22
|
const deleteScreeningEventResult = await repos.event.deleteManyEventsByScreeningRoom({
|
|
@@ -30,13 +30,13 @@ function deleteResourcesByRoom(params) {
|
|
|
30
30
|
}
|
|
31
31
|
catch (error) {
|
|
32
32
|
try {
|
|
33
|
-
await repos.
|
|
33
|
+
await repos.updateAction.giveUpUpdateAction({ typeOf: deleteActionAttributes.typeOf, id: action.id, error });
|
|
34
34
|
}
|
|
35
35
|
catch (_) {
|
|
36
36
|
// no op
|
|
37
37
|
}
|
|
38
38
|
throw error;
|
|
39
39
|
}
|
|
40
|
-
await repos.
|
|
40
|
+
await repos.updateAction.completeUpdateAction({ typeOf: deleteActionAttributes.typeOf, id: action.id, result: deleteResult });
|
|
41
41
|
};
|
|
42
42
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { UpdateActionRepo } from '../../../repo/updateAction';
|
|
2
2
|
import type { EventRepo } from '../../../repo/event';
|
|
3
3
|
import type { EventOfferRepo } from '../../../repo/eventOffer';
|
|
4
4
|
import type { EventSeriesRepo } from '../../../repo/eventSeries';
|
|
@@ -12,7 +12,7 @@ export declare function deleteResourcesBySeller(params: {
|
|
|
12
12
|
};
|
|
13
13
|
ids: string[];
|
|
14
14
|
}): (repos: {
|
|
15
|
-
|
|
15
|
+
updateAction: UpdateActionRepo;
|
|
16
16
|
event: EventRepo;
|
|
17
17
|
eventOffer: EventOfferRepo;
|
|
18
18
|
eventSeries: EventSeriesRepo;
|
|
@@ -14,8 +14,8 @@ function deleteResourcesBySeller(params) {
|
|
|
14
14
|
project: { id: params.project.id, typeOf: factory_1.factory.organizationType.Project },
|
|
15
15
|
typeOf: factory_1.factory.actionType.DeleteAction
|
|
16
16
|
};
|
|
17
|
-
let deleteResult;
|
|
18
|
-
const action = await repos.
|
|
17
|
+
let deleteResult;
|
|
18
|
+
const action = await repos.updateAction.startUpdateAction(deleteActionAttributes);
|
|
19
19
|
try {
|
|
20
20
|
// メンバー削除
|
|
21
21
|
const deleteMemberResult = await repos.member.deleteManyByMemberOfId({
|
|
@@ -65,14 +65,14 @@ function deleteResourcesBySeller(params) {
|
|
|
65
65
|
}
|
|
66
66
|
catch (error) {
|
|
67
67
|
try {
|
|
68
|
-
await repos.
|
|
68
|
+
await repos.updateAction.giveUpUpdateAction({ typeOf: deleteActionAttributes.typeOf, id: action.id, error });
|
|
69
69
|
}
|
|
70
70
|
catch (_) {
|
|
71
71
|
// no op
|
|
72
72
|
}
|
|
73
73
|
throw error;
|
|
74
74
|
}
|
|
75
|
-
await repos.
|
|
75
|
+
await repos.updateAction.completeUpdateAction({ typeOf: deleteActionAttributes.typeOf, id: action.id, result: deleteResult });
|
|
76
76
|
}
|
|
77
77
|
};
|
|
78
78
|
}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.call = call;
|
|
4
4
|
const factory_1 = require("../../factory");
|
|
5
|
-
const
|
|
5
|
+
const updateAction_1 = require("../../repo/updateAction");
|
|
6
6
|
const aggregateOffer_1 = require("../../repo/aggregateOffer");
|
|
7
7
|
const categoryCode_1 = require("../../repo/categoryCode");
|
|
8
8
|
const event_1 = require("../../repo/event");
|
|
@@ -27,7 +27,6 @@ const deleteResourcesByProduct_1 = require("./onResourceDeleted/deleteResourcesB
|
|
|
27
27
|
const deleteResourcesByRoom_1 = require("./onResourceDeleted/deleteResourcesByRoom");
|
|
28
28
|
const deleteResourcesBySeller_1 = require("./onResourceDeleted/deleteResourcesBySeller");
|
|
29
29
|
const onHasPOSUpdated_1 = require("./onResourceUpdated/onHasPOSUpdated");
|
|
30
|
-
// import { syncCategoryCode } from './onResourceUpdated/syncCategoryCode';
|
|
31
30
|
const syncOfferCatalog_1 = require("./onResourceUpdated/syncOfferCatalog");
|
|
32
31
|
/**
|
|
33
32
|
* タスク実行関数
|
|
@@ -35,7 +34,7 @@ const syncOfferCatalog_1 = require("./onResourceUpdated/syncOfferCatalog");
|
|
|
35
34
|
function call(params) {
|
|
36
35
|
return async ({ connection }) => {
|
|
37
36
|
await onResourceDeleted(params.data)({
|
|
38
|
-
|
|
37
|
+
updateAction: new updateAction_1.UpdateActionRepo(connection),
|
|
39
38
|
aggregateOffer: new aggregateOffer_1.AggregateOfferRepo(connection),
|
|
40
39
|
categoryCode: new categoryCode_1.CategoryCodeRepo(connection),
|
|
41
40
|
event: new event_1.EventRepo(connection),
|
|
@@ -7,7 +7,7 @@ exports.call = call;
|
|
|
7
7
|
const coa_service_1 = require("@motionpicture/coa-service");
|
|
8
8
|
const moment_timezone_1 = __importDefault(require("moment-timezone"));
|
|
9
9
|
const factory_1 = require("../../factory");
|
|
10
|
-
const
|
|
10
|
+
const updateAction_1 = require("../../repo/updateAction");
|
|
11
11
|
const categoryCode_1 = require("../../repo/categoryCode");
|
|
12
12
|
const creativeWork_1 = require("../../repo/creativeWork");
|
|
13
13
|
const credentials_1 = require("../../repo/credentials");
|
|
@@ -53,21 +53,20 @@ function call(params) {
|
|
|
53
53
|
...(credentialsRepo !== undefined) ? { credentialsRepo } : undefined
|
|
54
54
|
});
|
|
55
55
|
}
|
|
56
|
-
const
|
|
56
|
+
const updateActionRepo = new updateAction_1.UpdateActionRepo(connection);
|
|
57
57
|
try {
|
|
58
58
|
const masterService = new coa_service_1.COA.service.Master({
|
|
59
59
|
endpoint: coaAuthClient.options.endpoint, // same as authClient(2024-07-17~)
|
|
60
60
|
auth: coaAuthClient
|
|
61
61
|
}, { timeout: (await settings.getByKey('coa')).timeoutMaster });
|
|
62
|
-
const {
|
|
62
|
+
const { object } = params.data;
|
|
63
63
|
if (object.typeOf === factory_1.factory.eventType.ScreeningEventSeries) {
|
|
64
64
|
await syncEventSeries({
|
|
65
65
|
project: { id: params.project.id },
|
|
66
|
-
agent,
|
|
67
66
|
object,
|
|
68
67
|
sameAs: { id: params.id }
|
|
69
68
|
})({
|
|
70
|
-
|
|
69
|
+
updateAction: updateActionRepo,
|
|
71
70
|
categoryCode: new categoryCode_1.CategoryCodeRepo(connection),
|
|
72
71
|
creativeWork: new creativeWork_1.CreativeWorkRepo(connection),
|
|
73
72
|
eventSeries: new eventSeries_1.EventSeriesRepo(connection),
|
|
@@ -78,11 +77,10 @@ function call(params) {
|
|
|
78
77
|
else if (object.typeOf === factory_1.factory.eventType.ScreeningEvent) {
|
|
79
78
|
await syncEvents({
|
|
80
79
|
project: { id: params.project.id },
|
|
81
|
-
agent,
|
|
82
80
|
object,
|
|
83
81
|
sameAs: { id: params.id }
|
|
84
82
|
})({
|
|
85
|
-
|
|
83
|
+
updateAction: updateActionRepo,
|
|
86
84
|
categoryCode: new categoryCode_1.CategoryCodeRepo(connection),
|
|
87
85
|
creativeWork: new creativeWork_1.CreativeWorkRepo(connection),
|
|
88
86
|
event: new event_1.EventRepo(connection),
|
|
@@ -96,7 +94,7 @@ function call(params) {
|
|
|
96
94
|
catch (error) {
|
|
97
95
|
let throwsError = true;
|
|
98
96
|
// アクションが存在すればタスクを実行済扱いにする
|
|
99
|
-
const action = (await
|
|
97
|
+
const action = (await updateActionRepo.findUpdateActionsBySameAs({
|
|
100
98
|
sameAs: { id: { $eq: params.id } },
|
|
101
99
|
typeOf: { $eq: factory_1.factory.actionType.ReplaceAction }
|
|
102
100
|
})).shift();
|
|
@@ -115,21 +113,26 @@ function call(params) {
|
|
|
115
113
|
function syncEventSeries(params) {
|
|
116
114
|
return async (repos) => {
|
|
117
115
|
const { locationBranchCode, titleBranchNum, titleCode } = params.object;
|
|
116
|
+
const instrument = {
|
|
117
|
+
theaterCode: params.object.locationBranchCode,
|
|
118
|
+
typeOf: 'WebAPI',
|
|
119
|
+
identifier: factory_1.factory.service.webAPI.Identifier.COA
|
|
120
|
+
};
|
|
118
121
|
const actionAttributes = {
|
|
119
122
|
project: { typeOf: factory_1.factory.organizationType.Project, id: params.project.id },
|
|
120
123
|
typeOf: factory_1.factory.actionType.ReplaceAction,
|
|
121
|
-
agent: params.
|
|
124
|
+
agent: { typeOf: factory_1.factory.organizationType.Project, id: params.project.id },
|
|
122
125
|
// eslint-disable-next-line no-warning-comments
|
|
123
126
|
// TODO define object
|
|
124
127
|
object: {
|
|
125
128
|
...params.object,
|
|
126
129
|
typeOf: factory_1.factory.eventType.ScreeningEventSeries
|
|
127
130
|
}, // eslint-disable-line @typescript-eslint/no-explicit-any
|
|
128
|
-
|
|
131
|
+
instrument,
|
|
129
132
|
targetCollection: { typeOf: factory_1.factory.eventType.ScreeningEventSeries },
|
|
130
133
|
sameAs: { id: params.sameAs.id, typeOf: 'Task' }
|
|
131
134
|
};
|
|
132
|
-
const action = await repos.
|
|
135
|
+
const action = await repos.updateAction.startUpdateAction(actionAttributes);
|
|
133
136
|
let saveResult;
|
|
134
137
|
try {
|
|
135
138
|
const movieTheater = (await repos.movieTheater.projectFields({
|
|
@@ -165,7 +168,7 @@ function syncEventSeries(params) {
|
|
|
165
168
|
}
|
|
166
169
|
catch (error) {
|
|
167
170
|
try {
|
|
168
|
-
await repos.
|
|
171
|
+
await repos.updateAction.giveUpUpdateAction({ typeOf: action.typeOf, id: action.id, error });
|
|
169
172
|
}
|
|
170
173
|
catch (__) {
|
|
171
174
|
// no op
|
|
@@ -178,27 +181,32 @@ function syncEventSeries(params) {
|
|
|
178
181
|
typeOf: eventSeries.typeOf
|
|
179
182
|
};
|
|
180
183
|
});
|
|
181
|
-
await repos.
|
|
184
|
+
await repos.updateAction.completeUpdateAction({ typeOf: action.typeOf, id: action.id, result });
|
|
182
185
|
};
|
|
183
186
|
}
|
|
184
187
|
function syncEvents(params) {
|
|
185
188
|
return async (repos) => {
|
|
186
189
|
const { locationBranchCode, titleBranchNum, titleCode, roomCode, startDate } = params.object;
|
|
190
|
+
const instrument = {
|
|
191
|
+
theaterCode: params.object.locationBranchCode,
|
|
192
|
+
typeOf: 'WebAPI',
|
|
193
|
+
identifier: factory_1.factory.service.webAPI.Identifier.COA
|
|
194
|
+
};
|
|
187
195
|
const actionAttributes = {
|
|
188
196
|
project: { typeOf: factory_1.factory.organizationType.Project, id: params.project.id },
|
|
189
197
|
typeOf: factory_1.factory.actionType.ReplaceAction,
|
|
190
|
-
agent: params.
|
|
198
|
+
agent: { typeOf: factory_1.factory.organizationType.Project, id: params.project.id },
|
|
191
199
|
// eslint-disable-next-line no-warning-comments
|
|
192
200
|
// TODO define object
|
|
193
201
|
object: {
|
|
194
202
|
...params.object,
|
|
195
203
|
typeOf: factory_1.factory.eventType.ScreeningEvent
|
|
196
204
|
}, // eslint-disable-line @typescript-eslint/no-explicit-any
|
|
197
|
-
|
|
205
|
+
instrument,
|
|
198
206
|
targetCollection: { typeOf: factory_1.factory.eventType.ScreeningEvent },
|
|
199
207
|
sameAs: { id: params.sameAs.id, typeOf: 'Task' }
|
|
200
208
|
};
|
|
201
|
-
const action = await repos.
|
|
209
|
+
const action = await repos.updateAction.startUpdateAction(actionAttributes);
|
|
202
210
|
let saveResult;
|
|
203
211
|
try {
|
|
204
212
|
const movieTheater = (await repos.movieTheater.projectFields({
|
|
@@ -280,7 +288,7 @@ function syncEvents(params) {
|
|
|
280
288
|
}
|
|
281
289
|
catch (error) {
|
|
282
290
|
try {
|
|
283
|
-
await repos.
|
|
291
|
+
await repos.updateAction.giveUpUpdateAction({ typeOf: action.typeOf, id: action.id, error });
|
|
284
292
|
}
|
|
285
293
|
catch (__) {
|
|
286
294
|
// no op
|
|
@@ -293,6 +301,6 @@ function syncEvents(params) {
|
|
|
293
301
|
typeOf: event.typeOf
|
|
294
302
|
};
|
|
295
303
|
});
|
|
296
|
-
await repos.
|
|
304
|
+
await repos.updateAction.completeUpdateAction({ typeOf: action.typeOf, id: action.id, result });
|
|
297
305
|
};
|
|
298
306
|
}
|
|
@@ -2,6 +2,7 @@ import { factory } from '../../factory';
|
|
|
2
2
|
import type { AcceptedOfferRepo } from '../../repo/acceptedOffer';
|
|
3
3
|
import type { AccountingReportRepo } from '../../repo/accountingReport';
|
|
4
4
|
import type { ActionRepo } from '../../repo/action';
|
|
5
|
+
import type { UpdateActionRepo } from '../../repo/updateAction';
|
|
5
6
|
import type { AdminTransactionRepo } from '../../repo/adminTransaction';
|
|
6
7
|
import type { AssetTransactionRepo } from '../../repo/assetTransaction';
|
|
7
8
|
import type { NoteRepo } from '../../repo/note';
|
|
@@ -13,6 +14,7 @@ interface IDeleteTransactionRepos {
|
|
|
13
14
|
acceptedOffer: AcceptedOfferRepo;
|
|
14
15
|
accountingReport: AccountingReportRepo;
|
|
15
16
|
action: ActionRepo;
|
|
17
|
+
updateAction: UpdateActionRepo;
|
|
16
18
|
adminTransaction: AdminTransactionRepo;
|
|
17
19
|
assetTransaction: AssetTransactionRepo;
|
|
18
20
|
note: NoteRepo;
|