@chevre/domain 22.14.0-alpha.8 → 23.0.0-alpha.0
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/{createEventBySchedule.ts → addEventBySchedule.ts} +2 -2
- package/example/src/chevre/aggregateEventPublicFields.ts +1 -1
- package/example/src/chevre/aggregation/createAggregateEventTasks.ts +1 -1
- package/example/src/chevre/authorizeEventServiceOffer.ts +119 -0
- package/example/src/chevre/findAnyEventById.ts +1 -1
- package/example/src/chevre/findReservationByCode.ts +0 -1
- package/example/src/chevre/productOffer/publishMemberTierToken.ts +92 -0
- package/example/src/chevre/reIndex.ts +3 -1
- package/example/src/chevre/roles/addAdminProductOfferPermissionIfNotExists.ts +48 -0
- package/example/src/chevre/roles/removeConsolePermissionIfExists.ts +1 -2
- package/example/src/chevre/updateEventPartiallyById.ts +1 -1
- package/lib/chevre/factory/event.d.ts +2 -4
- package/lib/chevre/repo/accountingReport.d.ts +4 -4
- package/lib/chevre/repo/accountingReport.js +1 -1
- package/lib/chevre/repo/action.d.ts +1 -1
- package/lib/chevre/repo/aggregateReservation.d.ts +2 -2
- package/lib/chevre/repo/creativeWork.d.ts +1 -3
- package/lib/chevre/repo/creativeWork.js +65 -47
- package/lib/chevre/repo/event.d.ts +44 -48
- package/lib/chevre/repo/event.js +13 -111
- package/lib/chevre/repo/eventSeries.d.ts +14 -14
- package/lib/chevre/repo/mongoose/schemas/accountingReport.d.ts +2 -15
- package/lib/chevre/repo/mongoose/schemas/aggregateReservation.d.ts +1 -1
- package/lib/chevre/repo/mongoose/schemas/event.d.ts +2 -5
- package/lib/chevre/repo/mongoose/schemas/eventSeries.d.ts +1 -1
- package/lib/chevre/repo/mongoose/schemas/place.js +13 -14
- package/lib/chevre/repo/mongoose/schemas/product.js +14 -4
- package/lib/chevre/repo/mongoose/schemas/{offer/event.d.ts → productOffer.d.ts} +6 -3
- package/lib/chevre/repo/mongoose/schemas/{offer/event.js → productOffer.js} +26 -29
- package/lib/chevre/repo/mongoose/schemas/seller.js +17 -6
- package/lib/chevre/repo/productOffer.d.ts +36 -61
- package/lib/chevre/repo/productOffer.js +163 -157
- package/lib/chevre/repository.d.ts +0 -5
- package/lib/chevre/repository.js +2 -15
- package/lib/chevre/service/aggregation/event/aggregateOffers.d.ts +1 -1
- package/lib/chevre/service/aggregation/event/aggregateOffers.js +2 -6
- package/lib/chevre/service/aggregation/event/aggregateScreeningEvent.js +3 -19
- package/lib/chevre/service/assetTransaction/reserve/start/createSubReservations.d.ts +1 -3
- package/lib/chevre/service/assetTransaction/reserve/start/factory/createReservation.d.ts +1 -1
- package/lib/chevre/service/assetTransaction/reserve/start/factory/createStartParams.d.ts +1 -1
- package/lib/chevre/service/assetTransaction/reserve/start/factory/createStartParams.js +1 -6
- package/lib/chevre/service/assetTransaction/reserve/start.d.ts +0 -2
- package/lib/chevre/service/assetTransaction/reserve/start.js +4 -4
- package/lib/chevre/service/assetTransaction/reserve/validateStartRequest.d.ts +3 -3
- package/lib/chevre/service/assetTransaction/reserve/validateStartRequest.js +57 -32
- package/lib/chevre/service/offer/event/authorize/factory.d.ts +2 -2
- package/lib/chevre/service/offer/event/authorize/factory.js +2 -2
- package/lib/chevre/service/offer/event/authorize/processStartReserve4chevre.d.ts +2 -4
- package/lib/chevre/service/offer/event/authorize/processStartReserve4chevre.js +2 -2
- package/lib/chevre/service/offer/event/authorize.d.ts +0 -2
- package/lib/chevre/service/offer/event/authorize.js +2 -2
- package/lib/chevre/service/offer/event/checkAvailability.d.ts +1 -1
- package/lib/chevre/service/offer/event/searchEventTicketOffers.d.ts +1 -1
- package/lib/chevre/service/offer/event/searchOffersByIds.d.ts +1 -1
- package/lib/chevre/service/offer/eventServiceByCOA/authorize/factory.d.ts +1 -1
- package/lib/chevre/service/offer/onEventChanged.js +2 -19
- package/lib/chevre/service/offer/product.d.ts +0 -3
- package/lib/chevre/service/offer/product.js +29 -38
- package/lib/chevre/service/order/createAccountingReportIfNotExist.js +0 -1
- package/lib/chevre/service/order/onOrderStatusChanged/onOrderPaymentDue.js +2 -2
- package/lib/chevre/service/order/onOrderStatusChanged/onOrderProcessing/factory.js +1 -1
- package/lib/chevre/service/payment/movieTicket/factory.d.ts +2 -2
- package/lib/chevre/service/payment/movieTicket/processPurchaseNumberAuth.d.ts +1 -1
- package/lib/chevre/service/reserve/useReservation.js +2 -3
- package/lib/chevre/service/reserve/verifyToken4reservation.d.ts +0 -2
- package/lib/chevre/service/task/checkResource.d.ts +2 -2
- package/lib/chevre/service/task/checkResource.js +8 -6
- package/lib/chevre/service/task/createAccountingReport.d.ts +2 -2
- package/lib/chevre/service/task/createAccountingReport.js +15 -15
- package/lib/chevre/service/task/createEvent/createEventBySchedule/factory.d.ts +1 -1
- package/lib/chevre/service/task/createEvent/createEventBySchedule.d.ts +1 -1
- package/lib/chevre/service/task/createEvent/createEventBySchedule.js +3 -2
- package/lib/chevre/service/task/createEvent/createEventSeries.d.ts +1 -1
- package/lib/chevre/service/task/onResourceUpdated/onResourceDeleted.js +7 -6
- package/lib/chevre/service/task/useReservation.js +1 -2
- package/lib/chevre/service/taskHandler.js +2 -0
- package/lib/chevre/service/transaction/returnOrder/potentialActions/returnPointAward.d.ts +0 -1
- package/package.json +3 -3
- package/example/src/chevre/eventOffer/adminEventOffers.ts +0 -67
- package/example/src/chevre/roles/addPermissionIfNotExists.ts +0 -48
- package/example/src/chevre/upsertMoviesByIdentifier.ts +0 -58
- package/lib/chevre/repo/offer/event.d.ts +0 -38
- package/lib/chevre/repo/offer/event.js +0 -142
|
@@ -8,7 +8,6 @@ import type { OrderInTransactionRepo } from '../../repo/orderInTransaction';
|
|
|
8
8
|
import type { OrderNumberRepo } from '../../repo/orderNumber';
|
|
9
9
|
import type { OwnershipInfoRepo } from '../../repo/ownershipInfo';
|
|
10
10
|
import type { ProductRepo } from '../../repo/product';
|
|
11
|
-
import type { ProductOfferRepo } from '../../repo/productOffer';
|
|
12
11
|
import type { ProjectRepo } from '../../repo/project';
|
|
13
12
|
import type { ServiceOutputRepo } from '../../repo/serviceOutput';
|
|
14
13
|
import type { ServiceOutputIdentifierRepo } from '../../repo/serviceOutputIdentifier';
|
|
@@ -24,7 +23,6 @@ export interface IAuthorizeOperationRepos {
|
|
|
24
23
|
orderNumber: OrderNumberRepo;
|
|
25
24
|
ownershipInfo: OwnershipInfoRepo;
|
|
26
25
|
product: ProductRepo;
|
|
27
|
-
productOffer: ProductOfferRepo;
|
|
28
26
|
project: ProjectRepo;
|
|
29
27
|
serviceOutput: ServiceOutputRepo;
|
|
30
28
|
serviceOutputIdentifier: ServiceOutputIdentifierRepo;
|
|
@@ -65,7 +63,6 @@ export declare function search(params: {
|
|
|
65
63
|
offer: OfferRepo;
|
|
66
64
|
offerCatalog: OfferCatalogRepo;
|
|
67
65
|
product: ProductRepo;
|
|
68
|
-
productOffer: ProductOfferRepo;
|
|
69
66
|
}) => Promise<{
|
|
70
67
|
offers: factory.product.ITicketOffer[];
|
|
71
68
|
product: Pick<factory.product.IProduct, "id" | "productID" | "typeOf" | "name" | "project" | "serviceOutput" | "serviceType" | "description">;
|
|
@@ -13,7 +13,6 @@ exports.ERROR_MESSAGE_ALREADY_REGISTERED = void 0;
|
|
|
13
13
|
exports.search = search;
|
|
14
14
|
exports.authorize = authorize;
|
|
15
15
|
exports.voidTransaction = voidTransaction;
|
|
16
|
-
const moment = require("moment");
|
|
17
16
|
const factory = require("../../factory");
|
|
18
17
|
const accountTransactionIdentifier_1 = require("../../factory/accountTransactionIdentifier");
|
|
19
18
|
const availableProductTypes_1 = require("../../factory/availableProductTypes");
|
|
@@ -28,8 +27,8 @@ exports.ERROR_MESSAGE_ALREADY_REGISTERED = 'Already registered';
|
|
|
28
27
|
*/
|
|
29
28
|
function search(params) {
|
|
30
29
|
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
30
|
+
// const now = moment();
|
|
31
31
|
var _a;
|
|
32
|
-
const now = moment();
|
|
33
32
|
const searchProductsResult = yield repos.product.projectFields({
|
|
34
33
|
limit: 1,
|
|
35
34
|
page: 1,
|
|
@@ -47,28 +46,24 @@ function search(params) {
|
|
|
47
46
|
|| product.typeOf === factory.product.ProductType.PaymentCard) {
|
|
48
47
|
const sellerId = (_a = params.seller) === null || _a === void 0 ? void 0 : _a.id;
|
|
49
48
|
if (typeof sellerId === 'string') {
|
|
50
|
-
//
|
|
51
|
-
//
|
|
49
|
+
// productsドキュメント参照のoffers検証は廃止(2025-09-22~)
|
|
50
|
+
// const productOffers = await repos.productOffer.search({
|
|
51
|
+
// project: { id: { $eq: params.project.id } },
|
|
52
|
+
// itemOffered: { id: { $eq: params.itemOffered.id } },
|
|
53
|
+
// seller: { id: { $eq: sellerId } }
|
|
54
|
+
// });
|
|
55
|
+
// const hasValidOffer = productOffers.some((o) => {
|
|
56
|
+
// return o.seller?.id === sellerId
|
|
57
|
+
// && o.validFrom !== undefined
|
|
58
|
+
// && moment(o.validFrom)
|
|
59
|
+
// .isSameOrBefore(now)
|
|
60
|
+
// && o.validThrough !== undefined
|
|
61
|
+
// && moment(o.validThrough)
|
|
62
|
+
// .isSameOrAfter(now);
|
|
63
|
+
// });
|
|
64
|
+
// if (!hasValidOffer) {
|
|
52
65
|
// return { offers: [], product };
|
|
53
66
|
// }
|
|
54
|
-
const productOffers = yield repos.productOffer.search({
|
|
55
|
-
project: { id: { $eq: params.project.id } },
|
|
56
|
-
itemOffered: { id: { $eq: params.itemOffered.id } },
|
|
57
|
-
seller: { id: { $eq: sellerId } }
|
|
58
|
-
});
|
|
59
|
-
const hasValidOffer = productOffers.some((o) => {
|
|
60
|
-
var _a;
|
|
61
|
-
return ((_a = o.seller) === null || _a === void 0 ? void 0 : _a.id) === sellerId
|
|
62
|
-
&& o.validFrom !== undefined
|
|
63
|
-
&& moment(o.validFrom)
|
|
64
|
-
.isSameOrBefore(now)
|
|
65
|
-
&& o.validThrough !== undefined
|
|
66
|
-
&& moment(o.validThrough)
|
|
67
|
-
.isSameOrAfter(now);
|
|
68
|
-
});
|
|
69
|
-
if (!hasValidOffer) {
|
|
70
|
-
return { offers: [], product };
|
|
71
|
-
}
|
|
72
67
|
}
|
|
73
68
|
}
|
|
74
69
|
const offers = yield (0, searchProductOffers_1.searchProductOffers)({
|
|
@@ -282,7 +277,7 @@ function processVoidRegisterServiceTransaction(params) {
|
|
|
282
277
|
* 受け入れらたオファーの内容を検証
|
|
283
278
|
*/
|
|
284
279
|
function validateAcceptedOffers(params) {
|
|
285
|
-
return (
|
|
280
|
+
return (__) => __awaiter(this, void 0, void 0, function* () {
|
|
286
281
|
let acceptedOfferWithoutDetail = params.object;
|
|
287
282
|
if (!Array.isArray(acceptedOfferWithoutDetail)) {
|
|
288
283
|
acceptedOfferWithoutDetail = [acceptedOfferWithoutDetail];
|
|
@@ -297,22 +292,18 @@ function validateAcceptedOffers(params) {
|
|
|
297
292
|
typeOf: params.seller.typeOf
|
|
298
293
|
};
|
|
299
294
|
// 販売者を検証
|
|
300
|
-
//
|
|
301
|
-
//
|
|
302
|
-
//
|
|
295
|
+
// productsドキュメント参照のoffers検証は廃止(2025-09-22~)
|
|
296
|
+
// const productOffers = await repos.productOffer.search({
|
|
297
|
+
// project: { id: { $eq: params.product.project.id } },
|
|
298
|
+
// itemOffered: { id: { $eq: String(params.product.id) } },
|
|
299
|
+
// seller: { id: { $eq: params.seller.id } }
|
|
300
|
+
// });
|
|
301
|
+
// const hasValidOffer = productOffers.some((o) => {
|
|
302
|
+
// return o.seller?.id === params.seller.id;
|
|
303
|
+
// });
|
|
304
|
+
// if (!hasValidOffer) {
|
|
305
|
+
// throw new factory.errors.Argument('Product', 'Product has no valid offer');
|
|
303
306
|
// }
|
|
304
|
-
const productOffers = yield repos.productOffer.search({
|
|
305
|
-
project: { id: { $eq: params.product.project.id } },
|
|
306
|
-
itemOffered: { id: { $eq: String(params.product.id) } },
|
|
307
|
-
seller: { id: { $eq: params.seller.id } }
|
|
308
|
-
});
|
|
309
|
-
const hasValidOffer = productOffers.some((o) => {
|
|
310
|
-
var _a;
|
|
311
|
-
return ((_a = o.seller) === null || _a === void 0 ? void 0 : _a.id) === params.seller.id;
|
|
312
|
-
});
|
|
313
|
-
if (!hasValidOffer) {
|
|
314
|
-
throw new factory.errors.Argument('Product', 'Product has no valid offer');
|
|
315
|
-
}
|
|
316
307
|
// 利用可能なチケットオファーであれば受け入れる
|
|
317
308
|
return Promise.all(acceptedOfferWithoutDetail.map((offerWithoutDetail) => {
|
|
318
309
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
@@ -12,7 +12,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
12
12
|
exports.createAccountingReportIfNotExist = createAccountingReportIfNotExist;
|
|
13
13
|
const moment = require("moment-timezone");
|
|
14
14
|
const factory = require("../../factory");
|
|
15
|
-
// import { createMaskedCustomer } from '../../factory/order';
|
|
16
15
|
function createAccountingReportIfNotExist(params) {
|
|
17
16
|
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
18
17
|
const order4report = createOrder4report(params);
|
|
@@ -116,8 +116,8 @@ function createCreateAccountingReportTask(order) {
|
|
|
116
116
|
numberOfTried: 0,
|
|
117
117
|
executionResults: [],
|
|
118
118
|
data: {
|
|
119
|
-
object: { mainEntity: { orderNumber: order.orderNumber } }
|
|
120
|
-
project: { id: order.project.id }
|
|
119
|
+
object: { mainEntity: { orderNumber: order.orderNumber } }
|
|
120
|
+
// project: { id: order.project.id }
|
|
121
121
|
}
|
|
122
122
|
};
|
|
123
123
|
return [task];
|
|
@@ -127,7 +127,7 @@ function createCheckResourceTask(order) {
|
|
|
127
127
|
orderNumber: order.orderNumber,
|
|
128
128
|
typeOf: order.typeOf
|
|
129
129
|
},
|
|
130
|
-
project: order.project,
|
|
130
|
+
// project: order.project,
|
|
131
131
|
typeOf: factory.actionType.CheckAction
|
|
132
132
|
};
|
|
133
133
|
const taskIdentifier = util.format('%s:%s:%s:%s', order.project.id, factory.taskName.CheckResource, order.typeOf, order.orderNumber);
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import * as surfrock from '@surfrock/sdk';
|
|
2
2
|
import * as factory from '../../../factory';
|
|
3
3
|
import { IMinimizedIndividualEvent } from '../../../factory/event';
|
|
4
|
-
type IEvent4seatInfoSync = Pick<IMinimizedIndividualEvent
|
|
5
|
-
location: Pick<factory.event.
|
|
4
|
+
type IEvent4seatInfoSync = Pick<IMinimizedIndividualEvent, 'id' | 'coaInfo' | 'startDate'> & {
|
|
5
|
+
location: Pick<factory.event.screeningEvent.ILocation, 'branchCode'>;
|
|
6
6
|
offers: {
|
|
7
7
|
offeredThrough?: factory.event.screeningEvent.IOfferedThrough | factory.event.screeningEvent.IOffer4COA['offeredThrough'];
|
|
8
8
|
};
|
|
@@ -8,7 +8,7 @@ interface ICheckResult {
|
|
|
8
8
|
purchaseNumberAuthIn: factory.action.check.paymentMethod.movieTicket.IPurchaseNumberAuthIn;
|
|
9
9
|
purchaseNumberAuthResult: factory.action.check.paymentMethod.movieTicket.IPurchaseNumberAuthResult;
|
|
10
10
|
}
|
|
11
|
-
type IEvent4checkByIdentifier = Pick<IMinimizedIndividualEvent
|
|
11
|
+
type IEvent4checkByIdentifier = Pick<IMinimizedIndividualEvent, 'id' | 'typeOf' | 'project' | 'coaInfo' | 'startDate'> & {
|
|
12
12
|
offers: {
|
|
13
13
|
offeredThrough?: factory.event.screeningEvent.IOfferedThrough | factory.event.screeningEvent.IOffer4COA['offeredThrough'];
|
|
14
14
|
};
|
|
@@ -28,8 +28,7 @@ function useReservation(params) {
|
|
|
28
28
|
// const ticketToken = params?.instrument?.ticketToken;
|
|
29
29
|
if (Array.isArray(params.instrument)) {
|
|
30
30
|
for (const eachInstrument of params.instrument) {
|
|
31
|
-
if (eachInstrument.typeOf ===
|
|
32
|
-
&& typeof eachInstrument.ticketToken === 'string') {
|
|
31
|
+
if (eachInstrument.typeOf === 'Ticket' && typeof eachInstrument.ticketToken === 'string') {
|
|
33
32
|
ticketToken = eachInstrument.ticketToken;
|
|
34
33
|
break;
|
|
35
34
|
}
|
|
@@ -62,7 +61,7 @@ function useReservation(params) {
|
|
|
62
61
|
};
|
|
63
62
|
// extend instrument to array(2025-02-18~)
|
|
64
63
|
const instrument = [
|
|
65
|
-
Object.assign(Object.assign({}, (typeof ticketToken === 'string') ? { ticketToken } : undefined), { typeOf:
|
|
64
|
+
Object.assign(Object.assign({}, (typeof ticketToken === 'string') ? { ticketToken } : undefined), { typeOf: 'Ticket' }),
|
|
66
65
|
// support orderAsInstrument(2025-02-18~)
|
|
67
66
|
...(Array.isArray(params.instrument))
|
|
68
67
|
? params.instrument.filter(({ typeOf }) => typeOf === factory.order.OrderType.Order)
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import * as factory from '../../factory';
|
|
2
1
|
import type { AuthorizationRepo } from '../../repo/authorization';
|
|
3
2
|
import type { OrderRepo } from '../../repo/order';
|
|
4
3
|
import type { TicketRepo } from '../../repo/ticket';
|
|
@@ -12,7 +11,6 @@ export declare function verifyToken4reservation(params: {
|
|
|
12
11
|
seller?: {
|
|
13
12
|
id?: string;
|
|
14
13
|
};
|
|
15
|
-
agent: factory.action.check.token.IAgent;
|
|
16
14
|
reservationId: string;
|
|
17
15
|
ticket: {
|
|
18
16
|
/**
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as factory from '../../factory';
|
|
2
|
-
import type { IOperationExecute } from '../taskHandler';
|
|
2
|
+
import type { ICallResult, IExecutableTaskKeys, IOperationExecute } from '../taskHandler';
|
|
3
3
|
/**
|
|
4
4
|
* タスク実行関数
|
|
5
5
|
*/
|
|
6
|
-
export declare function call(
|
|
6
|
+
export declare function call(params: Pick<factory.task.checkResource.ITask, IExecutableTaskKeys>): IOperationExecute<ICallResult>;
|
|
@@ -24,17 +24,19 @@ const validateOrder_1 = require("../validation/validateOrder");
|
|
|
24
24
|
/**
|
|
25
25
|
* タスク実行関数
|
|
26
26
|
*/
|
|
27
|
-
function call(
|
|
27
|
+
function call(params) {
|
|
28
28
|
return (_a) => __awaiter(this, [_a], void 0, function* ({ connection, redisClient }) {
|
|
29
29
|
if (redisClient === undefined) {
|
|
30
30
|
throw new factory.errors.Argument('settings', 'redisClient required');
|
|
31
31
|
}
|
|
32
32
|
const actionRepo = new action_1.ActionRepo(connection);
|
|
33
|
+
const { data } = params;
|
|
33
34
|
const actionAttributes = {
|
|
34
|
-
agent: { id:
|
|
35
|
+
agent: { id: params.project.id, typeOf: factory.organizationType.Project },
|
|
35
36
|
object: data.object,
|
|
36
|
-
project: { id:
|
|
37
|
-
typeOf: factory.actionType.CheckAction
|
|
37
|
+
project: { id: params.project.id, typeOf: factory.organizationType.Project },
|
|
38
|
+
typeOf: factory.actionType.CheckAction,
|
|
39
|
+
sameAs: { id: params.id, typeOf: 'Task' } // add sameAs(2025-09-22~)
|
|
38
40
|
};
|
|
39
41
|
const action = yield actionRepo.start(actionAttributes);
|
|
40
42
|
const objectTypeOf = data.object.typeOf;
|
|
@@ -43,7 +45,7 @@ function call(data) {
|
|
|
43
45
|
case factory.order.OrderType.Order:
|
|
44
46
|
yield (0, validateOrder_1.validateOrder)({
|
|
45
47
|
orderNumber: data.object.orderNumber,
|
|
46
|
-
project: { id:
|
|
48
|
+
project: { id: params.project.id }
|
|
47
49
|
})({
|
|
48
50
|
acceptedOffer: new acceptedOffer_1.AcceptedOfferRepo(connection),
|
|
49
51
|
assetTransaction: new assetTransaction_1.AssetTransactionRepo(connection),
|
|
@@ -56,7 +58,7 @@ function call(data) {
|
|
|
56
58
|
case factory.eventType.ScreeningEvent:
|
|
57
59
|
yield (0, validateEvent_1.validateEvent)({
|
|
58
60
|
id: data.object.id,
|
|
59
|
-
project: { id:
|
|
61
|
+
project: { id: params.project.id }
|
|
60
62
|
})({
|
|
61
63
|
event: new event_1.EventRepo(connection),
|
|
62
64
|
stockHolder: new stockHolder_1.StockHolderRepo({ connection })
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type { IOperationExecute } from '../taskHandler';
|
|
1
|
+
import type { ICallResult, IExecutableTaskKeys, IOperationExecute } from '../taskHandler';
|
|
2
2
|
import * as factory from '../../factory';
|
|
3
3
|
/**
|
|
4
4
|
* タスク実行関数
|
|
5
5
|
*/
|
|
6
|
-
export declare function call(
|
|
6
|
+
export declare function call(params: Pick<factory.task.ITask<factory.taskName.CreateAccountingReport>, IExecutableTaskKeys>): IOperationExecute<ICallResult>;
|
|
@@ -19,9 +19,9 @@ const createAccountingReportIfNotExist_1 = require("../order/createAccountingRep
|
|
|
19
19
|
/**
|
|
20
20
|
* タスク実行関数
|
|
21
21
|
*/
|
|
22
|
-
function call(
|
|
22
|
+
function call(params) {
|
|
23
23
|
return (_a) => __awaiter(this, [_a], void 0, function* ({ connection }) {
|
|
24
|
-
yield createAccountingReport(
|
|
24
|
+
yield createAccountingReport(params)({
|
|
25
25
|
acceptedOffer: new acceptedOffer_1.AcceptedOfferRepo(connection),
|
|
26
26
|
accountingReport: new accountingReport_1.AccountingReportRepo(connection),
|
|
27
27
|
action: new action_1.ActionRepo(connection),
|
|
@@ -31,8 +31,9 @@ function call(data) {
|
|
|
31
31
|
}
|
|
32
32
|
function createAccountingReport(params) {
|
|
33
33
|
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
34
|
+
const { data } = params;
|
|
34
35
|
const order = yield repos.order.projectFieldsByOrderNumber({
|
|
35
|
-
orderNumber:
|
|
36
|
+
orderNumber: data.object.mainEntity.orderNumber,
|
|
36
37
|
project: { id: params.project.id },
|
|
37
38
|
inclusion: [
|
|
38
39
|
'orderNumber', 'project', 'customer', 'confirmationNumber',
|
|
@@ -41,28 +42,26 @@ function createAccountingReport(params) {
|
|
|
41
42
|
});
|
|
42
43
|
const simpleOrder = {
|
|
43
44
|
typeOf: order.typeOf,
|
|
44
|
-
// seller: {
|
|
45
|
-
// id: order.seller.id,
|
|
46
|
-
// typeOf: order.seller.typeOf,
|
|
47
|
-
// name: order.seller.name
|
|
48
|
-
// }, // 廃止(2024-03-06~)
|
|
49
|
-
// customer: { typeOf: order.customer.typeOf, id: order.customer.id }, // 廃止(2024-03-06~)
|
|
50
45
|
orderNumber: order.orderNumber,
|
|
51
|
-
// price: order.price,
|
|
52
|
-
// priceCurrency: order.priceCurrency,
|
|
53
46
|
orderDate: order.orderDate
|
|
54
47
|
};
|
|
48
|
+
const actionObject = {
|
|
49
|
+
// ...params,
|
|
50
|
+
mainEntity: { orderNumber: simpleOrder.orderNumber },
|
|
51
|
+
typeOf: 'Report'
|
|
52
|
+
};
|
|
55
53
|
const actionAttributes = {
|
|
56
54
|
project: { id: params.project.id, typeOf: factory.organizationType.Project },
|
|
57
55
|
typeOf: factory.actionType.CreateAction,
|
|
58
56
|
agent: { id: params.project.id, typeOf: factory.organizationType.Project },
|
|
59
|
-
object:
|
|
60
|
-
purpose: simpleOrder
|
|
57
|
+
object: actionObject,
|
|
58
|
+
purpose: simpleOrder,
|
|
59
|
+
sameAs: { id: params.id, typeOf: 'Task' } // add sameAs(2025-09-21~)
|
|
61
60
|
};
|
|
62
61
|
const action = yield repos.action.start(actionAttributes);
|
|
63
62
|
try {
|
|
64
63
|
const acceptedOffers = yield repos.acceptedOffer.searchAcceptedOffersByOrderNumber({
|
|
65
|
-
orderNumber: { $eq:
|
|
64
|
+
orderNumber: { $eq: data.object.mainEntity.orderNumber },
|
|
66
65
|
project: { id: { $eq: params.project.id } }
|
|
67
66
|
});
|
|
68
67
|
yield (0, createAccountingReportIfNotExist_1.createAccountingReportIfNotExist)(Object.assign(Object.assign({}, order), { acceptedOffers }))(repos);
|
|
@@ -76,6 +75,7 @@ function createAccountingReport(params) {
|
|
|
76
75
|
}
|
|
77
76
|
throw error;
|
|
78
77
|
}
|
|
79
|
-
|
|
78
|
+
const result = {};
|
|
79
|
+
yield repos.action.completeWithVoid({ typeOf: action.typeOf, id: action.id, result });
|
|
80
80
|
});
|
|
81
81
|
}
|
|
@@ -5,7 +5,7 @@ declare function tour2creatingEvent(tour: ITourBySchedule, movieTheater: Pick<fa
|
|
|
5
5
|
member: ICustomerMember;
|
|
6
6
|
}[], maxValue: number, eventService: Pick<factory.product.IProduct, 'id' | 'name'> & {
|
|
7
7
|
id: string;
|
|
8
|
-
}, screeningEventSeries: Pick<factory.
|
|
8
|
+
}, screeningEventSeries: Pick<factory.eventSeries.IEvent, 'location' | 'additionalProperty' | 'description' | 'endDate' | 'headline' | 'id' | 'kanaName' | 'name' | 'soundFormat' | 'startDate' | 'typeOf' | 'videoFormat' | 'workPerformed'>, project: {
|
|
9
9
|
id: string;
|
|
10
10
|
}): ICreatingEvent4ttts;
|
|
11
11
|
interface ITourBySchedule {
|
|
@@ -10,7 +10,7 @@ import type { ScheduleRepo } from '../../../repo/schedule';
|
|
|
10
10
|
import type { SettingRepo } from '../../../repo/setting';
|
|
11
11
|
import type { TaskRepo } from '../../../repo/task';
|
|
12
12
|
import * as factory from '../../../factory';
|
|
13
|
-
export declare function createEventBySchedule(params: factory.task.createEvent.
|
|
13
|
+
export declare function createEventBySchedule(params: factory.task.createEvent.IAddEventByScheduleAction): (repos: {
|
|
14
14
|
action: ActionRepo;
|
|
15
15
|
event: EventRepo;
|
|
16
16
|
eventSeries: EventSeriesRepo;
|
|
@@ -34,9 +34,10 @@ function updateEvent4ttts(params) {
|
|
|
34
34
|
// replacee: reservation,
|
|
35
35
|
// replacer: params.attributes, // $unsetもありうるのでいったん保留
|
|
36
36
|
targetCollection: {
|
|
37
|
-
id: params.attributes.identifier,
|
|
37
|
+
// id: params.attributes.identifier,
|
|
38
38
|
typeOf: factory.eventType.ScreeningEvent
|
|
39
|
-
}
|
|
39
|
+
},
|
|
40
|
+
instrument: { typeOf: 'Task' }
|
|
40
41
|
};
|
|
41
42
|
const action = yield repos.action.start(actionAttributes);
|
|
42
43
|
let savedEvent;
|
|
@@ -4,7 +4,7 @@ import type { EventRepo } from '../../../repo/event';
|
|
|
4
4
|
import type { EventSeriesRepo } from '../../../repo/eventSeries';
|
|
5
5
|
import type { MovieTheaterRepo } from '../../../repo/place/movieTheater';
|
|
6
6
|
import type { TaskRepo } from '../../../repo/task';
|
|
7
|
-
export declare function createEventSeries(params: factory.task.createEvent.
|
|
7
|
+
export declare function createEventSeries(params: factory.task.createEvent.IAddEventSeriesAction): (repos: {
|
|
8
8
|
action: ActionRepo;
|
|
9
9
|
event: EventRepo;
|
|
10
10
|
eventSeries: EventSeriesRepo;
|
|
@@ -252,11 +252,6 @@ function deleteResourcesBySeller(params) {
|
|
|
252
252
|
project: { id: params.project.id },
|
|
253
253
|
id: sellerId
|
|
254
254
|
});
|
|
255
|
-
// プロダクトオファー削除
|
|
256
|
-
const deleteProductOfferResult = yield repos.productOffer.deleteManyBySellerId({
|
|
257
|
-
project: { id: params.project.id },
|
|
258
|
-
seller: { id: sellerId }
|
|
259
|
-
});
|
|
260
255
|
// イベント削除
|
|
261
256
|
const deleteEventResult = yield repos.event.deleteManyEventByOrganizerId({
|
|
262
257
|
project: { id: params.project.id },
|
|
@@ -277,8 +272,14 @@ function deleteResourcesBySeller(params) {
|
|
|
277
272
|
project: { id: params.project.id },
|
|
278
273
|
parentOrganization: { id: sellerId }
|
|
279
274
|
});
|
|
275
|
+
// プロダクトオファー削除(2025-10-02~)
|
|
276
|
+
const deleteProductOfferResult = yield repos.productOffer.deleteProductOffersBySeller({
|
|
277
|
+
project: { id: params.project.id },
|
|
278
|
+
offeredBy: { id: sellerId }
|
|
279
|
+
});
|
|
280
280
|
deleteResult = {
|
|
281
|
-
deleteMemberResult, deletePaymentServiceProviderResult,
|
|
281
|
+
deleteMemberResult, deletePaymentServiceProviderResult,
|
|
282
|
+
deleteProductOfferResult,
|
|
282
283
|
deleteEventResult, deleteEventSeriesResult, deleteScreeningRoomResult, deleteMovieTheaterResult
|
|
283
284
|
};
|
|
284
285
|
}
|
|
@@ -10,7 +10,6 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
exports.call = call;
|
|
13
|
-
const factory = require("../../factory");
|
|
14
13
|
const action_1 = require("../../repo/action");
|
|
15
14
|
const assetTransaction_1 = require("../../repo/assetTransaction");
|
|
16
15
|
const authorization_1 = require("../../repo/authorization");
|
|
@@ -31,7 +30,7 @@ function call(data) {
|
|
|
31
30
|
instrument = data.instrument;
|
|
32
31
|
}
|
|
33
32
|
else {
|
|
34
|
-
if (((_b = data.instrument) === null || _b === void 0 ? void 0 : _b.typeOf) ===
|
|
33
|
+
if (((_b = data.instrument) === null || _b === void 0 ? void 0 : _b.typeOf) === 'Ticket') {
|
|
35
34
|
instrument = [data.instrument];
|
|
36
35
|
}
|
|
37
36
|
}
|
|
@@ -50,6 +50,8 @@ function executeTask(task, next) {
|
|
|
50
50
|
case factory.taskName.AuthorizePayment:
|
|
51
51
|
case factory.taskName.CancelPendingReservation:
|
|
52
52
|
case factory.taskName.CheckMovieTicket:
|
|
53
|
+
case factory.taskName.CheckResource:
|
|
54
|
+
case factory.taskName.CreateAccountingReport:
|
|
53
55
|
case factory.taskName.DeletePerson:
|
|
54
56
|
case factory.taskName.HandleNotification:
|
|
55
57
|
case factory.taskName.ImportEventCapacitiesFromCOA:
|
package/package.json
CHANGED
|
@@ -11,8 +11,8 @@
|
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"@aws-sdk/client-cognito-identity-provider": "3.600.0",
|
|
13
13
|
"@aws-sdk/credential-providers": "3.600.0",
|
|
14
|
-
"@chevre/factory": "
|
|
15
|
-
"@cinerino/sdk": "12.
|
|
14
|
+
"@chevre/factory": "5.0.0-alpha.0",
|
|
15
|
+
"@cinerino/sdk": "12.5.0-alpha.1",
|
|
16
16
|
"@motionpicture/coa-service": "9.6.0",
|
|
17
17
|
"@motionpicture/gmo-service": "5.4.0-alpha.1",
|
|
18
18
|
"@sendgrid/client": "8.1.4",
|
|
@@ -115,5 +115,5 @@
|
|
|
115
115
|
"postversion": "git push origin --tags",
|
|
116
116
|
"prepublishOnly": "npm run clean && npm run build && npm test && npm run doc"
|
|
117
117
|
},
|
|
118
|
-
"version": "
|
|
118
|
+
"version": "23.0.0-alpha.0"
|
|
119
119
|
}
|
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
// tslint:disable:no-console
|
|
2
|
-
import * as mongoose from 'mongoose';
|
|
3
|
-
|
|
4
|
-
import { chevre } from '../../../../lib/index';
|
|
5
|
-
|
|
6
|
-
const project = { id: String(process.env.PROJECT_ID) };
|
|
7
|
-
const IDENTIFIER = 'xxx';
|
|
8
|
-
|
|
9
|
-
async function main() {
|
|
10
|
-
await mongoose.connect(<string>process.env.MONGOLAB_URI, { autoIndex: false });
|
|
11
|
-
|
|
12
|
-
// const eventRepo = await chevre.repository.Event.createInstance(mongoose.connection);
|
|
13
|
-
const eventOfferRepo = await chevre.repository.EventOffer.createInstance(mongoose.connection);
|
|
14
|
-
|
|
15
|
-
let docs = await eventOfferRepo.projectFields(
|
|
16
|
-
{
|
|
17
|
-
project: { id: { $eq: project.id } },
|
|
18
|
-
identifier: { $eq: IDENTIFIER }
|
|
19
|
-
},
|
|
20
|
-
['availableAtOrFrom', 'identifier', 'itemOffered', 'project', 'validFrom']
|
|
21
|
-
);
|
|
22
|
-
console.log('docs:', docs);
|
|
23
|
-
console.log(docs.length, 'docs found');
|
|
24
|
-
|
|
25
|
-
if (docs.length > 0) {
|
|
26
|
-
await eventOfferRepo.deleteById({
|
|
27
|
-
project: { id: docs[0].project.id },
|
|
28
|
-
id: docs[0].id
|
|
29
|
-
});
|
|
30
|
-
console.log('deleted', docs[0].id);
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
await eventOfferRepo.save({
|
|
34
|
-
attributes: {
|
|
35
|
-
identifier: IDENTIFIER,
|
|
36
|
-
project: { id: project.id, typeOf: chevre.factory.organizationType.Project },
|
|
37
|
-
typeOf: chevre.factory.offerType.Offer,
|
|
38
|
-
itemOffered: {
|
|
39
|
-
id: 'xxxxx',
|
|
40
|
-
typeOf: chevre.factory.eventType.ScreeningEvent
|
|
41
|
-
},
|
|
42
|
-
seller: {
|
|
43
|
-
id: 'xxxxx',
|
|
44
|
-
typeOf: chevre.factory.organizationType.Organization
|
|
45
|
-
},
|
|
46
|
-
availableAtOrFrom: { id: 'xxx' },
|
|
47
|
-
validFrom: new Date(),
|
|
48
|
-
validThrough: new Date(),
|
|
49
|
-
validForMemberTier: { identifier: 'xxx', typeOf: 'MemberProgramTier' }
|
|
50
|
-
}
|
|
51
|
-
});
|
|
52
|
-
console.log('created.');
|
|
53
|
-
|
|
54
|
-
docs = await await eventOfferRepo.projectFields(
|
|
55
|
-
{
|
|
56
|
-
project: { id: { $eq: project.id } },
|
|
57
|
-
identifier: { $eq: IDENTIFIER }
|
|
58
|
-
},
|
|
59
|
-
['availableAtOrFrom', 'identifier', 'itemOffered', 'project', 'validFrom']
|
|
60
|
-
);
|
|
61
|
-
console.log('docs:', docs);
|
|
62
|
-
console.log(docs.length, 'docs found');
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
main()
|
|
66
|
-
.then()
|
|
67
|
-
.catch(console.error);
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
// tslint:disable:no-console
|
|
2
|
-
import * as mongoose from 'mongoose';
|
|
3
|
-
|
|
4
|
-
import { chevre } from '../../../../lib/index';
|
|
5
|
-
|
|
6
|
-
async function main() {
|
|
7
|
-
await mongoose.connect(<string>process.env.MONGOLAB_URI, { autoIndex: false });
|
|
8
|
-
|
|
9
|
-
const roleRepo = await chevre.repository.Role.createInstance(mongoose.connection);
|
|
10
|
-
|
|
11
|
-
const roleNames = [
|
|
12
|
-
chevre.factory.role.organizationRole.RoleName.AdminInventoryManager
|
|
13
|
-
];
|
|
14
|
-
const permissions = [
|
|
15
|
-
'admin.sellers.events.*'
|
|
16
|
-
];
|
|
17
|
-
for (const roleName of roleNames) {
|
|
18
|
-
for (const permission of permissions) {
|
|
19
|
-
const result = await roleRepo.addPermissionIfNotExists({
|
|
20
|
-
roleName: { $eq: roleName },
|
|
21
|
-
permission
|
|
22
|
-
});
|
|
23
|
-
console.log('permission added.', result, roleName);
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
// roleNames = [
|
|
28
|
-
// chevre.factory.role.organizationRole.RoleName.InventoryManager,
|
|
29
|
-
// chevre.factory.role.organizationRole.RoleName.SellersOwner,
|
|
30
|
-
// chevre.factory.role.organizationRole.RoleName.SellersInventoryManager
|
|
31
|
-
// ];
|
|
32
|
-
// permissions = [
|
|
33
|
-
// 'admin.sellers.eventSeries.*'
|
|
34
|
-
// ];
|
|
35
|
-
// for (const roleName of roleNames) {
|
|
36
|
-
// for (const permission of permissions) {
|
|
37
|
-
// const result = await roleRepo.addPermissionIfNotExists({
|
|
38
|
-
// roleName: { $eq: roleName },
|
|
39
|
-
// permission
|
|
40
|
-
// });
|
|
41
|
-
// console.log('permission added.', result, roleName);
|
|
42
|
-
// }
|
|
43
|
-
// }
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
main()
|
|
47
|
-
.then()
|
|
48
|
-
.catch(console.error);
|