@chevre/domain 25.2.0-alpha.33 → 25.2.0-alpha.34
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/chevre/factory/customerTelephone2COATelNum.js +0 -1
- package/lib/chevre/service/reserve/adminFindReservations.d.ts +15 -0
- package/lib/chevre/service/reserve/adminFindReservations.js +35 -0
- package/lib/chevre/service/reserve.d.ts +2 -2
- package/lib/chevre/service/reserve.js +3 -3
- package/lib/chevre/service/transaction/placeOrder/updateAgent/fixCustomer.d.ts +20 -0
- package/lib/chevre/service/transaction/placeOrder/updateAgent/fixCustomer.js +63 -0
- package/lib/chevre/service/transaction/placeOrder/updateAgent.d.ts +0 -3
- package/lib/chevre/service/transaction/placeOrder/updateAgent.js +17 -96
- package/package.json +1 -3
- package/lib/chevre/service/reserve/findReservations.d.ts +0 -33
- package/lib/chevre/service/reserve/findReservations.js +0 -61
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.customerTelephone2COATelNum = customerTelephone2COATelNum;
|
|
4
|
-
// import { PhoneNumberFormat, PhoneNumberUtil } from 'google-libphonenumber';
|
|
5
4
|
const libphonenumber_js_1 = require("libphonenumber-js");
|
|
6
5
|
const factory_1 = require("../factory");
|
|
7
6
|
function customerTelephone2COATelNum(params) {
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { factory } from '../../factory';
|
|
2
|
+
import type { IKeyOfProjection, ReservationRepo } from '../../repo/reservation';
|
|
3
|
+
/**
|
|
4
|
+
* 予約検索レスポンスとしての予約
|
|
5
|
+
*/
|
|
6
|
+
type IReservationAsFindResult = Pick<factory.reservation.eventReservation.IReservation, 'additionalTicketText' | 'attended' | 'bookingTime' | 'checkedIn' | 'id' | 'reservationFor' | 'reservationNumber' | 'reservationStatus' | 'reservedTicket'>;
|
|
7
|
+
/**
|
|
8
|
+
* 管理者による予約検索
|
|
9
|
+
*/
|
|
10
|
+
export declare function adminFindReservations(params: factory.reservation.eventReservation.ISearchConditions, options: {
|
|
11
|
+
inclusion: Partial<Record<IKeyOfProjection, 1>>;
|
|
12
|
+
}): (repos: {
|
|
13
|
+
reservation: ReservationRepo;
|
|
14
|
+
}) => Promise<IReservationAsFindResult[]>;
|
|
15
|
+
export {};
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.adminFindReservations = adminFindReservations;
|
|
4
|
+
/**
|
|
5
|
+
* 管理者による予約検索
|
|
6
|
+
*/
|
|
7
|
+
function adminFindReservations(params, options) {
|
|
8
|
+
return async (repos) => {
|
|
9
|
+
const { inclusion } = options;
|
|
10
|
+
const rawReservations = await repos.reservation.findReservations(params, inclusion);
|
|
11
|
+
if (rawReservations.length === 0) {
|
|
12
|
+
return [];
|
|
13
|
+
}
|
|
14
|
+
else {
|
|
15
|
+
// const requireUnderName = Object.keys(inclusion).includes('underName');
|
|
16
|
+
// const requireReservedTicket = Object.keys(inclusion).includes('reservedTicket');
|
|
17
|
+
// const requireReservationFor = Object.keys(inclusion).includes('reservationFor');
|
|
18
|
+
// const reservationIds = rawReservations.map(({ id }) => id);
|
|
19
|
+
// const subReservations = await repos.assetTransaction.reserve.findSubReservationsById({
|
|
20
|
+
// ids: reservationIds
|
|
21
|
+
// });
|
|
22
|
+
return rawReservations.map((reservation) => {
|
|
23
|
+
// const subReservationByTransaction = subReservations.find((s) => s.id === reservation.id);
|
|
24
|
+
// const underNameByTransaction = subReservationByTransaction?.underName;
|
|
25
|
+
const { reservationFor, issuedThrough: _issuedThrough, priceCurrency: _priceCurrency, numSeats: _numSeats, reservedTicket, ...rawReservation4result } = reservation;
|
|
26
|
+
return {
|
|
27
|
+
...rawReservation4result, // 予約ドキュメントはそのまま返す
|
|
28
|
+
reservedTicket, // 予約検索レスポンスからticketTypeは廃止(2026-06-01~)
|
|
29
|
+
reservationFor // 予約検索レスポンスのreservationForはそのまま返す(2026-06-01~)
|
|
30
|
+
// ...(requireUnderName && underNameByTransaction !== undefined) ? { underName: underNameByTransaction } : undefined, // underNameがあれば上書き
|
|
31
|
+
};
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
};
|
|
35
|
+
}
|
|
@@ -5,7 +5,7 @@ import { cancelPendingReservation, cancelReservation } from './reserve/cancelRes
|
|
|
5
5
|
import { checkInReservation } from './reserve/checkInReservation';
|
|
6
6
|
import { confirmReservation } from './reserve/confirmReservation';
|
|
7
7
|
import { findByCode } from './reserve/findByCode';
|
|
8
|
-
import {
|
|
8
|
+
import { adminFindReservations } from './reserve/adminFindReservations';
|
|
9
9
|
import { searchByOrder } from './reserve/searchByOrder';
|
|
10
10
|
import { verifyToken4reservation } from './reserve/verifyToken4reservation';
|
|
11
|
-
export { cancelPendingReservation, cancelReservation, checkInReservation, confirmReservation, findByCode,
|
|
11
|
+
export { cancelPendingReservation, cancelReservation, checkInReservation, confirmReservation, findByCode, adminFindReservations, searchByOrder, verifyToken4reservation };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.verifyToken4reservation = exports.searchByOrder = exports.
|
|
3
|
+
exports.verifyToken4reservation = exports.searchByOrder = exports.adminFindReservations = exports.findByCode = exports.confirmReservation = exports.checkInReservation = exports.cancelReservation = exports.cancelPendingReservation = void 0;
|
|
4
4
|
/**
|
|
5
5
|
* 予約サービス
|
|
6
6
|
*/
|
|
@@ -13,8 +13,8 @@ const confirmReservation_1 = require("./reserve/confirmReservation");
|
|
|
13
13
|
Object.defineProperty(exports, "confirmReservation", { enumerable: true, get: function () { return confirmReservation_1.confirmReservation; } });
|
|
14
14
|
const findByCode_1 = require("./reserve/findByCode");
|
|
15
15
|
Object.defineProperty(exports, "findByCode", { enumerable: true, get: function () { return findByCode_1.findByCode; } });
|
|
16
|
-
const
|
|
17
|
-
Object.defineProperty(exports, "
|
|
16
|
+
const adminFindReservations_1 = require("./reserve/adminFindReservations");
|
|
17
|
+
Object.defineProperty(exports, "adminFindReservations", { enumerable: true, get: function () { return adminFindReservations_1.adminFindReservations; } });
|
|
18
18
|
const searchByOrder_1 = require("./reserve/searchByOrder");
|
|
19
19
|
Object.defineProperty(exports, "searchByOrder", { enumerable: true, get: function () { return searchByOrder_1.searchByOrder; } });
|
|
20
20
|
const verifyToken4reservation_1 = require("./reserve/verifyToken4reservation");
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { factory } from '../../../../factory';
|
|
2
|
+
import type { OrderInTransactionRepo } from '../../../../repo/orderInTransaction';
|
|
3
|
+
export interface IFixCustomerRepos {
|
|
4
|
+
orderInTransaction: OrderInTransactionRepo;
|
|
5
|
+
}
|
|
6
|
+
export type IProfileByRequest = Pick<factory.order.ICustomer, 'additionalProperty' | 'address' | 'age' | 'email' | 'familyName' | 'gender' | 'givenName' | 'name' | 'telephone' | 'url'> & {
|
|
7
|
+
telephoneRegion?: string;
|
|
8
|
+
};
|
|
9
|
+
/**
|
|
10
|
+
* 進行中取引からカスタマー属性を決定する
|
|
11
|
+
*/
|
|
12
|
+
export declare function fixCustomer(params: {
|
|
13
|
+
/**
|
|
14
|
+
* 注文取引ID
|
|
15
|
+
*/
|
|
16
|
+
id: string;
|
|
17
|
+
profileByRequest: IProfileByRequest;
|
|
18
|
+
}): (repos: IFixCustomerRepos) => Promise<{
|
|
19
|
+
customer: factory.order.ICustomer;
|
|
20
|
+
}>;
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.fixCustomer = fixCustomer;
|
|
4
|
+
const libphonenumber_js_1 = require("libphonenumber-js");
|
|
5
|
+
const factory_1 = require("../../../../factory");
|
|
6
|
+
/**
|
|
7
|
+
* 進行中取引からカスタマー属性を決定する
|
|
8
|
+
*/
|
|
9
|
+
function fixCustomer(params) {
|
|
10
|
+
return async (repos) => {
|
|
11
|
+
const { profileByRequest } = params;
|
|
12
|
+
let formattedTelephone;
|
|
13
|
+
try {
|
|
14
|
+
const phoneNumber = (0, libphonenumber_js_1.parsePhoneNumberFromString)(String(profileByRequest.telephone), profileByRequest.telephoneRegion);
|
|
15
|
+
if (phoneNumber === undefined || !phoneNumber.isValid()) {
|
|
16
|
+
throw new factory_1.factory.errors.Argument('telephone', 'Invalid phone number');
|
|
17
|
+
}
|
|
18
|
+
formattedTelephone = phoneNumber.format('E.164');
|
|
19
|
+
// if (useLibphonenumber) {
|
|
20
|
+
// const phoneNumber = parsePhoneNumberFromString(String(params.agent.telephone), params.agent.telephoneRegion as CountryCode | undefined);
|
|
21
|
+
// if (phoneNumber === undefined || !phoneNumber.isValid()) {
|
|
22
|
+
// throw new factory.errors.Argument('telephone', 'Invalid phone number');
|
|
23
|
+
// }
|
|
24
|
+
// formattedTelephone = phoneNumber.format('E.164');
|
|
25
|
+
// } else {
|
|
26
|
+
// const phoneUtil = PhoneNumberUtil.getInstance();
|
|
27
|
+
// const phoneNumber = phoneUtil.parse(params.agent.telephone, params.agent.telephoneRegion);
|
|
28
|
+
// if (!phoneUtil.isValidNumber(phoneNumber)) {
|
|
29
|
+
// throw new factory.errors.Argument('telephone', 'Invalid phone number');
|
|
30
|
+
// }
|
|
31
|
+
// formattedTelephone = phoneUtil.format(phoneNumber, PhoneNumberFormat.E164);
|
|
32
|
+
// }
|
|
33
|
+
}
|
|
34
|
+
catch (error) {
|
|
35
|
+
throw new factory_1.factory.errors.Argument('telephone', (error instanceof Error) ? error.message : /* istanbul ignore next */ String(error));
|
|
36
|
+
}
|
|
37
|
+
// orderInTransaction.customer?.typeOfは取引開始時にセットされている前提で再実装(2026-06-24~)
|
|
38
|
+
const customerByTransaction = await repos.orderInTransaction.findCustomerByOrderIdentifier({ identifier: params.id });
|
|
39
|
+
const customerName = (typeof profileByRequest.name === 'string' && profileByRequest.name !== '')
|
|
40
|
+
? profileByRequest.name
|
|
41
|
+
: /* istanbul ignore next */ (typeof profileByRequest.givenName === 'string' && typeof profileByRequest.familyName === 'string'
|
|
42
|
+
&& profileByRequest.givenName !== '' && profileByRequest.familyName !== '')
|
|
43
|
+
? `${profileByRequest.givenName} ${profileByRequest.familyName}`
|
|
44
|
+
: undefined;
|
|
45
|
+
const identifier = (Array.isArray(customerByTransaction.identifier)) ? customerByTransaction.identifier : /* istanbul ignore next */ [];
|
|
46
|
+
const customer = {
|
|
47
|
+
typeOf: customerByTransaction.typeOf, // 取引開始時で固定
|
|
48
|
+
id: customerByTransaction.id, // 取引開始時で固定
|
|
49
|
+
identifier, // 取引開始時で固定
|
|
50
|
+
...((Array.isArray(profileByRequest.additionalProperty)) && { additionalProperty: profileByRequest.additionalProperty }),
|
|
51
|
+
...((typeof profileByRequest.age === 'string') && { age: profileByRequest.age }),
|
|
52
|
+
...((typeof profileByRequest.address === 'string') && { address: profileByRequest.address }),
|
|
53
|
+
...((typeof profileByRequest.email === 'string') && { email: profileByRequest.email }),
|
|
54
|
+
...((typeof profileByRequest.familyName === 'string') && { familyName: profileByRequest.familyName }),
|
|
55
|
+
...((typeof profileByRequest.gender === 'string') && { gender: profileByRequest.gender }),
|
|
56
|
+
...((typeof profileByRequest.givenName === 'string') && { givenName: profileByRequest.givenName }),
|
|
57
|
+
...((typeof customerName === 'string') && { name: customerName }),
|
|
58
|
+
...((typeof formattedTelephone === 'string') && { telephone: formattedTelephone }),
|
|
59
|
+
...((typeof profileByRequest.url === 'string') && { url: profileByRequest.url })
|
|
60
|
+
};
|
|
61
|
+
return { customer };
|
|
62
|
+
};
|
|
63
|
+
}
|
|
@@ -5,7 +5,6 @@ import type { PlaceOrderRepo } from '../../../repo/transaction/placeOrder';
|
|
|
5
5
|
* 取引人プロフィール更新
|
|
6
6
|
*/
|
|
7
7
|
export declare function updateAgent(params: {
|
|
8
|
-
typeOf: factory.transactionType.PlaceOrder;
|
|
9
8
|
/**
|
|
10
9
|
* 取引ID
|
|
11
10
|
*/
|
|
@@ -13,8 +12,6 @@ export declare function updateAgent(params: {
|
|
|
13
12
|
agent: factory.order.ICustomer & {
|
|
14
13
|
telephoneRegion?: string;
|
|
15
14
|
};
|
|
16
|
-
}, options: {
|
|
17
|
-
useLibphonenumber: boolean;
|
|
18
15
|
}): (repos: {
|
|
19
16
|
orderInTransaction: OrderInTransactionRepo;
|
|
20
17
|
placeOrder: PlaceOrderRepo;
|
|
@@ -1,33 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.updateAgent = updateAgent;
|
|
4
|
-
const google_libphonenumber_1 = require("google-libphonenumber");
|
|
5
|
-
const libphonenumber_js_1 = require("libphonenumber-js");
|
|
6
4
|
const factory_1 = require("../../../factory");
|
|
7
|
-
|
|
5
|
+
const fixCustomer_1 = require("./updateAgent/fixCustomer");
|
|
6
|
+
/**
|
|
7
|
+
* 取引人プロフィール更新
|
|
8
|
+
*/
|
|
9
|
+
function updateAgent(params) {
|
|
8
10
|
return async (repos) => {
|
|
9
|
-
const { useLibphonenumber } = options;
|
|
10
|
-
let formattedTelephone;
|
|
11
|
-
try {
|
|
12
|
-
if (useLibphonenumber) {
|
|
13
|
-
const phoneNumber = (0, libphonenumber_js_1.parsePhoneNumberFromString)(String(params.agent.telephone), params.agent.telephoneRegion);
|
|
14
|
-
if (phoneNumber === undefined || !phoneNumber.isValid()) {
|
|
15
|
-
throw new factory_1.factory.errors.Argument('telephone', 'Invalid phone number');
|
|
16
|
-
}
|
|
17
|
-
formattedTelephone = phoneNumber.format('E.164');
|
|
18
|
-
}
|
|
19
|
-
else {
|
|
20
|
-
const phoneUtil = google_libphonenumber_1.PhoneNumberUtil.getInstance();
|
|
21
|
-
const phoneNumber = phoneUtil.parse(params.agent.telephone, params.agent.telephoneRegion);
|
|
22
|
-
if (!phoneUtil.isValidNumber(phoneNumber)) {
|
|
23
|
-
throw new factory_1.factory.errors.Argument('telephone', 'Invalid phone number');
|
|
24
|
-
}
|
|
25
|
-
formattedTelephone = phoneUtil.format(phoneNumber, google_libphonenumber_1.PhoneNumberFormat.E164);
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
catch (error) {
|
|
29
|
-
throw new factory_1.factory.errors.Argument('telephone', (error instanceof Error) ? error.message : String(error));
|
|
30
|
-
}
|
|
31
11
|
const transaction = await repos.placeOrder.findPlaceOrderInProgressById({
|
|
32
12
|
typeOf: factory_1.factory.transactionType.PlaceOrder,
|
|
33
13
|
id: params.id
|
|
@@ -35,76 +15,17 @@ function fixCustomer(params, options) {
|
|
|
35
15
|
if (transaction.agent.id !== params.agent.id) {
|
|
36
16
|
throw new factory_1.factory.errors.Forbidden('Transaction not yours');
|
|
37
17
|
}
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
typeOf: customerByTransaction.typeOf,
|
|
51
|
-
id: customerByTransaction.id,
|
|
52
|
-
...(Array.isArray(customerByTransaction.identifier))
|
|
53
|
-
? { identifier: customerByTransaction.identifier }
|
|
54
|
-
: /* istanbul ignore next */ undefined,
|
|
55
|
-
...(Array.isArray(params.agent.additionalProperty))
|
|
56
|
-
? { additionalProperty: params.agent.additionalProperty }
|
|
57
|
-
: /* istanbul ignore next */ undefined,
|
|
58
|
-
...(typeof params.agent.age === 'string') ? { age: params.agent.age }
|
|
59
|
-
: /* istanbul ignore next */ undefined,
|
|
60
|
-
...(typeof params.agent.address === 'string') ? { address: params.agent.address }
|
|
61
|
-
: /* istanbul ignore next */ undefined,
|
|
62
|
-
...(typeof params.agent.email === 'string') ? { email: params.agent.email }
|
|
63
|
-
: /* istanbul ignore next */ undefined,
|
|
64
|
-
...(typeof params.agent.familyName === 'string') ? { familyName: params.agent.familyName }
|
|
65
|
-
: /* istanbul ignore next */ undefined,
|
|
66
|
-
...(typeof params.agent.gender === 'string') ? { gender: params.agent.gender }
|
|
67
|
-
: /* istanbul ignore next */ undefined,
|
|
68
|
-
...(typeof params.agent.givenName === 'string') ? { givenName: params.agent.givenName }
|
|
69
|
-
: /* istanbul ignore next */ undefined,
|
|
70
|
-
...(typeof params.agent.name === 'string') ? { name: params.agent.name } : /* istanbul ignore next */ undefined,
|
|
71
|
-
...(typeof formattedTelephone === 'string') ? { telephone: formattedTelephone } : /* istanbul ignore next */ undefined,
|
|
72
|
-
...(typeof params.agent.url === 'string') ? { url: params.agent.url } : /* istanbul ignore next */ undefined
|
|
73
|
-
};
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
return { customer, transaction };
|
|
77
|
-
};
|
|
78
|
-
}
|
|
79
|
-
/**
|
|
80
|
-
* 取引人プロフィール更新
|
|
81
|
-
*/
|
|
82
|
-
function updateAgent(params, options) {
|
|
83
|
-
return async (repos) => {
|
|
84
|
-
const { customer, transaction } = await fixCustomer(params, options)(repos);
|
|
85
|
-
// also save in orderInTransaction(2024-06-20~)
|
|
86
|
-
if (customer !== undefined) {
|
|
87
|
-
// // 注文ドキュメントを参照(2026-06-24~)
|
|
88
|
-
// const orderNumber = await repos.orderInTransaction.findOrderNumberByIdentifier({
|
|
89
|
-
// identifier: params.id,
|
|
90
|
-
// project: { id: transaction.project.id },
|
|
91
|
-
// }, { onlyPlaceOrder: true });
|
|
92
|
-
const customerName = (typeof customer.name === 'string' && customer.name !== '')
|
|
93
|
-
? customer.name
|
|
94
|
-
: (typeof customer.givenName === 'string' && typeof customer.familyName === 'string'
|
|
95
|
-
&& customer.givenName !== '' && customer.familyName !== '')
|
|
96
|
-
? `${customer.givenName} ${customer.familyName}`
|
|
97
|
-
: undefined;
|
|
98
|
-
const customerInOrder = {
|
|
99
|
-
...customer,
|
|
100
|
-
identifier: (Array.isArray(customer.identifier)) ? customer.identifier : [],
|
|
101
|
-
...(typeof customerName === 'string') ? { name: customerName } : undefined
|
|
102
|
-
};
|
|
103
|
-
await repos.orderInTransaction.setCustomerByIdentifier({
|
|
104
|
-
project: transaction.project,
|
|
105
|
-
identifier: params.id,
|
|
106
|
-
customer: customerInOrder
|
|
107
|
-
});
|
|
108
|
-
}
|
|
18
|
+
const { id: _id, typeOf: _typeOf, ...profileByRequest } = params.agent;
|
|
19
|
+
const { customer } = await (0, fixCustomer_1.fixCustomer)({ id: params.id, profileByRequest })(repos);
|
|
20
|
+
// // 注文ドキュメントを参照(2026-06-24~)
|
|
21
|
+
// const orderNumber = await repos.orderInTransaction.findOrderNumberByIdentifier({
|
|
22
|
+
// identifier: params.id,
|
|
23
|
+
// project: { id: transaction.project.id },
|
|
24
|
+
// }, { onlyPlaceOrder: true });
|
|
25
|
+
await repos.orderInTransaction.setCustomerByIdentifier({
|
|
26
|
+
project: transaction.project,
|
|
27
|
+
identifier: params.id,
|
|
28
|
+
customer
|
|
29
|
+
});
|
|
109
30
|
};
|
|
110
31
|
}
|
package/package.json
CHANGED
|
@@ -17,7 +17,6 @@
|
|
|
17
17
|
"@sendgrid/client": "8.1.4",
|
|
18
18
|
"@surfrock/sdk": "2.0.0",
|
|
19
19
|
"debug": "4.4.3",
|
|
20
|
-
"google-libphonenumber": "3.2.35",
|
|
21
20
|
"http-status": "2.1.0",
|
|
22
21
|
"jsonwebtoken": "9.0.0",
|
|
23
22
|
"libphonenumber-js": "1.13.8",
|
|
@@ -35,7 +34,6 @@
|
|
|
35
34
|
"@sendgrid/helpers": "8.0.0",
|
|
36
35
|
"@size-limit/preset-big-lib": "12.0.0",
|
|
37
36
|
"@types/debug": "4.1.13",
|
|
38
|
-
"@types/google-libphonenumber": "7.4.30",
|
|
39
37
|
"@types/jsonwebtoken": "9.0.1",
|
|
40
38
|
"@types/lodash.difference": "^4.5.6",
|
|
41
39
|
"@types/node": "22.19.7",
|
|
@@ -92,5 +90,5 @@
|
|
|
92
90
|
"postversion": "git push origin --tags",
|
|
93
91
|
"prepublishOnly": "npm run clean && npm run build"
|
|
94
92
|
},
|
|
95
|
-
"version": "25.2.0-alpha.
|
|
93
|
+
"version": "25.2.0-alpha.34"
|
|
96
94
|
}
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import { factory } from '../../factory';
|
|
2
|
-
import type { ReserveTransactionRepo } from '../../repo/assetTransaction/reserve';
|
|
3
|
-
import type { IKeyOfProjection, ReservationRepo } from '../../repo/reservation';
|
|
4
|
-
/**
|
|
5
|
-
* 予約検索レスポンスとしての予約
|
|
6
|
-
* 予約ドキュメントに予約取引の情報を補完する
|
|
7
|
-
*/
|
|
8
|
-
type IReservationAsFindResult = Omit<factory.reservation.eventReservation.IReservation, 'underName' | 'reservedTicket' | 'reservationFor'> & {
|
|
9
|
-
underName?: factory.assetTransaction.reserve.IUnderName;
|
|
10
|
-
reservedTicket?: factory.reservation.eventReservation.IReservedTicket | factory.assetTransaction.reserve.IObjectSubReservation['reservedTicket'];
|
|
11
|
-
reservationFor?: factory.reservation.eventReservation.IReservationForMinimized | factory.assetTransaction.reserve.IReservationFor;
|
|
12
|
-
price?: never;
|
|
13
|
-
};
|
|
14
|
-
/**
|
|
15
|
-
* 予約を検索する
|
|
16
|
-
*/
|
|
17
|
-
export declare function findReservations(params: factory.reservation.eventReservation.ISearchConditions, options: {
|
|
18
|
-
inclusion: Partial<Record<IKeyOfProjection | 'underName', 1>>;
|
|
19
|
-
/**
|
|
20
|
-
* reservationForを予約ドキュメントそのままで返すかどうか
|
|
21
|
-
*/
|
|
22
|
-
minimizeReservationFor: boolean;
|
|
23
|
-
/**
|
|
24
|
-
* reservedTicketからticketTypeを除外するかどうか
|
|
25
|
-
*/
|
|
26
|
-
minimizeReservedTicket: boolean;
|
|
27
|
-
}): (repos: {
|
|
28
|
-
assetTransaction: {
|
|
29
|
-
reserve: ReserveTransactionRepo;
|
|
30
|
-
};
|
|
31
|
-
reservation: ReservationRepo;
|
|
32
|
-
}) => Promise<IReservationAsFindResult[]>;
|
|
33
|
-
export {};
|
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.findReservations = findReservations;
|
|
4
|
-
/**
|
|
5
|
-
* 予約を検索する
|
|
6
|
-
*/
|
|
7
|
-
function findReservations(params, options) {
|
|
8
|
-
return async (repos) => {
|
|
9
|
-
const { inclusion, minimizeReservationFor, minimizeReservedTicket } = options;
|
|
10
|
-
const rawReservations = await repos.reservation.findReservations(params, inclusion);
|
|
11
|
-
if (rawReservations.length === 0) {
|
|
12
|
-
return [];
|
|
13
|
-
}
|
|
14
|
-
else {
|
|
15
|
-
const requireUnderName = Object.keys(inclusion).includes('underName');
|
|
16
|
-
const requireReservedTicket = Object.keys(inclusion).includes('reservedTicket');
|
|
17
|
-
const requireReservationFor = Object.keys(inclusion).includes('reservationFor');
|
|
18
|
-
const reservationIds = rawReservations.map(({ id }) => id);
|
|
19
|
-
const subReservations = await repos.assetTransaction.reserve.findSubReservationsById({
|
|
20
|
-
ids: reservationIds
|
|
21
|
-
});
|
|
22
|
-
return rawReservations.map((reservation) => {
|
|
23
|
-
const subReservationByTransaction = subReservations.find((s) => s.id === reservation.id);
|
|
24
|
-
const underNameByTransaction = subReservationByTransaction?.underName;
|
|
25
|
-
const ticketTypeByTransaction = subReservationByTransaction?.reservedTicket?.ticketType;
|
|
26
|
-
const reservationForByTransaction = subReservationByTransaction?.reservationFor;
|
|
27
|
-
const { reservationFor, issuedThrough: _issuedThrough, priceCurrency: _priceCurrency, numSeats: _numSeats, reservedTicket, ...rawReservation4result } = reservation;
|
|
28
|
-
return {
|
|
29
|
-
...rawReservation4result, // 予約ドキュメントはそのまま返す
|
|
30
|
-
...(requireUnderName && underNameByTransaction !== undefined) ? { underName: underNameByTransaction } : undefined, // underNameがあれば上書き
|
|
31
|
-
...(requireReservedTicket)
|
|
32
|
-
? (!minimizeReservedTicket && ticketTypeByTransaction !== undefined)
|
|
33
|
-
? {
|
|
34
|
-
reservedTicket: {
|
|
35
|
-
...reservedTicket, // 予約ドキュメントのreservedTicketはそのまま返す
|
|
36
|
-
ticketType: ticketTypeByTransaction
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
: { reservedTicket } // 予約検索レスポンスからticketTypeは廃止(2026-06-01~)
|
|
40
|
-
: undefined,
|
|
41
|
-
...(requireReservationFor)
|
|
42
|
-
? (!minimizeReservationFor && reservationForByTransaction !== undefined)
|
|
43
|
-
? { reservationFor: reservationForByTransaction }
|
|
44
|
-
: { reservationFor } // 予約検索レスポンスのreservationForはそのまま返す(2026-06-01~)
|
|
45
|
-
: undefined,
|
|
46
|
-
// ...(requireReservedTicket && ticketTypeByTransaction !== undefined) // ticketTypeがあれば上書き
|
|
47
|
-
// ? {
|
|
48
|
-
// reservedTicket: {
|
|
49
|
-
// ...reservedTicket, // 予約ドキュメントのreservedTicketはそのまま返す
|
|
50
|
-
// ticketType: ticketTypeByTransaction
|
|
51
|
-
// }
|
|
52
|
-
// }
|
|
53
|
-
// : undefined,
|
|
54
|
-
// ...(requireReservationFor && reservationForByTransaction !== undefined)
|
|
55
|
-
// ? { reservationFor: reservationForByTransaction }
|
|
56
|
-
// : undefined, // reservationForがあれば上書き(2026-04-06~)
|
|
57
|
-
};
|
|
58
|
-
});
|
|
59
|
-
}
|
|
60
|
-
};
|
|
61
|
-
}
|