@chevre/domain 23.2.0-alpha.6 → 23.2.0-alpha.60
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/example/src/chevre/acceptedPaymentMethodOffer/adminAcceptedPaymentMethodOffers.ts +25 -17
- package/example/src/chevre/confirmationNumber/testRandomness.ts +49 -0
- package/example/src/chevre/emailMessage/createEmailMessageText.ts +63 -0
- package/example/src/chevre/event/importEventsFromCOAByTitle.ts +2 -2
- package/example/src/chevre/event/unsetSuperEventVideoFormat.ts +30 -0
- package/example/src/chevre/eventSeries/unsetVideoFormat.ts +31 -0
- package/example/src/chevre/{upsertScreeningEventSeriesByVersion.ts → eventSeries/upsertScreeningEventSeriesByVersion.ts} +47 -43
- package/example/src/chevre/{upsertOfferCatalogItemsByIdentifier.ts → offerCatalog/upsertOfferCatalogItemsByIdentifier.ts} +6 -3
- package/example/src/chevre/{upsertOfferCatalogsByIdentifier.ts → offerCatalog/upsertOfferCatalogsByIdentifier.ts} +8 -3
- package/example/src/chevre/{upsertOffersByIdentifier.ts → offers/upsertOffersByIdentifier.ts} +5 -3
- package/example/src/chevre/orderNumber/decryptOrderNumber.ts +14 -0
- package/example/src/chevre/orderNumber/testRandomness.ts +54 -0
- package/example/src/chevre/place/adminEntranceGates.ts +69 -0
- package/example/src/chevre/place/checkEntranceGatesCount.ts +82 -0
- package/example/src/chevre/place/findRooms.ts +24 -0
- package/example/src/chevre/place/findSections.ts +28 -0
- package/example/src/chevre/place/migrateSectionIdentifier.ts +92 -0
- package/example/src/chevre/place/seatsJson2csv.ts +63 -0
- package/example/src/chevre/place/upsertMovieTheatersByBranchCode.ts +41 -0
- package/example/src/chevre/place/upsertRoomsByBranchCode.ts +40 -0
- package/example/src/chevre/place/upsertSeatSectionsByBranchCode.ts +56 -0
- package/example/src/chevre/reIndex.ts +1 -1
- package/example/src/chevre/roles/addAdminAcceptedPaymentMethodReadPermissionIfNotExists.ts +33 -0
- package/example/src/chevre/roles/addAdminAcceptedPaymentMethodWritePermissionIfNotExists.ts +33 -0
- package/example/src/chevre/roles/addAdminMovieReadPermissionIfNotExists.ts +49 -0
- package/example/src/chevre/roles/addAdminRoomReadPermissionIfNotExists.ts +34 -0
- package/example/src/chevre/roles/addAdminRoomWritePermissionIfNotExists.ts +34 -0
- package/example/src/chevre/settings/addOrderNumberSetting.ts +44 -0
- package/example/src/chevre/settings/addTransactionNumberSetting.ts +40 -0
- package/example/src/chevre/transactionNumber/publishByTimestamp.ts +23 -0
- package/example/src/chevre/transactionNumber/testRandomness.ts +42 -0
- package/example/src/chevre/unsetUnnecessaryFields.ts +8 -4
- package/lib/chevre/emailMessageBuilder.js +1 -0
- package/lib/chevre/factory/event.d.ts +1 -1
- package/lib/chevre/factory/event.js +11 -5
- package/lib/chevre/factory/transactionNumber.d.ts +19 -0
- package/lib/chevre/factory/transactionNumber.js +54 -0
- package/lib/chevre/repo/acceptedPaymentMethod.d.ts +41 -8
- package/lib/chevre/repo/acceptedPaymentMethod.js +72 -27
- package/lib/chevre/repo/aggregateOffer.d.ts +6 -1
- package/lib/chevre/repo/aggregateOffer.js +11 -3
- package/lib/chevre/repo/aggregateOrder.js +0 -93
- package/lib/chevre/repo/aggregateReservation.d.ts +0 -1
- package/lib/chevre/repo/aggregateReservation.js +0 -2
- package/lib/chevre/repo/confirmationNumber.d.ts +1 -0
- package/lib/chevre/repo/confirmationNumber.js +32 -25
- package/lib/chevre/repo/event.d.ts +3 -3
- package/lib/chevre/repo/event.js +20 -8
- package/lib/chevre/repo/eventOffer.d.ts +8 -0
- package/lib/chevre/repo/eventOffer.js +11 -0
- package/lib/chevre/repo/eventSeries.d.ts +18 -25
- package/lib/chevre/repo/eventSeries.js +155 -101
- package/lib/chevre/repo/mongoose/schemas/aggregateReservation.js +0 -1
- package/lib/chevre/repo/mongoose/schemas/eventSeries.js +13 -25
- package/lib/chevre/repo/mongoose/schemas/offerCatalog.js +2 -8
- package/lib/chevre/repo/mongoose/schemas/offerCatalogItem.js +28 -2
- package/lib/chevre/repo/mongoose/schemas/place.d.ts +6 -2
- package/lib/chevre/repo/mongoose/schemas/setting.d.ts +40 -0
- package/lib/chevre/repo/mongoose/schemas/setting.js +3 -0
- package/lib/chevre/repo/offerCatalog.d.ts +14 -1
- package/lib/chevre/repo/offerCatalog.js +41 -19
- package/lib/chevre/repo/offerCatalogItem.d.ts +10 -1
- package/lib/chevre/repo/offerCatalogItem.js +32 -17
- package/lib/chevre/repo/orderNumber.d.ts +7 -0
- package/lib/chevre/repo/orderNumber.js +110 -34
- package/lib/chevre/repo/place/entranceGate.d.ts +57 -0
- package/lib/chevre/repo/place/entranceGate.js +172 -0
- package/lib/chevre/repo/place/movieTheater.d.ts +40 -3
- package/lib/chevre/repo/place/movieTheater.js +77 -6
- package/lib/chevre/repo/place/screeningRoom.d.ts +60 -31
- package/lib/chevre/repo/place/screeningRoom.js +227 -135
- package/lib/chevre/repo/place/seat.d.ts +47 -45
- package/lib/chevre/repo/place/seat.js +175 -45
- package/lib/chevre/repo/place/section.d.ts +60 -30
- package/lib/chevre/repo/place/section.js +337 -127
- package/lib/chevre/repo/serviceOutputIdentifier.d.ts +3 -1
- package/lib/chevre/repo/serviceOutputIdentifier.js +42 -27
- package/lib/chevre/repo/setting.d.ts +1 -1
- package/lib/chevre/repo/setting.js +2 -2
- package/lib/chevre/repo/task.d.ts +1 -1
- package/lib/chevre/repo/transactionNumber.d.ts +5 -0
- package/lib/chevre/repo/transactionNumber.js +63 -27
- package/lib/chevre/repository.d.ts +8 -0
- package/lib/chevre/repository.js +16 -0
- package/lib/chevre/service/assetTransaction/reserve/start/factory/createStartParams.js +10 -2
- package/lib/chevre/service/event/processUpdateMovieTheater.d.ts +1 -1
- package/lib/chevre/service/event/processUpdateMovieTheater.js +13 -11
- package/lib/chevre/service/event/saveScreeningEventSeries.js +4 -5
- package/lib/chevre/service/event/saveScreeningEvents.d.ts +2 -2
- package/lib/chevre/service/event/saveScreeningEvents.js +16 -12
- package/lib/chevre/service/offer/event/authorize/factory.js +9 -1
- package/lib/chevre/service/offer/event/searchEventTicketOffers.js +7 -4
- package/lib/chevre/service/offer/event/searchOfferAppliesToMovieTicket.js +9 -6
- package/lib/chevre/service/offer/event/searchOffersByIds.js +7 -4
- package/lib/chevre/service/offer/eventServiceByCOA/authorize/factory.js +7 -1
- package/lib/chevre/service/offer/onEventChanged.js +10 -6
- package/lib/chevre/service/offer/product.js +1 -1
- package/lib/chevre/service/offer.d.ts +5 -0
- package/lib/chevre/service/offer.js +34 -9
- package/lib/chevre/service/order/onOrderStatusChanged/onOrderCancelled/factory.d.ts +1 -1
- package/lib/chevre/service/order/onOrderStatusChanged/onOrderDeliveredPartially/factory.d.ts +1 -1
- package/lib/chevre/service/order/onOrderStatusChanged/onOrderReturned/factory.d.ts +1 -1
- package/lib/chevre/service/task/createEvent/createEventBySchedule/factory.d.ts +2 -2
- package/lib/chevre/service/task/createEvent/createEventBySchedule/factory.js +5 -3
- package/lib/chevre/service/task/createEvent/createEventBySchedule/schedule2events.js +4 -2
- package/lib/chevre/service/task/onResourceDeleted/deleteResourcesByAggregateOffer.d.ts +13 -0
- package/lib/chevre/service/task/onResourceDeleted/deleteResourcesByAggregateOffer.js +53 -0
- package/lib/chevre/service/task/onResourceDeleted/deleteResourcesByEventSeries.d.ts +13 -0
- package/lib/chevre/service/task/onResourceDeleted/deleteResourcesByEventSeries.js +56 -0
- package/lib/chevre/service/task/onResourceDeleted/deleteResourcesByMovieTheater.d.ts +15 -0
- package/lib/chevre/service/task/onResourceDeleted/deleteResourcesByMovieTheater.js +58 -0
- package/lib/chevre/service/task/onResourceDeleted/deleteResourcesByOfferCatalog.d.ts +17 -0
- package/lib/chevre/service/task/onResourceDeleted/deleteResourcesByOfferCatalog.js +75 -0
- package/lib/chevre/service/task/onResourceDeleted/deleteResourcesByProduct.d.ts +19 -0
- package/lib/chevre/service/task/onResourceDeleted/deleteResourcesByProduct.js +60 -0
- package/lib/chevre/service/task/onResourceDeleted/deleteResourcesByRoom.d.ts +20 -0
- package/lib/chevre/service/task/onResourceDeleted/deleteResourcesByRoom.js +51 -0
- package/lib/chevre/service/task/onResourceDeleted/deleteResourcesBySeller.d.ts +27 -0
- package/lib/chevre/service/task/onResourceDeleted/deleteResourcesBySeller.js +100 -0
- package/lib/chevre/service/task/onResourceDeleted.d.ts +6 -0
- package/lib/chevre/service/task/onResourceDeleted.js +168 -0
- package/lib/chevre/service/task/onResourceUpdated.js +205 -42
- package/lib/chevre/service/task/syncResourcesFromCOA.js +4 -2
- package/lib/chevre/service/taskHandler.js +1 -0
- package/package.json +10 -8
- package/example/src/chevre/event/upsertManyScreeningEventByIdentifier.ts +0 -191
- package/example/src/chevre/eventSeries/migrateEventSeriesUnacceptedPaymentMethod.ts +0 -93
- package/example/src/chevre/offers/createSampleOffers.ts +0 -154
- package/example/src/chevre/settings/addSettings.ts +0 -46
- package/lib/chevre/service/eventOld.d.ts +0 -60
- package/lib/chevre/service/eventOld.js +0 -864
- package/lib/chevre/service/task/onResourceUpdated/onResourceDeleted.d.ts +0 -45
- package/lib/chevre/service/task/onResourceUpdated/onResourceDeleted.js +0 -447
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import * as factory from '../../../factory';
|
|
2
|
+
import type { ActionRepo } from '../../../repo/action';
|
|
3
|
+
import type { AggregateOfferRepo } from '../../../repo/aggregateOffer';
|
|
4
|
+
import type { EventRepo } from '../../../repo/event';
|
|
5
|
+
import type { NoteRepo } from '../../../repo/note';
|
|
6
|
+
import type { ProductRepo } from '../../../repo/product';
|
|
7
|
+
export declare function deleteResourcesByProduct(params: {
|
|
8
|
+
project: {
|
|
9
|
+
id: string;
|
|
10
|
+
};
|
|
11
|
+
ids: string[];
|
|
12
|
+
typeOf: factory.product.ProductType;
|
|
13
|
+
}): (repos: {
|
|
14
|
+
action: ActionRepo;
|
|
15
|
+
aggregateOffer: AggregateOfferRepo;
|
|
16
|
+
event: EventRepo;
|
|
17
|
+
note: NoteRepo;
|
|
18
|
+
product: ProductRepo;
|
|
19
|
+
}) => Promise<void>;
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.deleteResourcesByProduct = deleteResourcesByProduct;
|
|
13
|
+
const factory = require("../../../factory");
|
|
14
|
+
function deleteResourcesByProduct(params) {
|
|
15
|
+
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
16
|
+
if (params.ids.length !== 1) {
|
|
17
|
+
throw new factory.errors.Argument('id', 'id.length must be 1');
|
|
18
|
+
}
|
|
19
|
+
for (const productId of params.ids) {
|
|
20
|
+
const deleteActionAttributes = {
|
|
21
|
+
agent: { id: params.project.id, typeOf: factory.organizationType.Project },
|
|
22
|
+
object: { id: productId, typeOf: params.typeOf },
|
|
23
|
+
project: { id: params.project.id, typeOf: factory.organizationType.Project },
|
|
24
|
+
typeOf: factory.actionType.DeleteAction
|
|
25
|
+
};
|
|
26
|
+
let deleteResult;
|
|
27
|
+
const action = yield repos.action.start(deleteActionAttributes);
|
|
28
|
+
try {
|
|
29
|
+
let deleteEventResult;
|
|
30
|
+
let updateOfferResult;
|
|
31
|
+
let deleteNoteResult;
|
|
32
|
+
// 興行を設定されたイベント削除
|
|
33
|
+
deleteEventResult = yield repos.event.deleteManyEventsByItemOfferedId({
|
|
34
|
+
project: { id: params.project.id },
|
|
35
|
+
offers: { itemOffered: { id: { $in: [productId] } } }
|
|
36
|
+
});
|
|
37
|
+
// アドオンから除外
|
|
38
|
+
updateOfferResult = yield repos.aggregateOffer.pullAddOns({
|
|
39
|
+
project: { id: params.project.id },
|
|
40
|
+
addOn: { itemOffered: { id: { $in: [productId] } } }
|
|
41
|
+
});
|
|
42
|
+
// メモを削除(2025-09-18~)
|
|
43
|
+
deleteNoteResult = yield repos.note.deleteNotesByAbout({
|
|
44
|
+
about: { id: productId, typeOf: params.typeOf }
|
|
45
|
+
});
|
|
46
|
+
deleteResult = { deleteEventResult, updateOfferResult, deleteNoteResult };
|
|
47
|
+
}
|
|
48
|
+
catch (error) {
|
|
49
|
+
try {
|
|
50
|
+
yield repos.action.giveUp({ typeOf: deleteActionAttributes.typeOf, id: action.id, error });
|
|
51
|
+
}
|
|
52
|
+
catch (_) {
|
|
53
|
+
// no op
|
|
54
|
+
}
|
|
55
|
+
throw error;
|
|
56
|
+
}
|
|
57
|
+
yield repos.action.completeWithVoid({ typeOf: deleteActionAttributes.typeOf, id: action.id, result: deleteResult });
|
|
58
|
+
}
|
|
59
|
+
});
|
|
60
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { ActionRepo } from '../../../repo/action';
|
|
2
|
+
import type { EventRepo } from '../../../repo/event';
|
|
3
|
+
export declare function deleteResourcesByRoom(params: {
|
|
4
|
+
project: {
|
|
5
|
+
id: string;
|
|
6
|
+
};
|
|
7
|
+
/**
|
|
8
|
+
* ルームコード
|
|
9
|
+
*/
|
|
10
|
+
branchCode: string[];
|
|
11
|
+
containedInPlace: {
|
|
12
|
+
/**
|
|
13
|
+
* 施設ID
|
|
14
|
+
*/
|
|
15
|
+
id: string;
|
|
16
|
+
};
|
|
17
|
+
}): (repos: {
|
|
18
|
+
action: ActionRepo;
|
|
19
|
+
event: EventRepo;
|
|
20
|
+
}) => Promise<void>;
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.deleteResourcesByRoom = deleteResourcesByRoom;
|
|
13
|
+
const factory = require("../../../factory");
|
|
14
|
+
function deleteResourcesByRoom(params) {
|
|
15
|
+
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
16
|
+
// 現時点で、複数ルーム削除タスクは作成されない
|
|
17
|
+
const firstBranchCode = params.branchCode.at(0);
|
|
18
|
+
if (typeof firstBranchCode !== 'string') {
|
|
19
|
+
throw new factory.errors.ArgumentNull('branchCode');
|
|
20
|
+
}
|
|
21
|
+
const deleteActionAttributes = {
|
|
22
|
+
agent: { id: params.project.id, typeOf: factory.organizationType.Project },
|
|
23
|
+
object: { branchCode: firstBranchCode, containedInPlace: params.containedInPlace, typeOf: factory.placeType.ScreeningRoom },
|
|
24
|
+
project: { id: params.project.id, typeOf: factory.organizationType.Project },
|
|
25
|
+
typeOf: factory.actionType.DeleteAction
|
|
26
|
+
};
|
|
27
|
+
let deleteResult;
|
|
28
|
+
const action = yield repos.action.start(deleteActionAttributes);
|
|
29
|
+
try {
|
|
30
|
+
// イベント削除
|
|
31
|
+
const deleteScreeningEventResult = yield repos.event.deleteManyEventsByScreeningRoom({
|
|
32
|
+
project: { id: params.project.id },
|
|
33
|
+
location: {
|
|
34
|
+
branchCode: firstBranchCode,
|
|
35
|
+
containedInPlace: { id: params.containedInPlace.id }
|
|
36
|
+
}
|
|
37
|
+
});
|
|
38
|
+
deleteResult = { deleteScreeningEventResult };
|
|
39
|
+
}
|
|
40
|
+
catch (error) {
|
|
41
|
+
try {
|
|
42
|
+
yield repos.action.giveUp({ typeOf: deleteActionAttributes.typeOf, id: action.id, error });
|
|
43
|
+
}
|
|
44
|
+
catch (_) {
|
|
45
|
+
// no op
|
|
46
|
+
}
|
|
47
|
+
throw error;
|
|
48
|
+
}
|
|
49
|
+
yield repos.action.completeWithVoid({ typeOf: deleteActionAttributes.typeOf, id: action.id, result: deleteResult });
|
|
50
|
+
});
|
|
51
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { AcceptedPaymentMethodRepo } from '../../../repo/acceptedPaymentMethod';
|
|
2
|
+
import type { ActionRepo } from '../../../repo/action';
|
|
3
|
+
import type { EventRepo } from '../../../repo/event';
|
|
4
|
+
import type { EventOfferRepo } from '../../../repo/eventOffer';
|
|
5
|
+
import type { EventSeriesRepo } from '../../../repo/eventSeries';
|
|
6
|
+
import type { MemberRepo } from '../../../repo/member';
|
|
7
|
+
import type { PaymentServiceProviderRepo } from '../../../repo/paymentServiceProvider';
|
|
8
|
+
import type { MovieTheaterRepo } from '../../../repo/place/movieTheater';
|
|
9
|
+
import type { ScreeningRoomRepo } from '../../../repo/place/screeningRoom';
|
|
10
|
+
import type { ProductOfferRepo } from '../../../repo/productOffer';
|
|
11
|
+
export declare function deleteResourcesBySeller(params: {
|
|
12
|
+
project: {
|
|
13
|
+
id: string;
|
|
14
|
+
};
|
|
15
|
+
ids: string[];
|
|
16
|
+
}): (repos: {
|
|
17
|
+
acceptedPaymentMethod: AcceptedPaymentMethodRepo;
|
|
18
|
+
action: ActionRepo;
|
|
19
|
+
event: EventRepo;
|
|
20
|
+
eventOffer: EventOfferRepo;
|
|
21
|
+
eventSeries: EventSeriesRepo;
|
|
22
|
+
member: MemberRepo;
|
|
23
|
+
movieTheater: MovieTheaterRepo;
|
|
24
|
+
screeningRoom: ScreeningRoomRepo;
|
|
25
|
+
paymentServiceProvider: PaymentServiceProviderRepo;
|
|
26
|
+
productOffer: ProductOfferRepo;
|
|
27
|
+
}) => Promise<void>;
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.deleteResourcesBySeller = deleteResourcesBySeller;
|
|
13
|
+
const factory = require("../../../factory");
|
|
14
|
+
// tslint:disable-next-line:max-func-body-length
|
|
15
|
+
function deleteResourcesBySeller(params) {
|
|
16
|
+
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
17
|
+
if (params.ids.length !== 1) {
|
|
18
|
+
throw new factory.errors.Argument('id', 'id.length must be 1');
|
|
19
|
+
}
|
|
20
|
+
for (const sellerId of params.ids) {
|
|
21
|
+
const deleteActionAttributes = {
|
|
22
|
+
agent: { id: params.project.id, typeOf: factory.organizationType.Project },
|
|
23
|
+
object: { id: sellerId, typeOf: factory.organizationType.Corporation },
|
|
24
|
+
project: { id: params.project.id, typeOf: factory.organizationType.Project },
|
|
25
|
+
typeOf: factory.actionType.DeleteAction
|
|
26
|
+
};
|
|
27
|
+
let deleteResult;
|
|
28
|
+
const action = yield repos.action.start(deleteActionAttributes);
|
|
29
|
+
try {
|
|
30
|
+
// メンバー削除
|
|
31
|
+
const deleteMemberResult = yield repos.member.deleteManyByMemberOfId({
|
|
32
|
+
project: { id: params.project.id },
|
|
33
|
+
member: {
|
|
34
|
+
memberOf: {
|
|
35
|
+
id: { $eq: sellerId },
|
|
36
|
+
typeOf: { $eq: factory.organizationType.Corporation }
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
});
|
|
40
|
+
// 提供決済サービス削除
|
|
41
|
+
const deletePaymentServiceProviderResult = yield repos.paymentServiceProvider.deleteManyByProviderId({
|
|
42
|
+
project: { id: params.project.id },
|
|
43
|
+
id: sellerId
|
|
44
|
+
});
|
|
45
|
+
// イベントオファー削除(2026-01-16~)
|
|
46
|
+
const deleteEventOfferResult = yield repos.eventOffer.deleteEventOffersBySeller({
|
|
47
|
+
project: { id: params.project.id },
|
|
48
|
+
seller: { id: sellerId }
|
|
49
|
+
});
|
|
50
|
+
// 対応決済方法削除(2026-02-07~)
|
|
51
|
+
const deleteAcceptedPaymentMethodsResult = yield repos.acceptedPaymentMethod.deleteAcceptedPaymentMethodsBySeller({
|
|
52
|
+
project: { id: params.project.id },
|
|
53
|
+
seller: { id: sellerId }
|
|
54
|
+
});
|
|
55
|
+
// イベント削除
|
|
56
|
+
const deleteEventResult = yield repos.event.deleteManyEventByOrganizerId({
|
|
57
|
+
project: { id: params.project.id },
|
|
58
|
+
organizer: { id: sellerId }
|
|
59
|
+
});
|
|
60
|
+
// 施設コンテンツ削除
|
|
61
|
+
const deleteEventSeriesResult = yield repos.eventSeries.deleteManyByOrganizerId({
|
|
62
|
+
project: { id: params.project.id },
|
|
63
|
+
organizer: { id: sellerId }
|
|
64
|
+
});
|
|
65
|
+
// ルーム削除
|
|
66
|
+
const deleteScreeningRoomResult = yield repos.screeningRoom.deleteScreeningRoomsByParentOrganizationId({
|
|
67
|
+
project: { id: params.project.id },
|
|
68
|
+
parentOrganization: { id: sellerId }
|
|
69
|
+
});
|
|
70
|
+
// 施設削除
|
|
71
|
+
const deleteMovieTheaterResult = yield repos.movieTheater.deleteMovieTheatersByParentOrganizationId({
|
|
72
|
+
project: { id: params.project.id },
|
|
73
|
+
parentOrganization: { id: sellerId }
|
|
74
|
+
});
|
|
75
|
+
// プロダクトオファー削除(2025-10-02~)
|
|
76
|
+
const deleteProductOfferResult = yield repos.productOffer.deleteProductOffersBySeller({
|
|
77
|
+
project: { id: params.project.id },
|
|
78
|
+
offeredBy: { id: sellerId }
|
|
79
|
+
});
|
|
80
|
+
deleteResult = {
|
|
81
|
+
deleteMemberResult, deletePaymentServiceProviderResult,
|
|
82
|
+
deleteAcceptedPaymentMethodsResult,
|
|
83
|
+
deleteEventOfferResult,
|
|
84
|
+
deleteProductOfferResult,
|
|
85
|
+
deleteEventResult, deleteEventSeriesResult, deleteScreeningRoomResult, deleteMovieTheaterResult
|
|
86
|
+
};
|
|
87
|
+
}
|
|
88
|
+
catch (error) {
|
|
89
|
+
try {
|
|
90
|
+
yield repos.action.giveUp({ typeOf: deleteActionAttributes.typeOf, id: action.id, error });
|
|
91
|
+
}
|
|
92
|
+
catch (_) {
|
|
93
|
+
// no op
|
|
94
|
+
}
|
|
95
|
+
throw error;
|
|
96
|
+
}
|
|
97
|
+
yield repos.action.completeWithVoid({ typeOf: deleteActionAttributes.typeOf, id: action.id, result: deleteResult });
|
|
98
|
+
}
|
|
99
|
+
});
|
|
100
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import * as factory from '../../factory';
|
|
2
|
+
import type { ICallResult, IExecutableTaskKeys, IOperationExecute } from '../taskHandler';
|
|
3
|
+
/**
|
|
4
|
+
* タスク実行関数
|
|
5
|
+
*/
|
|
6
|
+
export declare function call(params: Pick<factory.task.onResourceDeleted.ITask, IExecutableTaskKeys>): IOperationExecute<ICallResult>;
|
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.call = call;
|
|
13
|
+
const factory = require("../../factory");
|
|
14
|
+
const acceptedPaymentMethod_1 = require("../../repo/acceptedPaymentMethod");
|
|
15
|
+
const action_1 = require("../../repo/action");
|
|
16
|
+
const aggregateOffer_1 = require("../../repo/aggregateOffer");
|
|
17
|
+
const categoryCode_1 = require("../../repo/categoryCode");
|
|
18
|
+
const event_1 = require("../../repo/event");
|
|
19
|
+
const eventOffer_1 = require("../../repo/eventOffer");
|
|
20
|
+
const eventSeries_1 = require("../../repo/eventSeries");
|
|
21
|
+
const member_1 = require("../../repo/member");
|
|
22
|
+
const note_1 = require("../../repo/note");
|
|
23
|
+
const offerCatalog_1 = require("../../repo/offerCatalog");
|
|
24
|
+
const offerCatalogItem_1 = require("../../repo/offerCatalogItem");
|
|
25
|
+
const paymentServiceProvider_1 = require("../../repo/paymentServiceProvider");
|
|
26
|
+
const hasPOS_1 = require("../../repo/place/hasPOS");
|
|
27
|
+
const movieTheater_1 = require("../../repo/place/movieTheater");
|
|
28
|
+
const screeningRoom_1 = require("../../repo/place/screeningRoom");
|
|
29
|
+
const product_1 = require("../../repo/product");
|
|
30
|
+
const productModel_1 = require("../../repo/productModel");
|
|
31
|
+
const productOffer_1 = require("../../repo/productOffer");
|
|
32
|
+
const setting_1 = require("../../repo/setting");
|
|
33
|
+
const task_1 = require("../../repo/task");
|
|
34
|
+
const deleteResourcesByAggregateOffer_1 = require("./onResourceDeleted/deleteResourcesByAggregateOffer");
|
|
35
|
+
const deleteResourcesByEventSeries_1 = require("./onResourceDeleted/deleteResourcesByEventSeries");
|
|
36
|
+
const deleteResourcesByMovieTheater_1 = require("./onResourceDeleted/deleteResourcesByMovieTheater");
|
|
37
|
+
const deleteResourcesByOfferCatalog_1 = require("./onResourceDeleted/deleteResourcesByOfferCatalog");
|
|
38
|
+
const deleteResourcesByProduct_1 = require("./onResourceDeleted/deleteResourcesByProduct");
|
|
39
|
+
const deleteResourcesByRoom_1 = require("./onResourceDeleted/deleteResourcesByRoom");
|
|
40
|
+
const deleteResourcesBySeller_1 = require("./onResourceDeleted/deleteResourcesBySeller");
|
|
41
|
+
const onHasPOSUpdated_1 = require("./onResourceUpdated/onHasPOSUpdated");
|
|
42
|
+
const syncCategoryCode_1 = require("./onResourceUpdated/syncCategoryCode");
|
|
43
|
+
const syncOfferCatalog_1 = require("./onResourceUpdated/syncOfferCatalog");
|
|
44
|
+
/**
|
|
45
|
+
* タスク実行関数
|
|
46
|
+
*/
|
|
47
|
+
function call(params) {
|
|
48
|
+
return (_a) => __awaiter(this, [_a], void 0, function* ({ connection }) {
|
|
49
|
+
yield onResourceDeleted(params.data)({
|
|
50
|
+
acceptedPaymentMethod: new acceptedPaymentMethod_1.AcceptedPaymentMethodRepo(connection),
|
|
51
|
+
action: new action_1.ActionRepo(connection),
|
|
52
|
+
aggregateOffer: new aggregateOffer_1.AggregateOfferRepo(connection),
|
|
53
|
+
categoryCode: new categoryCode_1.CategoryCodeRepo(connection),
|
|
54
|
+
event: new event_1.EventRepo(connection),
|
|
55
|
+
eventOffer: new eventOffer_1.EventOfferRepo(connection),
|
|
56
|
+
eventSeries: new eventSeries_1.EventSeriesRepo(connection),
|
|
57
|
+
hasPOS: new hasPOS_1.HasPOSRepo(connection, { id: '' }), // 先の処理で明示的に指定される
|
|
58
|
+
member: new member_1.MemberRepo(connection),
|
|
59
|
+
movieTheater: new movieTheater_1.MovieTheaterRepo(connection),
|
|
60
|
+
note: new note_1.NoteRepo(connection),
|
|
61
|
+
offerCatalog: new offerCatalog_1.OfferCatalogRepo(connection),
|
|
62
|
+
offerCatalogItem: new offerCatalogItem_1.OfferCatalogItemRepo(connection),
|
|
63
|
+
paymentServiceProvider: new paymentServiceProvider_1.PaymentServiceProviderRepo(connection),
|
|
64
|
+
screeningRoom: new screeningRoom_1.ScreeningRoomRepo(connection),
|
|
65
|
+
product: new product_1.ProductRepo(connection),
|
|
66
|
+
productModel: new productModel_1.ProductModelRepo(connection),
|
|
67
|
+
productOffer: new productOffer_1.ProductOfferRepo(connection),
|
|
68
|
+
setting: new setting_1.SettingRepo(connection),
|
|
69
|
+
task: new task_1.TaskRepo(connection)
|
|
70
|
+
});
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
function onResourceDeleted(params) {
|
|
74
|
+
// tslint:disable-next-line:max-func-body-length
|
|
75
|
+
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
76
|
+
const setting = yield repos.setting.findOne({ project: { id: { $eq: '*' } } }, ['useInformResourceTypes']);
|
|
77
|
+
const useInformResourceTypes = setting === null || setting === void 0 ? void 0 : setting.useInformResourceTypes;
|
|
78
|
+
const useInform = params.useInform === true
|
|
79
|
+
&& Array.isArray(useInformResourceTypes) && useInformResourceTypes.includes(params.typeOf);
|
|
80
|
+
const isDeleted = params.isDeleted === true;
|
|
81
|
+
const resourceType = params.typeOf;
|
|
82
|
+
if (isDeleted) {
|
|
83
|
+
if (useInform) {
|
|
84
|
+
switch (resourceType) {
|
|
85
|
+
case 'POS':
|
|
86
|
+
yield (0, onHasPOSUpdated_1.createInformHasPOSTasks)({
|
|
87
|
+
project: { id: params.project.id },
|
|
88
|
+
ids: [params.operator.id],
|
|
89
|
+
typeOf: factory.placeType.MovieTheater
|
|
90
|
+
})(repos);
|
|
91
|
+
break;
|
|
92
|
+
default:
|
|
93
|
+
// no op
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
switch (resourceType) {
|
|
97
|
+
case 'POS':
|
|
98
|
+
break;
|
|
99
|
+
case factory.eventType.ScreeningEventSeries:
|
|
100
|
+
yield (0, deleteResourcesByEventSeries_1.deleteResourcesByEventSeries)({
|
|
101
|
+
project: { id: params.project.id },
|
|
102
|
+
ids: params.id
|
|
103
|
+
})(repos);
|
|
104
|
+
break;
|
|
105
|
+
case factory.placeType.ScreeningRoom:
|
|
106
|
+
yield (0, deleteResourcesByRoom_1.deleteResourcesByRoom)({
|
|
107
|
+
project: { id: params.project.id },
|
|
108
|
+
branchCode: params.branchCode,
|
|
109
|
+
containedInPlace: { id: params.containedInPlace.id }
|
|
110
|
+
})(repos);
|
|
111
|
+
break;
|
|
112
|
+
case factory.placeType.MovieTheater:
|
|
113
|
+
yield (0, deleteResourcesByMovieTheater_1.deleteResourcesByMovieTheater)({
|
|
114
|
+
project: { id: params.project.id },
|
|
115
|
+
ids: params.id
|
|
116
|
+
})(repos);
|
|
117
|
+
break;
|
|
118
|
+
case factory.organizationType.Corporation:
|
|
119
|
+
yield (0, deleteResourcesBySeller_1.deleteResourcesBySeller)({
|
|
120
|
+
project: { id: params.project.id },
|
|
121
|
+
ids: params.id
|
|
122
|
+
})(repos);
|
|
123
|
+
break;
|
|
124
|
+
case factory.offerType.AggregateOffer:
|
|
125
|
+
yield (0, deleteResourcesByAggregateOffer_1.deleteResourcesByAggregateOffer)({
|
|
126
|
+
project: { id: params.project.id },
|
|
127
|
+
ids: params.id
|
|
128
|
+
})(repos);
|
|
129
|
+
break;
|
|
130
|
+
case 'OfferCatalog':
|
|
131
|
+
yield (0, deleteResourcesByOfferCatalog_1.deleteResourcesByOfferCatalog)({
|
|
132
|
+
project: { id: params.project.id },
|
|
133
|
+
ids: params.id
|
|
134
|
+
})(repos);
|
|
135
|
+
yield (0, syncOfferCatalog_1.syncOfferCatalog)({
|
|
136
|
+
project: { id: params.project.id },
|
|
137
|
+
ids: params.id,
|
|
138
|
+
typeOf: resourceType,
|
|
139
|
+
isDeleted: true,
|
|
140
|
+
isOfferCatalogItem: params.isOfferCatalogItem === true
|
|
141
|
+
})(repos);
|
|
142
|
+
break;
|
|
143
|
+
case factory.product.ProductType.EventService:
|
|
144
|
+
case factory.product.ProductType.Product:
|
|
145
|
+
case factory.product.ProductType.Transportation:
|
|
146
|
+
case factory.product.ProductType.MembershipService:
|
|
147
|
+
case factory.product.ProductType.PaymentCard:
|
|
148
|
+
yield (0, deleteResourcesByProduct_1.deleteResourcesByProduct)({
|
|
149
|
+
project: { id: params.project.id },
|
|
150
|
+
ids: params.id,
|
|
151
|
+
typeOf: resourceType
|
|
152
|
+
})(repos);
|
|
153
|
+
break;
|
|
154
|
+
// 区分削除に対応(2024-04-18~)
|
|
155
|
+
case 'CategoryCode':
|
|
156
|
+
yield (0, syncCategoryCode_1.syncCategoryCode)({
|
|
157
|
+
project: { id: params.project.id },
|
|
158
|
+
ids: params.id,
|
|
159
|
+
isDeleted: true
|
|
160
|
+
})(repos);
|
|
161
|
+
break;
|
|
162
|
+
default:
|
|
163
|
+
// no op
|
|
164
|
+
throw new factory.errors.NotImplemented(`${resourceType} onDeleted not implemented`);
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
});
|
|
168
|
+
}
|