@chevre/domain 24.1.0-alpha.1 → 24.1.0-alpha.11
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/README.md +0 -2
- package/lib/chevre/repo/acceptedOffer.d.ts +1 -1
- package/lib/chevre/repo/acceptedOffer.js +10 -10
- package/lib/chevre/repo/accountingReport.d.ts +9 -2
- package/lib/chevre/repo/accountingReport.js +30 -28
- package/lib/chevre/repo/action/actionProcess.d.ts +1 -1
- package/lib/chevre/repo/aggregateReservation.d.ts +6 -0
- package/lib/chevre/repo/aggregateReservation.js +9 -0
- package/lib/chevre/repo/assetTransaction/reserve.d.ts +1 -0
- package/lib/chevre/repo/assetTransaction/reserve.js +2 -1
- package/lib/chevre/repo/factory/reservation/createMongoConditions.js +155 -180
- package/lib/chevre/repo/mongoose/schemas/accountingReport.js +52 -51
- package/lib/chevre/repo/mongoose/schemas/order.js +108 -108
- package/lib/chevre/repo/mongoose/schemas/reservation.d.ts +1 -0
- package/lib/chevre/repo/mongoose/schemas/reservation.js +117 -117
- package/lib/chevre/repo/order.d.ts +2 -1
- package/lib/chevre/repo/order.js +171 -170
- package/lib/chevre/repo/project.d.ts +0 -3
- package/lib/chevre/repo/project.js +0 -10
- package/lib/chevre/repo/reservation.d.ts +3 -4
- package/lib/chevre/repo/reservation.js +13 -10
- package/lib/chevre/service/aggregation/event/aggregateOffers.js +17 -26
- package/lib/chevre/service/assetTransaction/cancelReservation/factory.js +14 -11
- package/lib/chevre/service/order/createAccountingReportIfNotExist.d.ts +1 -3
- package/lib/chevre/service/order/createAccountingReportIfNotExist.js +67 -72
- package/lib/chevre/service/reserve/confirmReservation.js +7 -7
- package/lib/chevre/service/reserve/factory.js +2 -1
- package/lib/chevre/service/reserve/findReservations.d.ts +3 -1
- package/lib/chevre/service/reserve/findReservations.js +11 -2
- package/lib/chevre/service/reserve/potentialActions/onReservationConfirmed.d.ts +2 -1
- package/lib/chevre/service/reserve/useReservation.d.ts +1 -1
- package/lib/chevre/service/reserve/useReservation.js +20 -24
- package/lib/chevre/service/task/createAccountingReport.js +11 -9
- package/lib/chevre/service/task/useReservation.d.ts +2 -2
- package/lib/chevre/service/task/useReservation.js +6 -18
- package/lib/chevre/service/taskHandler.js +1 -0
- package/package.json +2 -2
- package/lib/chevre/repo/mongoose/schemas/productModel.d.ts +0 -33
- package/lib/chevre/repo/mongoose/schemas/productModel.js +0 -57
|
@@ -19,84 +19,79 @@ function createAccountingReportIfNotExist(params) {
|
|
|
19
19
|
}
|
|
20
20
|
// 最適化(2023-06-30~)
|
|
21
21
|
function createOrder4report(params) {
|
|
22
|
-
if (!Array.isArray(params.acceptedOffers)) {
|
|
23
|
-
|
|
24
|
-
}
|
|
25
|
-
const numItems = params.acceptedOffers.length;
|
|
26
|
-
// 必要な属性についてDate型に変換(でないと検索クエリを効率的に使えない)
|
|
27
|
-
const acceptedOffers = (Array.isArray(params.acceptedOffers))
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
: []
|
|
76
|
-
};
|
|
22
|
+
// if (!Array.isArray(params.acceptedOffers)) {
|
|
23
|
+
// throw new factory.errors.ArgumentNull('order.acceptedOffers');
|
|
24
|
+
// }
|
|
25
|
+
// const numItems: number = params.acceptedOffers.length;
|
|
26
|
+
// // 必要な属性についてDate型に変換(でないと検索クエリを効率的に使えない)
|
|
27
|
+
// const acceptedOffers = (Array.isArray(params.acceptedOffers))
|
|
28
|
+
// ? params.acceptedOffers.map((o) => {
|
|
29
|
+
// if (o.itemOffered.typeOf === factory.reservationType.EventReservation) {
|
|
30
|
+
// let itemOffered = o.itemOffered;
|
|
31
|
+
// const reservationFor = itemOffered.reservationFor;
|
|
32
|
+
// itemOffered = {
|
|
33
|
+
// ...itemOffered,
|
|
34
|
+
// reservationFor: {
|
|
35
|
+
// ...reservationFor,
|
|
36
|
+
// ...(reservationFor.doorTime !== undefined)
|
|
37
|
+
// ? {
|
|
38
|
+
// doorTime: moment(reservationFor.doorTime)
|
|
39
|
+
// .toDate()
|
|
40
|
+
// }
|
|
41
|
+
// : undefined,
|
|
42
|
+
// ...(reservationFor.endDate !== undefined)
|
|
43
|
+
// ? {
|
|
44
|
+
// endDate: moment(reservationFor.endDate)
|
|
45
|
+
// .toDate()
|
|
46
|
+
// }
|
|
47
|
+
// : undefined,
|
|
48
|
+
// ...(reservationFor.startDate !== undefined)
|
|
49
|
+
// ? {
|
|
50
|
+
// startDate: moment(reservationFor.startDate)
|
|
51
|
+
// .toDate()
|
|
52
|
+
// }
|
|
53
|
+
// : undefined
|
|
54
|
+
// }
|
|
55
|
+
// } as factory.order.IReservation;
|
|
56
|
+
// return {
|
|
57
|
+
// ...o,
|
|
58
|
+
// itemOffered
|
|
59
|
+
// };
|
|
60
|
+
// } else {
|
|
61
|
+
// return o;
|
|
62
|
+
// }
|
|
63
|
+
// })
|
|
64
|
+
// : [];
|
|
65
|
+
// const customer: factory.report.accountingReport.IOptimizedCustomer = {
|
|
66
|
+
// id: params.customer.id,
|
|
67
|
+
// typeOf: params.customer.typeOf,
|
|
68
|
+
// additionalProperty: (Array.isArray(params.customer.additionalProperty))
|
|
69
|
+
// ? params.customer.additionalProperty
|
|
70
|
+
// : [],
|
|
71
|
+
// identifier: (Array.isArray(params.customer.identifier))
|
|
72
|
+
// ? params.customer.identifier
|
|
73
|
+
// : []
|
|
74
|
+
// };
|
|
77
75
|
return {
|
|
78
|
-
// ...params,
|
|
79
|
-
confirmationNumber: params.confirmationNumber,
|
|
80
76
|
id: params.id,
|
|
81
77
|
orderNumber: params.orderNumber,
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
78
|
+
paymentMethods: params.paymentMethods.map(({ paymentMethodId }) => ({ paymentMethodId })),
|
|
79
|
+
seller: {
|
|
80
|
+
id: params.seller.id,
|
|
81
|
+
name: params.seller.name,
|
|
82
|
+
typeOf: params.seller.typeOf
|
|
83
|
+
},
|
|
87
84
|
typeOf: params.typeOf,
|
|
88
|
-
customer,
|
|
89
85
|
orderDate: (0, moment_timezone_1.default)(params.orderDate)
|
|
90
86
|
.toDate(),
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
//
|
|
95
|
-
//
|
|
96
|
-
//
|
|
97
|
-
//
|
|
98
|
-
//
|
|
99
|
-
// : undefined
|
|
87
|
+
// confirmationNumber: params.confirmationNumber, // discontinue(2026-05-06~)
|
|
88
|
+
// price: params.price, // discontinue(2026-05-06~)
|
|
89
|
+
// priceCurrency: params.priceCurrency, // discontinue(2026-05-06~)
|
|
90
|
+
// customer, // discontinue(2026-05-06~)
|
|
91
|
+
// numItems, // discontinue(2026-05-06~)
|
|
92
|
+
// orderedItem: params.orderedItem, // discontinue(2026-05-06~)
|
|
93
|
+
// acceptedOffers, // discontinue(2026-05-06~)
|
|
94
|
+
// ...(typeof params.broker?.typeOf === 'string') ? { broker: params.broker } : undefined // discontinue(2026-05-06~)
|
|
100
95
|
};
|
|
101
96
|
}
|
|
102
97
|
function createAccountingReport(params) {
|
|
@@ -61,7 +61,8 @@ function confirmReservation(params) {
|
|
|
61
61
|
...rawReservation.reservedTicket,
|
|
62
62
|
ticketType: ticketTypeByTransaction
|
|
63
63
|
},
|
|
64
|
-
reservationFor: reserveTransaction.object.reservationFor // reservationForは予約取引から参照する(2026-04-05~)
|
|
64
|
+
reservationFor: reserveTransaction.object.reservationFor, // reservationForは予約取引から参照する(2026-04-05~)
|
|
65
|
+
issuedThrough: reserveTransaction.object.issuedThrough // issuedThroughは予約取引から補完する(2026-05-08~)
|
|
65
66
|
};
|
|
66
67
|
});
|
|
67
68
|
confirmedReservations = confirmedReservations.map((r) => {
|
|
@@ -189,25 +190,24 @@ params, options) {
|
|
|
189
190
|
if (reserveTransaction.object.disablePendingReservations === true) {
|
|
190
191
|
const reservationFor = reserveTransaction.object.reservationFor;
|
|
191
192
|
const subReservations = reserveTransaction.object.subReservation;
|
|
192
|
-
const issuedThrough = reserveTransaction.object.issuedThrough;
|
|
193
|
+
// const issuedThrough = reserveTransaction.object.issuedThrough;
|
|
193
194
|
if (Array.isArray(subReservations)
|
|
194
195
|
&& typeof reservationFor?.typeOf === 'string'
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
196
|
+
// && typeof issuedThrough?.typeOf === 'string'
|
|
197
|
+
) {
|
|
198
|
+
await repos.reservation.confirmManyIfNotExist({
|
|
198
199
|
bookingTime: reserveTransaction.startDate, // startDateに設定(2024-04-08~)
|
|
199
200
|
project: { id: reserveTransaction.project.id },
|
|
200
201
|
provider: (typeof reserveTransaction.object.provider?.id === 'string')
|
|
201
202
|
? reserveTransaction.object.provider
|
|
202
203
|
: { id: reserveTransaction.agent.id, typeOf: factory_1.factory.organizationType.Corporation },
|
|
203
204
|
subReservation: subReservations,
|
|
204
|
-
issuedThrough,
|
|
205
|
+
// issuedThrough,
|
|
205
206
|
reservationFor,
|
|
206
207
|
reservationNumber: reserveTransaction.object.reservationNumber,
|
|
207
208
|
underName,
|
|
208
209
|
broker: reserveTransaction.object.broker
|
|
209
210
|
});
|
|
210
|
-
debug('confirmManyIfNotExistResult:', confirmManyIfNotExistResult, 'reservationNumber:', reservationPackage.reservationNumber);
|
|
211
211
|
}
|
|
212
212
|
}
|
|
213
213
|
else {
|
|
@@ -21,7 +21,8 @@ function createCancelPendingReservationAction(params) {
|
|
|
21
21
|
const reservationPackage = {
|
|
22
22
|
typeOf: factory_1.factory.reservationType.ReservationPackage,
|
|
23
23
|
reservationNumber: transaction.transactionNumber,
|
|
24
|
-
|
|
24
|
+
// discontinue reservationFor(2026-05-09~)
|
|
25
|
+
// reservationFor: { typeOf: reservationFor.typeOf, id: String(reservationFor.id) },
|
|
25
26
|
reservationStatus: (typeof params.transaction.object.reservationStatus === 'string')
|
|
26
27
|
? params.transaction.object.reservationStatus
|
|
27
28
|
: factory_1.factory.reservationStatusType.ReservationPending
|
|
@@ -5,11 +5,13 @@ import type { IDeprecatedField, IKeyOfProjection, ReservationRepo } from '../../
|
|
|
5
5
|
* 予約検索レスポンスとしての予約
|
|
6
6
|
* 予約ドキュメントに予約取引の情報を補完する
|
|
7
7
|
*/
|
|
8
|
-
type IReservationAsFindResult = Omit<factory.reservation.eventReservation.IReservation, 'price' | 'underName' | 'reservedTicket' | 'reservationFor'> & {
|
|
8
|
+
type IReservationAsFindResult = Omit<factory.reservation.eventReservation.IReservation, 'price' | 'priceCurrency' | 'underName' | 'reservedTicket' | 'reservationFor' | 'issuedThrough'> & {
|
|
9
9
|
price?: factory.reservation.eventReservation.IPrice;
|
|
10
|
+
priceCurrency?: factory.priceCurrency.JPY;
|
|
10
11
|
underName?: factory.assetTransaction.reserve.IUnderName;
|
|
11
12
|
reservedTicket?: factory.assetTransaction.reserve.IObjectSubReservation['reservedTicket'];
|
|
12
13
|
reservationFor?: factory.assetTransaction.reserve.IReservationFor;
|
|
14
|
+
issuedThrough?: factory.assetTransaction.reserve.IIssuedThrough;
|
|
13
15
|
};
|
|
14
16
|
/**
|
|
15
17
|
* 予約を検索する
|
|
@@ -5,6 +5,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.findReservations = findReservations;
|
|
7
7
|
const debug_1 = __importDefault(require("debug"));
|
|
8
|
+
// import { isDeepStrictEqual } from 'util';
|
|
9
|
+
const factory_1 = require("../../factory");
|
|
8
10
|
const debug = (0, debug_1.default)('chevre-domain:service:reserve:findReservations');
|
|
9
11
|
/**
|
|
10
12
|
* 予約を検索する
|
|
@@ -18,9 +20,11 @@ function findReservations(params, options) {
|
|
|
18
20
|
}
|
|
19
21
|
else {
|
|
20
22
|
const requirePrice = Object.keys(inclusion).includes('price');
|
|
23
|
+
const requirePriceCurrency = Object.keys(inclusion).includes('priceCurrency');
|
|
21
24
|
const requireUnderName = Object.keys(inclusion).includes('underName');
|
|
22
25
|
const requireReservedTicket = Object.keys(inclusion).includes('reservedTicket');
|
|
23
26
|
const requireReservationFor = Object.keys(inclusion).includes('reservationFor');
|
|
27
|
+
const requireIssuedThrough = Object.keys(inclusion).includes('issuedThrough');
|
|
24
28
|
const reservationIds = rawReservations.map(({ id }) => id);
|
|
25
29
|
const subReservations = await repos.assetTransaction.reserve.findSubReservationsById({
|
|
26
30
|
ids: reservationIds
|
|
@@ -33,6 +37,7 @@ function findReservations(params, options) {
|
|
|
33
37
|
const underNameByTransaction = subReservationByTransaction?.underName;
|
|
34
38
|
const ticketTypeByTransaction = subReservationByTransaction?.reservedTicket?.ticketType;
|
|
35
39
|
const reservationForByTransaction = subReservationByTransaction?.reservationFor;
|
|
40
|
+
const issuedThroughByTransaction = subReservationByTransaction?.issuedThrough;
|
|
36
41
|
// 予約ドキュメントを最適化し始めたため、もう等しくない(2026-04-06~)
|
|
37
42
|
// // 予約取引から参照した属性と全く等しいはず
|
|
38
43
|
// if (requirePrice) {
|
|
@@ -48,10 +53,11 @@ function findReservations(params, options) {
|
|
|
48
53
|
// console.error('reservationForMatched: false!!!', reservation.id);
|
|
49
54
|
// }
|
|
50
55
|
// }
|
|
51
|
-
const { reservationFor, reservedTicket, ...rawReservation4result } = reservation;
|
|
56
|
+
const { reservationFor: _reservationFor, issuedThrough: _issuedThrough, priceCurrency: _priceCurrency, reservedTicket, ...rawReservation4result } = reservation;
|
|
52
57
|
return {
|
|
53
58
|
...rawReservation4result, // 予約ドキュメントはそのまま返す
|
|
54
59
|
...(requirePrice && priceByTransaction !== undefined) ? { price: priceByTransaction } : undefined, // priceがあれば上書き
|
|
60
|
+
...(requirePriceCurrency) ? { priceCurrency: factory_1.factory.priceCurrency.JPY } : undefined, // 必要あらば固定値を補完(2026-05-08~)
|
|
55
61
|
...(requireUnderName && underNameByTransaction !== undefined) ? { underName: underNameByTransaction } : undefined, // underNameがあれば上書き
|
|
56
62
|
...(requireReservedTicket && ticketTypeByTransaction !== undefined) // ticketTypeがあれば上書き
|
|
57
63
|
? {
|
|
@@ -63,7 +69,10 @@ function findReservations(params, options) {
|
|
|
63
69
|
: undefined,
|
|
64
70
|
...(requireReservationFor && reservationForByTransaction !== undefined)
|
|
65
71
|
? { reservationFor: reservationForByTransaction }
|
|
66
|
-
: undefined, // reservationForがあれば上書き(2026-04-06~)
|
|
72
|
+
: undefined, // reservationForがあれば上書き(2026-04-06~),
|
|
73
|
+
...(requireIssuedThrough && issuedThroughByTransaction !== undefined)
|
|
74
|
+
? { issuedThrough: issuedThroughByTransaction }
|
|
75
|
+
: undefined, // issuedThroughがあれば上書き(2026-05-09~)
|
|
67
76
|
};
|
|
68
77
|
});
|
|
69
78
|
}
|
|
@@ -5,13 +5,14 @@ import { factory } from '../../../factory';
|
|
|
5
5
|
import { AuthorizationRepo } from '../../../repo/authorization';
|
|
6
6
|
import type { SettingRepo } from '../../../repo/setting';
|
|
7
7
|
import type { TaskRepo } from '../../../repo/task';
|
|
8
|
-
export type IConfirmedReservation = Omit<factory.reservation.eventReservation.IReservation, 'price' | 'underName' | 'reservedTicket' | 'reservationFor'> & {
|
|
8
|
+
export type IConfirmedReservation = Omit<factory.reservation.eventReservation.IReservation, 'price' | 'underName' | 'reservedTicket' | 'reservationFor' | 'issuedThrough'> & {
|
|
9
9
|
price?: factory.reservation.eventReservation.IPrice;
|
|
10
10
|
underName?: Pick<factory.reservation.IUnderName, 'id' | 'typeOf'>;
|
|
11
11
|
reservedTicket: Omit<factory.assetTransaction.reserve.ISubReservationReservedTicket, 'ticketType'> & {
|
|
12
12
|
ticketType: factory.reservation.eventReservation.ITicketType;
|
|
13
13
|
};
|
|
14
14
|
reservationFor: factory.assetTransaction.reserve.IReservationFor;
|
|
15
|
+
issuedThrough: factory.assetTransaction.reserve.IIssuedThrough;
|
|
15
16
|
};
|
|
16
17
|
/**
|
|
17
18
|
* 予約確定後のアクション
|
|
@@ -20,7 +20,7 @@ export declare function useReservation(params: {
|
|
|
20
20
|
*/
|
|
21
21
|
id: string;
|
|
22
22
|
};
|
|
23
|
-
instrument
|
|
23
|
+
instrument: factory.action.consume.use.reservation.IInstrument[];
|
|
24
24
|
location?: {
|
|
25
25
|
identifier?: string;
|
|
26
26
|
};
|
|
@@ -16,7 +16,6 @@ function useReservation(params) {
|
|
|
16
16
|
return async (repos) => {
|
|
17
17
|
const reservationId = params.object.id;
|
|
18
18
|
let ticketToken;
|
|
19
|
-
// const ticketToken = params?.instrument?.ticketToken;
|
|
20
19
|
if (Array.isArray(params.instrument)) {
|
|
21
20
|
for (const eachInstrument of params.instrument) {
|
|
22
21
|
if (eachInstrument.typeOf === 'Ticket' && typeof eachInstrument.ticketToken === 'string') {
|
|
@@ -24,9 +23,8 @@ function useReservation(params) {
|
|
|
24
23
|
break;
|
|
25
24
|
}
|
|
26
25
|
}
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
ticketToken = params?.instrument?.ticketToken;
|
|
26
|
+
// } else {
|
|
27
|
+
// ticketToken = params?.instrument?.ticketToken;
|
|
30
28
|
}
|
|
31
29
|
// if (params.verifyToken === true) {} // タスク作成前に検証済なので検証不要
|
|
32
30
|
// confirmReservationが間に合わない可能性を考慮する(2023-06-01~)
|
|
@@ -34,36 +32,34 @@ function useReservation(params) {
|
|
|
34
32
|
// 予約検索
|
|
35
33
|
const reservation = await repos.reservation.findReservationById({
|
|
36
34
|
id: reservationId,
|
|
37
|
-
inclusion: [
|
|
35
|
+
inclusion: [
|
|
36
|
+
// 'issuedThrough',
|
|
37
|
+
// 'reservedTicket',
|
|
38
|
+
'project', 'reservationFor', 'reservationNumber', 'typeOf'
|
|
39
|
+
]
|
|
38
40
|
});
|
|
39
|
-
if (typeof reservation.issuedThrough.id !== 'string') {
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
}
|
|
43
|
-
const { reservedTicket } = reservation;
|
|
44
|
-
// optimize(
|
|
41
|
+
// if (typeof reservation.issuedThrough.id !== 'string') {
|
|
42
|
+
// // COA予約では予約使用アクションを想定していないので、興行idは必ず存在するはず
|
|
43
|
+
// throw new factory.errors.Internal('reservation.issuedThrough.id must be string');
|
|
44
|
+
// }
|
|
45
|
+
// const { reservedTicket } = reservation;
|
|
46
|
+
// optimize(2026-05-06~)
|
|
45
47
|
const reservationAsObject = {
|
|
46
48
|
id: reservation.id,
|
|
47
49
|
reservationNumber: reservation.reservationNumber,
|
|
48
50
|
typeOf: reservation.typeOf,
|
|
49
|
-
issuedThrough: { id: reservation.issuedThrough.id, typeOf: reservation.issuedThrough.typeOf },
|
|
50
51
|
reservationFor: { id: reservation.reservationFor.id, typeOf: reservation.reservationFor.typeOf },
|
|
51
|
-
reservedTicket
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
// },
|
|
59
|
-
...(typeof reservedTicket.identifier === 'string') ? { identifier: reservedTicket.identifier } : undefined,
|
|
60
|
-
...(typeof reservedTicket.ticketedSeat?.typeOf === 'string') ? { ticketedSeat: reservedTicket.ticketedSeat } : undefined
|
|
61
|
-
}
|
|
52
|
+
// discontinue issuedThrough,reservedTicket(2026-05-06~)
|
|
53
|
+
// issuedThrough: { id: reservation.issuedThrough.id, typeOf: reservation.issuedThrough.typeOf },
|
|
54
|
+
// reservedTicket: {
|
|
55
|
+
// typeOf: reservedTicket.typeOf,
|
|
56
|
+
// ...(typeof reservedTicket.identifier === 'string') ? { identifier: reservedTicket.identifier } : undefined,
|
|
57
|
+
// ...(typeof reservedTicket.ticketedSeat?.typeOf === 'string') ? { ticketedSeat: reservedTicket.ticketedSeat } : undefined
|
|
58
|
+
// }
|
|
62
59
|
};
|
|
63
60
|
// extend instrument to array(2025-02-18~)
|
|
64
61
|
const instrument = [
|
|
65
62
|
{
|
|
66
|
-
// ...(typeof token === 'string') ? { token } : undefined, // discontinue token(2024-10-03~)
|
|
67
63
|
...(typeof ticketToken === 'string') ? { ticketToken } : undefined,
|
|
68
64
|
typeOf: 'Ticket'
|
|
69
65
|
},
|
|
@@ -27,9 +27,12 @@ function createAccountingReport(params) {
|
|
|
27
27
|
orderNumber: data.object.mainEntity.orderNumber,
|
|
28
28
|
project: { id: params.project.id },
|
|
29
29
|
inclusion: [
|
|
30
|
-
'orderNumber', 'project', '
|
|
31
|
-
|
|
32
|
-
|
|
30
|
+
'orderNumber', 'project', 'paymentMethods', 'seller', 'typeOf', 'orderDate'
|
|
31
|
+
// 'customer', 'confirmationNumber',
|
|
32
|
+
// 'orderedItem',
|
|
33
|
+
// 'broker',
|
|
34
|
+
// 'price', 'priceCurrency',
|
|
35
|
+
]
|
|
33
36
|
});
|
|
34
37
|
const simpleOrder = {
|
|
35
38
|
typeOf: order.typeOf,
|
|
@@ -37,7 +40,6 @@ function createAccountingReport(params) {
|
|
|
37
40
|
orderDate: order.orderDate
|
|
38
41
|
};
|
|
39
42
|
const actionObject = {
|
|
40
|
-
// ...params,
|
|
41
43
|
mainEntity: { orderNumber: simpleOrder.orderNumber },
|
|
42
44
|
typeOf: 'Report'
|
|
43
45
|
};
|
|
@@ -51,13 +53,13 @@ function createAccountingReport(params) {
|
|
|
51
53
|
};
|
|
52
54
|
const action = await repos.action.start(actionAttributes);
|
|
53
55
|
try {
|
|
54
|
-
const acceptedOffers = await repos.acceptedOffer.searchAcceptedOffersByOrderNumber({
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
});
|
|
56
|
+
// const acceptedOffers = await repos.acceptedOffer.searchAcceptedOffersByOrderNumber({
|
|
57
|
+
// orderNumber: { $eq: data.object.mainEntity.orderNumber },
|
|
58
|
+
// project: { id: { $eq: params.project.id } }
|
|
59
|
+
// });
|
|
58
60
|
await (0, createAccountingReportIfNotExist_1.createAccountingReportIfNotExist)({
|
|
59
61
|
...order,
|
|
60
|
-
acceptedOffers
|
|
62
|
+
// acceptedOffers
|
|
61
63
|
})(repos);
|
|
62
64
|
}
|
|
63
65
|
catch (error) {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
+
import type { IExecutableTaskKeys, IOperationExecute } from '../taskHandler';
|
|
1
2
|
import { factory } from '../../factory';
|
|
2
|
-
import type { IOperationExecute } from '../taskHandler';
|
|
3
3
|
/**
|
|
4
4
|
* タスク実行関数
|
|
5
5
|
*/
|
|
6
|
-
export declare function call(
|
|
6
|
+
export declare function call(params: Pick<factory.task.useReservation.ITask, IExecutableTaskKeys>): IOperationExecute<void>;
|
|
@@ -12,25 +12,15 @@ const useReservation_1 = require("../reserve/useReservation");
|
|
|
12
12
|
/**
|
|
13
13
|
* タスク実行関数
|
|
14
14
|
*/
|
|
15
|
-
function call(
|
|
15
|
+
function call(params) {
|
|
16
16
|
return async ({ connection }) => {
|
|
17
|
-
|
|
18
|
-
// support array(2025-02-17~)
|
|
19
|
-
if (Array.isArray(data.instrument)) {
|
|
20
|
-
instrument = data.instrument;
|
|
21
|
-
}
|
|
22
|
-
else {
|
|
23
|
-
if (data.instrument?.typeOf === 'Ticket') {
|
|
24
|
-
instrument = [data.instrument];
|
|
25
|
-
}
|
|
26
|
-
}
|
|
17
|
+
const { data, project } = params;
|
|
27
18
|
await (0, useReservation_1.useReservation)({
|
|
28
|
-
project
|
|
19
|
+
project,
|
|
29
20
|
agent: data.agent,
|
|
30
21
|
object: data.object,
|
|
31
|
-
instrument,
|
|
32
|
-
|
|
33
|
-
...(typeof data.location?.typeOf === 'string') ? { location: data.location } : undefined
|
|
22
|
+
instrument: data.instrument,
|
|
23
|
+
...(typeof data.location?.identifier === 'string') ? { location: data.location } : undefined
|
|
34
24
|
})({
|
|
35
25
|
action: new action_1.ActionRepo(connection),
|
|
36
26
|
assetTransaction: new assetTransaction_1.AssetTransactionRepo(connection),
|
|
@@ -39,8 +29,6 @@ function call(data) {
|
|
|
39
29
|
reservation: new reservation_1.ReservationRepo(connection),
|
|
40
30
|
setting: new setting_1.SettingRepo(connection),
|
|
41
31
|
task: new task_1.TaskRepo(connection)
|
|
42
|
-
}
|
|
43
|
-
// settings
|
|
44
|
-
);
|
|
32
|
+
});
|
|
45
33
|
};
|
|
46
34
|
}
|
|
@@ -74,6 +74,7 @@ function executeTask(task, next) {
|
|
|
74
74
|
case factory_1.factory.taskName.SendEmailMessage:
|
|
75
75
|
case factory_1.factory.taskName.SyncResourcesFromCOA:
|
|
76
76
|
case factory_1.factory.taskName.TriggerWebhook:
|
|
77
|
+
case factory_1.factory.taskName.UseReservation:
|
|
77
78
|
callResult = await call(task)(settings, options);
|
|
78
79
|
break;
|
|
79
80
|
default:
|
package/package.json
CHANGED
|
@@ -11,7 +11,7 @@
|
|
|
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": "8.0.
|
|
14
|
+
"@chevre/factory": "8.1.0-alpha.6",
|
|
15
15
|
"@motionpicture/coa-service": "10.0.0",
|
|
16
16
|
"@motionpicture/gmo-service": "6.1.0-alpha.0",
|
|
17
17
|
"@sendgrid/client": "8.1.4",
|
|
@@ -91,5 +91,5 @@
|
|
|
91
91
|
"postversion": "git push origin --tags",
|
|
92
92
|
"prepublishOnly": "npm run clean && npm run build"
|
|
93
93
|
},
|
|
94
|
-
"version": "24.1.0-alpha.
|
|
94
|
+
"version": "24.1.0-alpha.11"
|
|
95
95
|
}
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import { IndexDefinition, IndexOptions, Model, Schema, SchemaDefinition } from 'mongoose';
|
|
2
|
-
import { IVirtuals } from '../virtuals';
|
|
3
|
-
import { factory } from '../../../factory';
|
|
4
|
-
export interface IProductModel {
|
|
5
|
-
id: string;
|
|
6
|
-
project: {
|
|
7
|
-
id: string;
|
|
8
|
-
typeOf: factory.organizationType.Project;
|
|
9
|
-
};
|
|
10
|
-
typeOf: 'ProductModel';
|
|
11
|
-
category: Pick<factory.categoryCode.ICategoryCode, 'codeValue' | 'inCodeSet'> & {
|
|
12
|
-
/**
|
|
13
|
-
* 区分ID
|
|
14
|
-
* 削除時同期に必要
|
|
15
|
-
*/
|
|
16
|
-
id: string;
|
|
17
|
-
};
|
|
18
|
-
name: factory.multilingualString;
|
|
19
|
-
offers: {
|
|
20
|
-
typeOf: factory.offerType.Offer;
|
|
21
|
-
eligibleCustomerType?: {
|
|
22
|
-
codeValue: string;
|
|
23
|
-
}[];
|
|
24
|
-
}[];
|
|
25
|
-
}
|
|
26
|
-
type IDocType = Omit<IProductModel, 'id'>;
|
|
27
|
-
type IModel = Model<IDocType, Record<string, never>, Record<string, never>, IVirtuals>;
|
|
28
|
-
type ISchemaDefinition = SchemaDefinition<IDocType>;
|
|
29
|
-
type ISchema = Schema<IDocType, IModel, Record<string, never>, Record<string, never>, IVirtuals, Record<string, never>, ISchemaDefinition, IDocType>;
|
|
30
|
-
declare const modelName = "ProductModel";
|
|
31
|
-
declare const indexes: [d: IndexDefinition, o: IndexOptions][];
|
|
32
|
-
declare function createSchema(): ISchema;
|
|
33
|
-
export { createSchema, IDocType, IModel, indexes, modelName };
|
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.modelName = exports.indexes = void 0;
|
|
4
|
-
exports.createSchema = createSchema;
|
|
5
|
-
const mongoose_1 = require("mongoose");
|
|
6
|
-
const writeConcern_1 = require("../writeConcern");
|
|
7
|
-
const settings_1 = require("../../../settings");
|
|
8
|
-
const modelName = 'ProductModel';
|
|
9
|
-
exports.modelName = modelName;
|
|
10
|
-
const schemaDefinition = {
|
|
11
|
-
project: mongoose_1.SchemaTypes.Mixed,
|
|
12
|
-
typeOf: { type: String, required: true },
|
|
13
|
-
category: mongoose_1.SchemaTypes.Mixed,
|
|
14
|
-
name: mongoose_1.SchemaTypes.Mixed,
|
|
15
|
-
offers: mongoose_1.SchemaTypes.Mixed
|
|
16
|
-
};
|
|
17
|
-
const schemaOptions = {
|
|
18
|
-
autoIndex: settings_1.MONGO_AUTO_INDEX,
|
|
19
|
-
autoCreate: false,
|
|
20
|
-
collection: 'productModels',
|
|
21
|
-
id: true,
|
|
22
|
-
read: settings_1.MONGO_READ_PREFERENCE,
|
|
23
|
-
writeConcern: writeConcern_1.writeConcern,
|
|
24
|
-
strict: true,
|
|
25
|
-
strictQuery: false,
|
|
26
|
-
timestamps: false, // 2024-09-03~
|
|
27
|
-
versionKey: false, // 2024-09-03~
|
|
28
|
-
toJSON: {
|
|
29
|
-
getters: false,
|
|
30
|
-
virtuals: false,
|
|
31
|
-
minimize: false,
|
|
32
|
-
versionKey: false
|
|
33
|
-
},
|
|
34
|
-
toObject: {
|
|
35
|
-
getters: false,
|
|
36
|
-
virtuals: true,
|
|
37
|
-
minimize: false,
|
|
38
|
-
versionKey: false
|
|
39
|
-
}
|
|
40
|
-
};
|
|
41
|
-
const indexes = [];
|
|
42
|
-
exports.indexes = indexes;
|
|
43
|
-
/**
|
|
44
|
-
* プロダクトモデルスキーマ
|
|
45
|
-
*/
|
|
46
|
-
let schema;
|
|
47
|
-
function createSchema() {
|
|
48
|
-
if (schema === undefined) {
|
|
49
|
-
schema = new mongoose_1.Schema(schemaDefinition, schemaOptions);
|
|
50
|
-
if (settings_1.MONGO_AUTO_INDEX) {
|
|
51
|
-
indexes.forEach((indexParams) => {
|
|
52
|
-
schema?.index(...indexParams);
|
|
53
|
-
});
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
return schema;
|
|
57
|
-
}
|