@chevre/domain 24.1.0-alpha.3 → 24.1.0-alpha.5
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/accountingReport.d.ts +9 -2
- package/lib/chevre/repo/accountingReport.js +6 -6
- package/lib/chevre/repo/factory/reservation/createMongoConditions.js +15 -41
- package/lib/chevre/service/aggregation/event/aggregateOffers.js +17 -26
- package/lib/chevre/service/order/createAccountingReportIfNotExist.d.ts +1 -3
- package/lib/chevre/service/order/createAccountingReportIfNotExist.js +58 -63
- 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 +9 -7
- package/lib/chevre/service/task/useReservation.d.ts +2 -2
- package/lib/chevre/service/task/useReservation.js +6 -18
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
# Chevre Domain Library for Node.js
|
|
2
2
|
|
|
3
3
|
[](https://www.npmjs.com/package/@chevre/domain)
|
|
4
|
-
[](https://circleci.com/gh/chevre-jp/domain)
|
|
5
|
-
[](https://coveralls.io/github/chevre-jp/domain?branch=master)
|
|
6
4
|
[](https://snyk.io/test/github/chevre-jp/domain)
|
|
7
5
|
[](https://nodei.co/npm/@chevre/domain/)
|
|
8
6
|
|
|
@@ -2,6 +2,11 @@ import type { Connection, PipelineStage } from 'mongoose';
|
|
|
2
2
|
import { factory } from '../factory';
|
|
3
3
|
import { IDocType } from './mongoose/schemas/accountingReport';
|
|
4
4
|
type IMatchStage = PipelineStage.Match;
|
|
5
|
+
type IReportAsFindResult = Pick<factory.report.accountingReport.IReport, 'mainEntity'> & {
|
|
6
|
+
isPartOf: {
|
|
7
|
+
mainEntity: factory.report.accountingReport.IOrderAsMainEntity;
|
|
8
|
+
};
|
|
9
|
+
};
|
|
5
10
|
/**
|
|
6
11
|
* 経理レポートリポジトリ
|
|
7
12
|
*/
|
|
@@ -35,11 +40,13 @@ export declare class AccountingReportRepo {
|
|
|
35
40
|
};
|
|
36
41
|
hasPart: factory.report.accountingReport.IChildReport;
|
|
37
42
|
}): Promise<void>;
|
|
38
|
-
|
|
43
|
+
findAccountingReports(params: factory.report.accountingReport.ISearchConditions & {
|
|
39
44
|
seller?: {
|
|
40
45
|
id?: string;
|
|
41
46
|
};
|
|
42
|
-
|
|
47
|
+
limit: number;
|
|
48
|
+
page: number;
|
|
49
|
+
}): Promise<IReportAsFindResult[]>;
|
|
43
50
|
unsetUnnecessaryFields(params: {
|
|
44
51
|
filter: any;
|
|
45
52
|
$unset: any;
|
|
@@ -4,7 +4,6 @@ exports.AccountingReportRepo = void 0;
|
|
|
4
4
|
const errorHandler_1 = require("../errorHandler");
|
|
5
5
|
const factory_1 = require("../factory");
|
|
6
6
|
const accountingReport_1 = require("./mongoose/schemas/accountingReport");
|
|
7
|
-
const DEFAULT_SEARCH_LIMIT = 100;
|
|
8
7
|
/**
|
|
9
8
|
* 経理レポートリポジトリ
|
|
10
9
|
*/
|
|
@@ -137,9 +136,8 @@ class AccountingReportRepo {
|
|
|
137
136
|
throw new factory_1.factory.errors.NotFound(this.accountingReportModel.modelName);
|
|
138
137
|
}
|
|
139
138
|
}
|
|
140
|
-
async
|
|
141
|
-
const
|
|
142
|
-
const page = (typeof params.page === 'number') ? Math.max(params.page, 1) : 1;
|
|
139
|
+
async findAccountingReports(params) {
|
|
140
|
+
const { limit, page } = params;
|
|
143
141
|
const unwindAcceptedOffers = params.$unwindAcceptedOffers === '1';
|
|
144
142
|
const matchStages = AccountingReportRepo.CREATE_MONGO_CONDITIONS(params);
|
|
145
143
|
const aggregate = this.accountingReportModel.aggregate([
|
|
@@ -159,9 +157,11 @@ class AccountingReportRepo {
|
|
|
159
157
|
}
|
|
160
158
|
}
|
|
161
159
|
]);
|
|
162
|
-
return aggregate
|
|
163
|
-
.limit(limit * page)
|
|
160
|
+
return aggregate
|
|
161
|
+
// .limit(limit * page)
|
|
162
|
+
// .skip(limit * (page - 1))
|
|
164
163
|
.skip(limit * (page - 1))
|
|
164
|
+
.limit(limit)
|
|
165
165
|
// .setOptions({ maxTimeMS: 10000 })
|
|
166
166
|
.exec();
|
|
167
167
|
}
|
|
@@ -390,47 +390,21 @@ function CREATE_MONGO_CONDITIONS(params) {
|
|
|
390
390
|
}
|
|
391
391
|
/* istanbul ignore else */
|
|
392
392
|
if (params.reservedTicket !== undefined) {
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
// if (Array.isArray(params.reservedTicket.ticketType.category.ids)) {
|
|
409
|
-
// andConditions.push(
|
|
410
|
-
// {
|
|
411
|
-
// 'reservedTicket.ticketType.category.id': {
|
|
412
|
-
// $exists: true,
|
|
413
|
-
// $in: params.reservedTicket.ticketType.category.ids
|
|
414
|
-
// }
|
|
415
|
-
// }
|
|
416
|
-
// );
|
|
417
|
-
// }
|
|
418
|
-
// /* istanbul ignore else */
|
|
419
|
-
// if (params.reservedTicket.ticketType.category.codeValue !== undefined
|
|
420
|
-
// && params.reservedTicket.ticketType.category !== null) {
|
|
421
|
-
// if (Array.isArray(params.reservedTicket.ticketType.category.codeValue.$in)) {
|
|
422
|
-
// andConditions.push(
|
|
423
|
-
// {
|
|
424
|
-
// 'reservedTicket.ticketType.category.codeValue': {
|
|
425
|
-
// $exists: true,
|
|
426
|
-
// $in: params.reservedTicket.ticketType.category.codeValue.$in
|
|
427
|
-
// }
|
|
428
|
-
// }
|
|
429
|
-
// );
|
|
430
|
-
// }
|
|
431
|
-
// }
|
|
432
|
-
// }
|
|
433
|
-
}
|
|
393
|
+
// discontinue ticketType(2026-05-06~)
|
|
394
|
+
// /* istanbul ignore else */
|
|
395
|
+
// if (params.reservedTicket.ticketType !== undefined) {
|
|
396
|
+
// /* istanbul ignore else */
|
|
397
|
+
// if (Array.isArray(params.reservedTicket.ticketType.ids)) {
|
|
398
|
+
// andConditions.push(
|
|
399
|
+
// {
|
|
400
|
+
// 'reservedTicket.ticketType.id': {
|
|
401
|
+
// $exists: true,
|
|
402
|
+
// $in: params.reservedTicket.ticketType.ids
|
|
403
|
+
// }
|
|
404
|
+
// }
|
|
405
|
+
// );
|
|
406
|
+
// }
|
|
407
|
+
// }
|
|
434
408
|
/* istanbul ignore else */
|
|
435
409
|
if (params.reservedTicket.ticketedSeat !== undefined) {
|
|
436
410
|
/* istanbul ignore else */
|
|
@@ -125,48 +125,39 @@ function aggregateOfferByEvent(params) {
|
|
|
125
125
|
function aggregateReservationByOffer(params) {
|
|
126
126
|
return async (repos) => {
|
|
127
127
|
let reservationCount4offer;
|
|
128
|
-
// let attendeeCount4offer: number | undefined;
|
|
129
|
-
// let checkInCount4offer: number | undefined;
|
|
130
128
|
const reservationType = factory_1.factory.reservationType.EventReservation;
|
|
131
129
|
const offerIdsWithSameCategory = params.availableOffers.filter(({ category }) => {
|
|
132
130
|
return typeof category?.codeValue === 'string' && category.codeValue === params.offer.category?.codeValue;
|
|
133
131
|
})
|
|
134
132
|
.map(({ id }) => id);
|
|
135
133
|
if (offerIdsWithSameCategory.length > 0) {
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
reservationFor: { id: { $eq: params.event.id } },
|
|
139
|
-
reservationStatuses: [factory_1.factory.reservationStatusType.ReservationConfirmed],
|
|
140
|
-
// オファーカテゴリーごとに集計する(2024-11-10~)
|
|
141
|
-
// reservedTicket: { ticketType: { ids: [<string>params.offer.id] } }
|
|
142
|
-
reservedTicket: { ticketType: { ids: offerIdsWithSameCategory } }
|
|
143
|
-
});
|
|
144
|
-
// attendeeCount4offer = await repos.reservation.count({
|
|
134
|
+
// オファーIDによる集計を座席区分(オファーの適用座席区分を参照)による集計に変更(2026-05-05~)
|
|
135
|
+
// reservationCount4offer = await repos.reservation.count({
|
|
145
136
|
// typeOf: reservationType,
|
|
146
137
|
// reservationFor: { id: { $eq: params.event.id } },
|
|
147
138
|
// reservationStatuses: [factory.reservationStatusType.ReservationConfirmed],
|
|
148
|
-
//
|
|
149
|
-
// // reservedTicket: { ticketType: { ids: [<string>params.offer.id] } },
|
|
150
|
-
// reservedTicket: { ticketType: { ids: offerIdsWithSameCategory } },
|
|
151
|
-
// attended: true
|
|
152
|
-
// });
|
|
153
|
-
// checkInCount4offer = await repos.reservation.count({
|
|
154
|
-
// typeOf: reservationType,
|
|
155
|
-
// reservationFor: { id: { $eq: params.event.id } },
|
|
156
|
-
// reservationStatuses: [factory.reservationStatusType.ReservationConfirmed],
|
|
157
|
-
// // オファーカテゴリーごとに集計する(2024-11-10~)
|
|
158
|
-
// // reservedTicket: { ticketType: { ids: [<string>params.offer.id] } },
|
|
159
|
-
// reservedTicket: { ticketType: { ids: offerIdsWithSameCategory } },
|
|
160
|
-
// checkedIn: true
|
|
139
|
+
// reservedTicket: { ticketType: { ids: offerIdsWithSameCategory } }
|
|
161
140
|
// });
|
|
141
|
+
const aggregateSeatingType = params.offer.eligibleSeatingType?.at(0)?.codeValue;
|
|
142
|
+
if (typeof aggregateSeatingType === 'string') {
|
|
143
|
+
reservationCount4offer = await repos.reservation.count({
|
|
144
|
+
typeOf: reservationType,
|
|
145
|
+
reservationFor: { id: { $eq: params.event.id } },
|
|
146
|
+
reservationStatuses: [factory_1.factory.reservationStatusType.ReservationConfirmed],
|
|
147
|
+
reservedTicket: {
|
|
148
|
+
ticketedSeat: {
|
|
149
|
+
seatingType: { $in: [aggregateSeatingType] }
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
});
|
|
153
|
+
console.log('aggregateReservationByOffer: reservationCount4offer:', reservationCount4offer, 'aggregateSeatingType:', aggregateSeatingType, 'offer.id:', params.offer.id, 'offer.category:', params.offer.category?.codeValue);
|
|
154
|
+
}
|
|
162
155
|
}
|
|
163
156
|
const { maximumAttendeeCapacity, remainingAttendeeCapacity } = await calculateCapacityByOffer(params)(repos);
|
|
164
157
|
return {
|
|
165
158
|
aggregateReservation: {
|
|
166
159
|
typeOf: 'AggregateReservation',
|
|
167
160
|
reservationCount: reservationCount4offer
|
|
168
|
-
// attendeeCount: attendeeCount4offer, // discontinue(2024-11-10~)
|
|
169
|
-
// checkInCount: checkInCount4offer // discontinue(2024-11-10~)
|
|
170
161
|
},
|
|
171
162
|
...(typeof maximumAttendeeCapacity === 'number') ? { maximumAttendeeCapacity } : undefined,
|
|
172
163
|
...(typeof remainingAttendeeCapacity === 'number') ? { remainingAttendeeCapacity } : undefined
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
import { AccountingReportRepo } from '../../repo/accountingReport';
|
|
2
2
|
import { factory } from '../../factory';
|
|
3
|
-
export declare function createAccountingReportIfNotExist(params: Pick<factory.order.IOrder, 'id' | 'orderNumber' | 'project' | 'customer' | 'confirmationNumber' | 'paymentMethods' | '
|
|
4
|
-
acceptedOffers: factory.order.IAcceptedOffer[];
|
|
5
|
-
}): (repos: {
|
|
3
|
+
export declare function createAccountingReportIfNotExist(params: Pick<factory.order.IOrder, 'id' | 'orderNumber' | 'project' | 'customer' | 'confirmationNumber' | 'paymentMethods' | 'price' | 'priceCurrency' | 'seller' | 'typeOf' | 'orderDate'> & {}): (repos: {
|
|
6
4
|
accountingReport: AccountingReportRepo;
|
|
7
5
|
}) => Promise<void>;
|
|
@@ -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
|
-
: [];
|
|
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
|
+
// : [];
|
|
66
65
|
const customer = {
|
|
67
|
-
// ...createMaskedCustomer(params),
|
|
68
66
|
id: params.customer.id,
|
|
69
67
|
typeOf: params.customer.typeOf,
|
|
70
|
-
additionalProperty: (Array.isArray(params.customer.additionalProperty))
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
identifier: (Array.isArray(params.customer.identifier))
|
|
74
|
-
|
|
75
|
-
|
|
68
|
+
// additionalProperty: (Array.isArray(params.customer.additionalProperty))
|
|
69
|
+
// ? params.customer.additionalProperty
|
|
70
|
+
// : [], // discontinue(2026-05-06~)
|
|
71
|
+
// identifier: (Array.isArray(params.customer.identifier))
|
|
72
|
+
// ? params.customer.identifier
|
|
73
|
+
// : [] // discontinue(2026-05-06~)
|
|
76
74
|
};
|
|
77
75
|
return {
|
|
78
|
-
// ...params,
|
|
79
76
|
confirmationNumber: params.confirmationNumber,
|
|
80
77
|
id: params.id,
|
|
81
78
|
orderNumber: params.orderNumber,
|
|
82
|
-
orderedItem: params.orderedItem,
|
|
83
79
|
paymentMethods: params.paymentMethods,
|
|
84
80
|
price: params.price,
|
|
85
81
|
priceCurrency: params.priceCurrency,
|
|
86
|
-
seller:
|
|
82
|
+
seller: {
|
|
83
|
+
id: params.seller.id,
|
|
84
|
+
name: params.seller.name,
|
|
85
|
+
typeOf: params.seller.typeOf
|
|
86
|
+
},
|
|
87
87
|
typeOf: params.typeOf,
|
|
88
88
|
customer,
|
|
89
89
|
orderDate: (0, moment_timezone_1.default)(params.orderDate)
|
|
90
90
|
.toDate(),
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
// ...(params.
|
|
95
|
-
// ? {
|
|
96
|
-
// dateReturned: moment(params.dateReturned)
|
|
97
|
-
// .toDate()
|
|
98
|
-
// }
|
|
99
|
-
// : undefined
|
|
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) {
|
|
@@ -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,8 +27,10 @@ function createAccountingReport(params) {
|
|
|
27
27
|
orderNumber: data.object.mainEntity.orderNumber,
|
|
28
28
|
project: { id: params.project.id },
|
|
29
29
|
inclusion: [
|
|
30
|
-
'orderNumber', 'project', 'customer', 'confirmationNumber',
|
|
31
|
-
|
|
30
|
+
'orderNumber', 'project', 'customer', 'confirmationNumber', 'paymentMethods',
|
|
31
|
+
// 'orderedItem',
|
|
32
|
+
// 'broker',
|
|
33
|
+
'price', 'priceCurrency', 'seller', 'typeOf', 'orderDate'
|
|
32
34
|
] // explicit projection(2024-07-25~)
|
|
33
35
|
});
|
|
34
36
|
const simpleOrder = {
|
|
@@ -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
|
}
|
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.1.0-alpha.
|
|
14
|
+
"@chevre/factory": "8.1.0-alpha.2",
|
|
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.5"
|
|
95
95
|
}
|