@chevre/domain 22.0.0-alpha.8 → 22.0.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/aggregateAllEvents2.ts +13 -6
- package/example/src/chevre/aggregation/aggregateOffersOnEvent.ts +56 -52
- package/example/src/chevre/changeOrderStatus.ts +29 -0
- package/example/src/chevre/projectEventFieldsById.ts +35 -0
- package/example/src/chevre/projectOrderFieldsById.ts +41 -0
- package/example/src/chevre/searchEvents.ts +8 -7
- package/example/src/chevre/searchOrders.ts +14 -4
- package/example/src/chevre/sendGrid/filterEmailActivity.ts +33 -0
- package/lib/chevre/credentials/customSearch.d.ts +13 -0
- package/lib/chevre/credentials/customSearch.js +14 -0
- package/lib/chevre/credentials/lineNotify.d.ts +17 -0
- package/lib/chevre/credentials/lineNotify.js +16 -0
- package/lib/chevre/credentials/sendGrid.d.ts +11 -0
- package/lib/chevre/credentials/sendGrid.js +13 -0
- package/lib/chevre/credentials.d.ts +15 -18
- package/lib/chevre/credentials.js +42 -72
- package/lib/chevre/emailMessageBuilder.d.ts +3 -5
- package/lib/chevre/factory/event.d.ts +3 -1
- package/lib/chevre/index.d.ts +1 -0
- package/lib/chevre/repo/aggregateReservation.js +14 -4
- package/lib/chevre/repo/event.d.ts +13 -6
- package/lib/chevre/repo/event.js +58 -68
- package/lib/chevre/repo/order.d.ts +16 -7
- package/lib/chevre/repo/order.js +93 -56
- package/lib/chevre/repo/rateLimit/offer.js +0 -8
- package/lib/chevre/repo/stockHolder.js +0 -7
- package/lib/chevre/service/aggregation/event/aggregateOffers.d.ts +0 -2
- package/lib/chevre/service/aggregation/event/aggregateOffers.js +6 -4
- package/lib/chevre/service/aggregation/event/aggregateScreeningEvent.d.ts +12 -1
- package/lib/chevre/service/aggregation/event/aggregateScreeningEvent.js +5 -7
- package/lib/chevre/service/aggregation/event/aggregateUseActionsOnEvent.js +2 -2
- package/lib/chevre/service/aggregation/event/findEventOffers.d.ts +7 -3
- package/lib/chevre/service/assetTransaction/pay.js +1 -1
- package/lib/chevre/service/assetTransaction/reserve/confirm.js +2 -3
- package/lib/chevre/service/assetTransaction/reserve/exportTasksById.d.ts +2 -1
- package/lib/chevre/service/assetTransaction/reserve/exportTasksById.js +4 -4
- package/lib/chevre/service/assetTransaction/reserve/start/factory/createStartParams.js +4 -0
- package/lib/chevre/service/assetTransaction/reserve/start.d.ts +2 -2
- package/lib/chevre/service/assetTransaction/reserve/start.js +14 -15
- package/lib/chevre/service/assetTransaction/reserve/validateStartRequest.d.ts +1 -1
- package/lib/chevre/service/assetTransaction.d.ts +2 -1
- package/lib/chevre/service/assetTransaction.js +2 -2
- package/lib/chevre/service/notification.d.ts +14 -6
- package/lib/chevre/service/notification.js +24 -24
- package/lib/chevre/service/offer/event/authorize/factory.d.ts +1 -1
- package/lib/chevre/service/offer/event/authorize/factory.js +2 -1
- package/lib/chevre/service/offer/event/authorize/processStartReserve4chevre.d.ts +1 -1
- package/lib/chevre/service/offer/event/authorize/processStartReserve4chevre.js +4 -1
- package/lib/chevre/service/offer/event/authorize.js +9 -11
- package/lib/chevre/service/offer/event/searchEventTicketOffers.d.ts +1 -0
- package/lib/chevre/service/offer/event/searchEventTicketOffers.js +13 -5
- package/lib/chevre/service/offer/event/voidTransaction.d.ts +6 -4
- package/lib/chevre/service/offer/event/voidTransaction.js +16 -5
- package/lib/chevre/service/offer/event/voidTransactionByActionId.d.ts +4 -1
- package/lib/chevre/service/offer/event/voidTransactionByActionId.js +5 -1
- package/lib/chevre/service/offer/event.js +0 -1
- package/lib/chevre/service/offer/eventServiceByCOA/authorize.js +6 -4
- package/lib/chevre/service/offer/eventServiceByCOA/changeOffers.js +5 -3
- package/lib/chevre/service/offer/eventServiceByCOA/factory.d.ts +5 -2
- package/lib/chevre/service/offer/factory.js +2 -3
- package/lib/chevre/service/offer/onEventChanged.js +20 -22
- package/lib/chevre/service/offer/product/searchProductOffers.js +1 -6
- package/lib/chevre/service/offer.js +3 -2
- package/lib/chevre/service/order/createAccountingReportIfNotExist.d.ts +1 -1
- package/lib/chevre/service/order/deleteOrder.js +1 -1
- package/lib/chevre/service/order/onAssetTransactionStatusChanged.js +29 -18
- package/lib/chevre/service/order/onOrderStatusChanged/onOrderInTransit.d.ts +1 -1
- package/lib/chevre/service/order/onOrderStatusChanged/onOrderProcessing/factory.d.ts +1 -1
- package/lib/chevre/service/order/returnOrder.js +1 -1
- package/lib/chevre/service/order/sendOrder.js +2 -2
- package/lib/chevre/service/payment/factory/createPayObjectServiceOutput.js +3 -6
- package/lib/chevre/service/payment/movieTicket/checkMovieTicket.js +6 -7
- package/lib/chevre/service/payment/movieTicket/factory.d.ts +13 -2
- package/lib/chevre/service/payment/movieTicket/factory.js +12 -5
- package/lib/chevre/service/payment/movieTicket/payMovieTicket.js +6 -2
- package/lib/chevre/service/payment/movieTicket/processPurchaseNumberAuth.d.ts +11 -1
- package/lib/chevre/service/payment/movieTicket/processPurchaseNumberAuth.js +12 -5
- package/lib/chevre/service/payment/movieTicket/validation.js +5 -5
- package/lib/chevre/service/payment.js +2 -2
- package/lib/chevre/service/reserve/searchByOrder.js +1 -1
- package/lib/chevre/service/task/acceptCOAOffer.js +8 -17
- package/lib/chevre/service/task/aggregateOffers.js +11 -13
- package/lib/chevre/service/task/aggregateUseActionsOnEvent.js +9 -9
- package/lib/chevre/service/task/authorizePayment.js +3 -3
- package/lib/chevre/service/task/cancelMoneyTransfer.js +5 -5
- package/lib/chevre/service/task/cancelPendingReservation.js +2 -2
- package/lib/chevre/service/task/cancelReservation.js +2 -2
- package/lib/chevre/service/task/confirmMoneyTransfer.js +6 -6
- package/lib/chevre/service/task/confirmPayTransaction.js +10 -14
- package/lib/chevre/service/task/confirmRegisterService.js +4 -4
- package/lib/chevre/service/task/confirmRegisterServiceTransaction.js +6 -6
- package/lib/chevre/service/task/confirmReserveTransaction.js +9 -17
- package/lib/chevre/service/task/createAccountingReport.js +5 -2
- package/lib/chevre/service/task/createEvent.js +5 -5
- package/lib/chevre/service/task/deleteTransaction.js +13 -13
- package/lib/chevre/service/task/givePointAward.js +7 -7
- package/lib/chevre/service/task/importEventCapacitiesFromCOA.js +4 -13
- package/lib/chevre/service/task/importEventsFromCOA.js +4 -13
- package/lib/chevre/service/task/importOffersFromCOA.js +5 -14
- package/lib/chevre/service/task/moneyTransfer.js +5 -5
- package/lib/chevre/service/task/onAssetTransactionStatusChanged.js +0 -3
- package/lib/chevre/service/task/onOrderPaymentCompleted.js +0 -3
- package/lib/chevre/service/task/pay.js +2 -2
- package/lib/chevre/service/task/placeOrder.js +2 -2
- package/lib/chevre/service/task/refund.js +2 -2
- package/lib/chevre/service/task/registerService.js +6 -6
- package/lib/chevre/service/task/reserve.js +2 -2
- package/lib/chevre/service/task/returnMoneyTransfer.js +9 -9
- package/lib/chevre/service/task/returnPayTransaction.js +12 -12
- package/lib/chevre/service/task/returnPointAward.js +7 -7
- package/lib/chevre/service/task/returnReserveTransaction.js +5 -14
- package/lib/chevre/service/task/sendEmailMessage.js +7 -7
- package/lib/chevre/service/task/sendOrder.js +2 -2
- package/lib/chevre/service/task/triggerWebhook.js +5 -5
- package/lib/chevre/service/task/voidMoneyTransferTransaction.js +6 -6
- package/lib/chevre/service/task/voidPayTransaction.js +2 -2
- package/lib/chevre/service/task/voidPayment.js +2 -2
- package/lib/chevre/service/task/voidRegisterServiceTransaction.js +6 -9
- package/lib/chevre/service/task/voidReserveTransaction.js +7 -15
- package/lib/chevre/service/task.d.ts +26 -9
- package/lib/chevre/service/task.js +6 -20
- package/lib/chevre/service/transaction/moneyTransfer.js +6 -3
- package/lib/chevre/service/transaction/placeOrder/confirm/validation/validateMovieTicket.js +60 -71
- package/lib/chevre/service/transaction/placeOrder/exportTasks/factory.js +1 -1
- package/lib/chevre/service/transaction/returnOrder/potentialActions/returnPaymentMethod.d.ts +1 -1
- package/lib/chevre/service/transaction/returnOrder/potentialActions/returnPointAward.d.ts +1 -1
- package/lib/chevre/service/transaction/returnOrder/potentialActions/sendEmailMessage.d.ts +1 -1
- package/lib/chevre/service/transaction/returnOrder/potentialActions.d.ts +4 -6
- package/lib/chevre/service/transaction/returnOrder/potentialActions.js +0 -28
- package/lib/chevre/service/transaction/returnOrder/preStart.js +5 -2
- package/lib/chevre/service/transaction/returnOrder.js +9 -6
- package/lib/chevre/service/validation/validateOrder.js +4 -2
- package/lib/chevre/settings.d.ts +34 -13
- package/lib/chevre/settings.js +6 -54
- package/package.json +3 -4
- package/lib/chevre/credentials/coa.d.ts +0 -17
- package/lib/chevre/credentials/coa.js +0 -17
|
@@ -10,93 +10,37 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
exports.credentials = void 0;
|
|
13
|
-
// export const credentials = {
|
|
14
|
-
// migrate to JWTCredentials(2024-07-11~)
|
|
15
|
-
// jwt: {
|
|
16
|
-
// secret: <string>process.env.TOKEN_SECRET,
|
|
17
|
-
// // RESOURCE_SERVER_IDENTIFIERとは分離して指定可能に拡張(2024-05-02~)
|
|
18
|
-
// // issuer: (typeof process.env.TOKEN_ISSUER_BY_AUTHORIZATION === 'string')
|
|
19
|
-
// // ? process.env.TOKEN_ISSUER_BY_AUTHORIZATION
|
|
20
|
-
// // : <string>process.env.RESOURCE_SERVER_IDENTIFIER,
|
|
21
|
-
// /**
|
|
22
|
-
// * トークン検証時の発行者リスト
|
|
23
|
-
// */
|
|
24
|
-
// issuers: (typeof process.env.TOKEN_ISSUERS_BY_AUTHORIZATION === 'string')
|
|
25
|
-
// ? process.env.TOKEN_ISSUERS_BY_AUTHORIZATION.split(' ')
|
|
26
|
-
// : [], // 追加(2024-05-02~)
|
|
27
|
-
// version: (typeof process.env.TOKEN_VERSION === 'string') ? process.env.TOKEN_VERSION : '2024-05-02', // 追加(2024-05-02~)
|
|
28
|
-
// payloadTypPrefix: (typeof process.env.TOKEN_PAYLOAD_TYP_PREFIX === 'string') ? process.env.TOKEN_PAYLOAD_TYP_PREFIX : 'chevre'
|
|
29
|
-
// }
|
|
30
|
-
// };
|
|
31
13
|
/**
|
|
32
|
-
*
|
|
14
|
+
* 外部サービス認証情報
|
|
33
15
|
*/
|
|
34
16
|
var credentials;
|
|
35
17
|
(function (credentials) {
|
|
36
|
-
// export const
|
|
37
|
-
//
|
|
38
|
-
//
|
|
39
|
-
// tokenIssuerEndpoint: <string>process.env.TOKEN_ISSUER_ENDPOINT
|
|
18
|
+
// export const customSearch = {
|
|
19
|
+
// engineId: <string>process.env.CUSTOM_SEARCH_ENGINE_ID,
|
|
20
|
+
// apiKey: <string>process.env.GOOGLE_API_KEY
|
|
40
21
|
// };
|
|
41
|
-
// export const
|
|
42
|
-
//
|
|
43
|
-
//
|
|
44
|
-
//
|
|
45
|
-
//
|
|
22
|
+
// export const lineNotify = {
|
|
23
|
+
// url: process.env.LINE_NOTIFY_URL,
|
|
24
|
+
// accessToken: process.env.LINE_NOTIFY_ACCESS_TOKEN,
|
|
25
|
+
// accessTokenAlert: process.env.LINE_NOTIFY_ACCESS_TOKEN_ALERT,
|
|
26
|
+
// accessTokenInfo: process.env.LINE_NOTIFY_ACCESS_TOKEN_INFO
|
|
46
27
|
// };
|
|
47
|
-
// export const
|
|
48
|
-
//
|
|
49
|
-
// refreshToken: <string>process.env.COA_REFRESH_TOKEN,
|
|
50
|
-
// // tslint:disable-next-line:no-magic-numbers
|
|
51
|
-
// timeout: (typeof process.env.COA_TIMEOUT === 'string') ? Number(process.env.COA_TIMEOUT) : 20000,
|
|
52
|
-
// useFetch: process.env.COA_USE_FETCH === '1'
|
|
28
|
+
// export const sendGrid = {
|
|
29
|
+
// apiKey: process.env.SENDGRID_API_KEY
|
|
53
30
|
// };
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
apiKey: process.env.GOOGLE_API_KEY
|
|
57
|
-
};
|
|
58
|
-
// export const gmo = {
|
|
59
|
-
// // tslint:disable-next-line:no-magic-numbers
|
|
60
|
-
// timeout: (typeof process.env.GMO_TIMEOUT === 'string') ? Number(process.env.GMO_TIMEOUT) : 5000,
|
|
61
|
-
// timeoutBackground: (typeof process.env.GMO_TIMEOUT_BACKGROUND === 'string')
|
|
62
|
-
// ? Number(process.env.GMO_TIMEOUT_BACKGROUND)
|
|
63
|
-
// : undefined,
|
|
64
|
-
// useFetch: process.env.GMO_USE_FETCH === '1'
|
|
65
|
-
// };
|
|
66
|
-
credentials.lineNotify = {
|
|
67
|
-
url: process.env.LINE_NOTIFY_URL,
|
|
68
|
-
accessToken: process.env.LINE_NOTIFY_ACCESS_TOKEN,
|
|
69
|
-
accessTokenAlert: process.env.LINE_NOTIFY_ACCESS_TOKEN_ALERT,
|
|
70
|
-
accessTokenInfo: process.env.LINE_NOTIFY_ACCESS_TOKEN_INFO
|
|
71
|
-
};
|
|
72
|
-
// export const movieticketReserve = {
|
|
73
|
-
// /**
|
|
74
|
-
// * 着券時タイムアウト
|
|
75
|
-
// */
|
|
76
|
-
// // tslint:disable-next-line:no-magic-numbers
|
|
77
|
-
// timeout: (typeof process.env.MVTK_TIMEOUT === 'string') ? Number(process.env.MVTK_TIMEOUT) : 5000,
|
|
78
|
-
// /**
|
|
79
|
-
// * 認証時タイムアウト
|
|
80
|
-
// */
|
|
81
|
-
// // tslint:disable-next-line:no-magic-numbers
|
|
82
|
-
// timeoutCheck: (typeof process.env.MVTK_TIMEOUT_CHECK === 'string') ? Number(process.env.MVTK_TIMEOUT_CHECK) : 5000
|
|
83
|
-
// };
|
|
84
|
-
credentials.sendGrid = {
|
|
85
|
-
apiKey: process.env.SENDGRID_API_KEY
|
|
86
|
-
};
|
|
87
|
-
let COA;
|
|
88
|
-
(function (COA) {
|
|
31
|
+
let CustomSearch;
|
|
32
|
+
(function (CustomSearch) {
|
|
89
33
|
let cred;
|
|
90
34
|
function createInstance(...params) {
|
|
91
35
|
return __awaiter(this, void 0, void 0, function* () {
|
|
92
36
|
if (cred === undefined) {
|
|
93
|
-
cred = (yield Promise.resolve().then(() => require('./credentials/
|
|
37
|
+
cred = (yield Promise.resolve().then(() => require('./credentials/customSearch'))).CustomSearchCredentials;
|
|
94
38
|
}
|
|
95
39
|
return new cred(...params);
|
|
96
40
|
});
|
|
97
41
|
}
|
|
98
|
-
|
|
99
|
-
})(
|
|
42
|
+
CustomSearch.createInstance = createInstance;
|
|
43
|
+
})(CustomSearch = credentials.CustomSearch || (credentials.CustomSearch = {}));
|
|
100
44
|
let JWT;
|
|
101
45
|
(function (JWT) {
|
|
102
46
|
let cred;
|
|
@@ -110,4 +54,30 @@ var credentials;
|
|
|
110
54
|
}
|
|
111
55
|
JWT.createInstance = createInstance;
|
|
112
56
|
})(JWT = credentials.JWT || (credentials.JWT = {}));
|
|
57
|
+
let LINENotify;
|
|
58
|
+
(function (LINENotify) {
|
|
59
|
+
let cred;
|
|
60
|
+
function createInstance(...params) {
|
|
61
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
62
|
+
if (cred === undefined) {
|
|
63
|
+
cred = (yield Promise.resolve().then(() => require('./credentials/lineNotify'))).LINENotifyCredentials;
|
|
64
|
+
}
|
|
65
|
+
return new cred(...params);
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
LINENotify.createInstance = createInstance;
|
|
69
|
+
})(LINENotify = credentials.LINENotify || (credentials.LINENotify = {}));
|
|
70
|
+
let SendGrid;
|
|
71
|
+
(function (SendGrid) {
|
|
72
|
+
let cred;
|
|
73
|
+
function createInstance(...params) {
|
|
74
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
75
|
+
if (cred === undefined) {
|
|
76
|
+
cred = (yield Promise.resolve().then(() => require('./credentials/sendGrid'))).SendGridCredentials;
|
|
77
|
+
}
|
|
78
|
+
return new cred(...params);
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
SendGrid.createInstance = createInstance;
|
|
82
|
+
})(SendGrid = credentials.SendGrid || (credentials.SendGrid = {}));
|
|
113
83
|
})(credentials = exports.credentials || (exports.credentials = {}));
|
|
@@ -4,9 +4,7 @@ type ISendableEmailMessage = factory.action.transfer.send.message.email.IObjectA
|
|
|
4
4
|
identifier: string;
|
|
5
5
|
name: string;
|
|
6
6
|
};
|
|
7
|
-
export type IOrderAsCreateEmailParams = Pick<factory.order.IOrder, 'confirmationNumber' | 'identifier' | 'orderDate' | 'orderNumber' | 'orderStatus' | 'orderedItem' | 'paymentMethods' | 'price' | 'priceCurrency' | 'seller' | 'typeOf'> & {
|
|
8
|
-
customer: factory.order.ICustomer;
|
|
9
|
-
};
|
|
7
|
+
export type IOrderAsCreateEmailParams = Pick<factory.order.IOrder, 'confirmationNumber' | 'identifier' | 'customer' | 'orderDate' | 'orderNumber' | 'orderStatus' | 'orderedItem' | 'paymentMethods' | 'price' | 'priceCurrency' | 'seller' | 'typeOf'> & {};
|
|
10
8
|
/**
|
|
11
9
|
* 注文配送メッセージを作成する
|
|
12
10
|
*/
|
|
@@ -20,7 +18,7 @@ declare function createSendOrderMessage(params: {
|
|
|
20
18
|
* 注文返品メッセージを作成する
|
|
21
19
|
*/
|
|
22
20
|
declare function createReturnOrderMessage(params: {
|
|
23
|
-
order:
|
|
21
|
+
order: IOrderAsCreateEmailParams;
|
|
24
22
|
email?: factory.creativeWork.message.email.ICustomization;
|
|
25
23
|
emailMessage?: factory.creativeWork.message.email.ICreativeWork;
|
|
26
24
|
index: number;
|
|
@@ -29,7 +27,7 @@ declare function createReturnOrderMessage(params: {
|
|
|
29
27
|
* 返金メッセージを作成する
|
|
30
28
|
*/
|
|
31
29
|
declare function createRefundMessage(params: {
|
|
32
|
-
order:
|
|
30
|
+
order: IOrderAsCreateEmailParams;
|
|
33
31
|
email?: factory.creativeWork.message.email.ICustomization;
|
|
34
32
|
paymentMethodId: string;
|
|
35
33
|
}, settings: Settings): Promise<ISendableEmailMessage>;
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import * as factory from '../factory';
|
|
2
|
-
export type IMinimizedIndividualEvent<T extends factory.eventType.ScreeningEvent | factory.eventType.Event> = T extends factory.eventType.ScreeningEvent ? Pick<factory.event.IEvent<T>, 'project' | 'organizer' | 'id' | 'typeOf' | '
|
|
2
|
+
export type IMinimizedIndividualEvent<T extends factory.eventType.ScreeningEvent | factory.eventType.Event> = T extends factory.eventType.ScreeningEvent ? Pick<factory.event.IEvent<T>, 'project' | 'organizer' | 'id' | 'typeOf' | 'name' | 'doorTime' | 'endDate' | 'eventStatus' | 'location' | 'startDate' | 'superEvent' | 'offers' | 'coaInfo' | 'identifier'> : T extends factory.eventType.Event ? Pick<factory.event.IEvent<T>, 'project' | 'organizer' | 'id' | 'typeOf' | 'name' | 'doorTime' | 'endDate' | 'eventStatus' | 'location' | 'startDate' | 'offers'> & {
|
|
3
|
+
superEvent?: never;
|
|
4
|
+
} : never;
|
|
3
5
|
/**
|
|
4
6
|
* 興行イベントのsuperEventを作成する
|
|
5
7
|
*/
|
package/lib/chevre/index.d.ts
CHANGED
|
@@ -13,5 +13,6 @@ import * as service from './service';
|
|
|
13
13
|
import * as settings from './settings';
|
|
14
14
|
export { credentials, errorHandler, eventEmitter, factory, repository, service, settings };
|
|
15
15
|
export declare function loadPecorinoapi(): Promise<typeof Pecorinoapi>;
|
|
16
|
+
export type COA = typeof COAService;
|
|
16
17
|
export declare function loadCOA(): Promise<typeof COAService>;
|
|
17
18
|
export declare function loadGMO(): Promise<typeof GMOService>;
|
|
@@ -68,17 +68,18 @@ class AggregateReservationRepo {
|
|
|
68
68
|
var _a;
|
|
69
69
|
return __awaiter(this, void 0, void 0, function* () {
|
|
70
70
|
const matchStages = AggregateReservationRepo.CREATE_MONGO_CONDITIONS(params);
|
|
71
|
-
let
|
|
71
|
+
let projectStage = {
|
|
72
72
|
_id: 0,
|
|
73
73
|
id: '$reservationFor.id'
|
|
74
74
|
};
|
|
75
75
|
if (Array.isArray(inclusion) && inclusion.length > 0) {
|
|
76
76
|
inclusion.forEach((field) => {
|
|
77
|
-
|
|
77
|
+
projectStage[field] = { $ifNull: [`$${field}`, '$false'] };
|
|
78
|
+
// projectStage[field] = 1;
|
|
78
79
|
});
|
|
79
80
|
}
|
|
80
81
|
else {
|
|
81
|
-
|
|
82
|
+
projectStage = {
|
|
82
83
|
_id: 0,
|
|
83
84
|
id: '$reservationFor.id',
|
|
84
85
|
aggregateEntranceGate: 1,
|
|
@@ -91,7 +92,16 @@ class AggregateReservationRepo {
|
|
|
91
92
|
...(typeof sortByStartDate === 'number')
|
|
92
93
|
? [{ $sort: { 'reservationFor.startDate': sortByStartDate } }]
|
|
93
94
|
: [],
|
|
94
|
-
|
|
95
|
+
// 現時点でreservationFor.idへのunique indexがないので、重複ドキュメント対応として、$group
|
|
96
|
+
{
|
|
97
|
+
$group: {
|
|
98
|
+
_id: '$reservationFor.id',
|
|
99
|
+
reservationFor: { $first: '$reservationFor' },
|
|
100
|
+
aggregateEntranceGate: { $first: '$aggregateEntranceGate' },
|
|
101
|
+
aggregateOffer: { $first: '$aggregateOffer' }
|
|
102
|
+
}
|
|
103
|
+
},
|
|
104
|
+
{ $project: projectStage }
|
|
95
105
|
]);
|
|
96
106
|
if (typeof params.limit === 'number' && params.limit > 0) {
|
|
97
107
|
const page = (typeof params.page === 'number' && params.page > 0) ? params.page : 1;
|
|
@@ -68,13 +68,16 @@ interface IStatus {
|
|
|
68
68
|
interface IAggregateEvent {
|
|
69
69
|
statuses: IStatus[];
|
|
70
70
|
}
|
|
71
|
-
|
|
71
|
+
export import IMinimizedIndividualEvent = EventFactory.IMinimizedIndividualEvent;
|
|
72
|
+
type IKeyOfProjection<T extends factory.eventType> = keyof factory.event.IEvent<T> | '_id' | '__v' | 'createdAt' | 'updatedAt' | 'aggregateEntranceGate' | 'aggregateOffer' | 'superEvent.location.id' | 'offers.itemOffered';
|
|
73
|
+
/**
|
|
74
|
+
* minimizedEvent検索時のprojection候補
|
|
75
|
+
* add(2024-07-18~)
|
|
76
|
+
*/
|
|
77
|
+
type IKeyOfProjection4minimizedEvent<T extends factory.eventType> = T extends factory.eventType.ScreeningEvent ? Exclude<keyof IMinimizedIndividualEvent<T>, 'additionalProperty' | 'id'> | 'superEvent.id' | 'location.branchCode' | 'superEvent.workPerformed.identifier' | 'superEvent.location.id' | 'offers.itemOffered' | 'offers.itemOffered.id' | 'offers.offeredThrough' | 'offers.unacceptedPaymentMethod' | 'offers.eligibleQuantity' : T extends factory.eventType.Event ? Exclude<keyof IMinimizedIndividualEvent<T>, 'additionalProperty' | 'id'> | 'superEvent.id' | 'location.branchCode' | 'superEvent.workPerformed.identifier' | 'superEvent.location.id' | 'offers.itemOffered' | 'offers.itemOffered.id' | 'offers.offeredThrough' | 'offers.unacceptedPaymentMethod' | 'offers.eligibleQuantity' : never;
|
|
72
78
|
type IUnset<T extends factory.eventType> = {
|
|
73
79
|
[key in keyof factory.event.IEvent<T>]?: 1;
|
|
74
80
|
};
|
|
75
|
-
export import IMinimizedIndividualEvent = EventFactory.IMinimizedIndividualEvent;
|
|
76
|
-
export declare const keyOfMinimizedScreeningEvent: IKeyOfProjection<factory.eventType.ScreeningEvent>[];
|
|
77
|
-
export declare const keyOfMinimizedEvent: IKeyOfProjection<factory.eventType.Event>[];
|
|
78
81
|
/**
|
|
79
82
|
* イベントリポジトリ
|
|
80
83
|
*/
|
|
@@ -159,9 +162,13 @@ export declare class EventRepo {
|
|
|
159
162
|
*/
|
|
160
163
|
search<T extends factory.eventType>(params: ISearchConditions<T>, inclusion: IKeyOfProjection<T>[], exclusion: IKeyOfProjection<T>[]): Promise<Omit<factory.event.IEvent<T>, 'aggregateEntranceGate' | 'aggregateOffer'>[]>;
|
|
161
164
|
searchIds<T extends factory.eventType>(params: ISearchConditions<T>): Promise<string[]>;
|
|
162
|
-
|
|
165
|
+
/**
|
|
166
|
+
* 特定イベントから指定フィールドのみ取得する
|
|
167
|
+
* イベント IDは必ず返ります
|
|
168
|
+
*/
|
|
169
|
+
projectFieldsById<T extends factory.eventType.ScreeningEvent | factory.eventType.Event>(params: {
|
|
163
170
|
id: string;
|
|
164
|
-
}): Promise<IMinimizedIndividualEvent<T>>;
|
|
171
|
+
}, inclusion: IKeyOfProjection4minimizedEvent<T>[]): Promise<IMinimizedIndividualEvent<T>>;
|
|
165
172
|
/**
|
|
166
173
|
* イベントをキャンセルする
|
|
167
174
|
*/
|
package/lib/chevre/repo/event.js
CHANGED
|
@@ -20,37 +20,43 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
20
20
|
return t;
|
|
21
21
|
};
|
|
22
22
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
23
|
-
exports.EventRepo =
|
|
23
|
+
exports.EventRepo = void 0;
|
|
24
24
|
const factory = require("../factory");
|
|
25
25
|
const EventFactory = require("../factory/event");
|
|
26
26
|
const event_1 = require("./mongoose/schemas/event");
|
|
27
27
|
const errorHandler_1 = require("../errorHandler");
|
|
28
28
|
const settings_1 = require("../settings");
|
|
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
|
-
|
|
29
|
+
// export const keyOfMinimizedScreeningEvent: IKeyOfProjection<factory.eventType.ScreeningEvent>[] = [
|
|
30
|
+
// 'project', 'organizer', '_id', 'typeOf',
|
|
31
|
+
// // 'additionalProperty', // discontinue(2024-07-20~)
|
|
32
|
+
// 'name',
|
|
33
|
+
// 'doorTime', 'endDate', 'eventStatus', 'location', 'startDate', 'superEvent', 'offers', 'coaInfo', 'identifier'
|
|
34
|
+
// ];
|
|
35
|
+
// export const keyOfMinimizedEvent: IKeyOfProjection<factory.eventType.Event>[] = [
|
|
36
|
+
// 'project', 'organizer', '_id', 'typeOf',
|
|
37
|
+
// // 'additionalProperty', // discontinue(2024-07-20~)
|
|
38
|
+
// 'name',
|
|
39
|
+
// 'doorTime', 'endDate', 'eventStatus', 'location', 'startDate', 'offers', 'identifier'
|
|
40
|
+
// ];
|
|
41
|
+
// const PROJECTION_MINIMIZED_EVENT: {
|
|
42
|
+
// [key in (IKeyOfProjection<factory.eventType.ScreeningEvent> | IKeyOfProjection<factory.eventType.Event>)]?: 1
|
|
43
|
+
// } = {
|
|
44
|
+
// project: 1,
|
|
45
|
+
// organizer: 1,
|
|
46
|
+
// _id: 1,
|
|
47
|
+
// typeOf: 1,
|
|
48
|
+
// // additionalProperty: 1, // discontinue(2024-07-20~)
|
|
49
|
+
// name: 1,
|
|
50
|
+
// doorTime: 1,
|
|
51
|
+
// endDate: 1,
|
|
52
|
+
// eventStatus: 1,
|
|
53
|
+
// location: 1,
|
|
54
|
+
// startDate: 1,
|
|
55
|
+
// superEvent: 1,
|
|
56
|
+
// offers: 1,
|
|
57
|
+
// coaInfo: 1,
|
|
58
|
+
// identifier: 1
|
|
59
|
+
// };
|
|
54
60
|
/**
|
|
55
61
|
* イベントリポジトリ
|
|
56
62
|
*/
|
|
@@ -859,45 +865,6 @@ class EventRepo {
|
|
|
859
865
|
.then((docs) => docs.map((doc) => doc.toObject()));
|
|
860
866
|
});
|
|
861
867
|
}
|
|
862
|
-
// イベント集計検索廃止(2024-03-28~)
|
|
863
|
-
// public async searchAggregations(
|
|
864
|
-
// params: Pick<
|
|
865
|
-
// ISearchConditions<factory.eventType.ScreeningEvent>,
|
|
866
|
-
// 'page' | 'limit' | 'sort' | 'project' | 'typeOf' | 'id' | 'startFrom' | 'startThrough' | 'organizer'
|
|
867
|
-
// >,
|
|
868
|
-
// inclusion: ('aggregateEntranceGate' | 'aggregateOffer' | 'aggregateReservation')[]
|
|
869
|
-
// ): Promise<Pick<
|
|
870
|
-
// factory.event.IEvent<factory.eventType.ScreeningEvent>,
|
|
871
|
-
// 'aggregateEntranceGate' | 'aggregateOffer' | 'aggregateReservation' | 'id'
|
|
872
|
-
// >[]> {
|
|
873
|
-
// const conditions = MongoRepository.CREATE_MONGO_CONDITIONS<factory.eventType.ScreeningEvent>(params);
|
|
874
|
-
// let projection: IProjection<factory.eventType.ScreeningEvent> = {};
|
|
875
|
-
// if (Array.isArray(inclusion) && inclusion.length > 0) {
|
|
876
|
-
// inclusion.forEach((field) => {
|
|
877
|
-
// projection[field] = 1;
|
|
878
|
-
// });
|
|
879
|
-
// } else {
|
|
880
|
-
// projection = {
|
|
881
|
-
// aggregateEntranceGate: 1,
|
|
882
|
-
// aggregateOffer: 1,
|
|
883
|
-
// aggregateReservation: 1
|
|
884
|
-
// };
|
|
885
|
-
// }
|
|
886
|
-
// const query = this.eventModel.find({ $and: conditions }, projection);
|
|
887
|
-
// if (typeof params.limit === 'number' && params.limit > 0) {
|
|
888
|
-
// const page: number = (typeof params.page === 'number' && params.page > 0) ? params.page : 1;
|
|
889
|
-
// query.limit(params.limit)
|
|
890
|
-
// .skip(params.limit * (page - 1));
|
|
891
|
-
// }
|
|
892
|
-
// // tslint:disable-next-line:no-single-line-block-comment
|
|
893
|
-
// /* istanbul ignore else */
|
|
894
|
-
// if (params.sort?.startDate !== undefined) {
|
|
895
|
-
// query.sort({ startDate: params.sort.startDate });
|
|
896
|
-
// }
|
|
897
|
-
// return query.setOptions({ maxTimeMS: MONGO_MAX_TIME_MS })
|
|
898
|
-
// .exec()
|
|
899
|
-
// .then((docs) => docs.map((doc) => doc.toObject()));
|
|
900
|
-
// }
|
|
901
868
|
searchIds(params) {
|
|
902
869
|
return __awaiter(this, void 0, void 0, function* () {
|
|
903
870
|
const conditions = EventRepo.CREATE_MONGO_CONDITIONS(params);
|
|
@@ -906,14 +873,37 @@ class EventRepo {
|
|
|
906
873
|
.exec();
|
|
907
874
|
});
|
|
908
875
|
}
|
|
909
|
-
|
|
876
|
+
/**
|
|
877
|
+
* 特定イベントから指定フィールドのみ取得する
|
|
878
|
+
* イベント IDは必ず返ります
|
|
879
|
+
*/
|
|
880
|
+
projectFieldsById(params, inclusion // add projection(2024-07-18~)
|
|
881
|
+
) {
|
|
910
882
|
return __awaiter(this, void 0, void 0, function* () {
|
|
911
|
-
const
|
|
883
|
+
const projection = {
|
|
884
|
+
_id: 0,
|
|
885
|
+
id: { $toString: '$_id' }
|
|
886
|
+
};
|
|
887
|
+
if (Array.isArray(inclusion) && inclusion.length > 0) {
|
|
888
|
+
inclusion.forEach((field) => {
|
|
889
|
+
if (field !== '_id' && field !== 'id') {
|
|
890
|
+
projection[field] = 1;
|
|
891
|
+
}
|
|
892
|
+
});
|
|
893
|
+
}
|
|
894
|
+
else {
|
|
895
|
+
// discontinue(2024-07-24~)
|
|
896
|
+
throw new factory.errors.ArgumentNull('inclusion', 'inclusion must be specified');
|
|
897
|
+
// projection = PROJECTION_MINIMIZED_EVENT;
|
|
898
|
+
}
|
|
899
|
+
const doc = yield this.eventModel.findOne({ _id: { $eq: params.id } }, projection)
|
|
900
|
+
.lean() // lean(2024-07-24~)
|
|
912
901
|
.exec();
|
|
913
902
|
if (doc === null) {
|
|
914
903
|
throw new factory.errors.NotFound(this.eventModel.modelName);
|
|
915
904
|
}
|
|
916
|
-
return doc
|
|
905
|
+
return doc;
|
|
906
|
+
// return doc.toObject();
|
|
917
907
|
});
|
|
918
908
|
}
|
|
919
909
|
/**
|
|
@@ -43,6 +43,12 @@ interface IAggregation {
|
|
|
43
43
|
interface IAggregateOrder {
|
|
44
44
|
aggregation: IAggregation;
|
|
45
45
|
}
|
|
46
|
+
/**
|
|
47
|
+
* ステータス変更後注文
|
|
48
|
+
*/
|
|
49
|
+
export type IOrderOnStatusChanged = Pick<IOrderWithoutAcceptedOffers & {
|
|
50
|
+
id: string;
|
|
51
|
+
}, 'id' | 'orderNumber' | 'broker' | 'confirmationNumber' | 'customer' | 'dateReturned' | 'name' | 'orderDate' | 'orderStatus' | 'orderedItem' | 'paymentMethods' | 'previousOrderStatus' | 'price' | 'priceCurrency' | 'project' | 'returner' | 'seller' | 'typeOf'>;
|
|
46
52
|
/**
|
|
47
53
|
* 注文リポジトリ
|
|
48
54
|
*/
|
|
@@ -66,9 +72,7 @@ export declare class OrderRepo {
|
|
|
66
72
|
orderNumber: string;
|
|
67
73
|
orderStatus: factory.orderStatus;
|
|
68
74
|
previousOrderStatus: factory.orderStatus;
|
|
69
|
-
}): Promise<
|
|
70
|
-
id: string;
|
|
71
|
-
}>;
|
|
75
|
+
}): Promise<IOrderOnStatusChanged>;
|
|
72
76
|
/**
|
|
73
77
|
* 注文を返品する
|
|
74
78
|
*/
|
|
@@ -106,7 +110,7 @@ export declare class OrderRepo {
|
|
|
106
110
|
};
|
|
107
111
|
};
|
|
108
112
|
}): Promise<void>;
|
|
109
|
-
|
|
113
|
+
projectFieldsById(params: {
|
|
110
114
|
id: string;
|
|
111
115
|
inclusion: IKeyOfProjection[];
|
|
112
116
|
}): Promise<IOrderWithoutAcceptedOffers & {
|
|
@@ -115,7 +119,7 @@ export declare class OrderRepo {
|
|
|
115
119
|
/**
|
|
116
120
|
* 注文番号から注文を取得する
|
|
117
121
|
*/
|
|
118
|
-
|
|
122
|
+
projectFieldsByOrderNumber(params: {
|
|
119
123
|
orderNumber: string;
|
|
120
124
|
project: {
|
|
121
125
|
id: string;
|
|
@@ -147,8 +151,13 @@ export declare class OrderRepo {
|
|
|
147
151
|
/**
|
|
148
152
|
* 注文を検索する
|
|
149
153
|
*/
|
|
150
|
-
search(params: factory.order.ISearchConditions,
|
|
151
|
-
|
|
154
|
+
search(params: factory.order.ISearchConditions, options: {
|
|
155
|
+
inclusion: {
|
|
156
|
+
[key in IKeyOfProjection]?: 1;
|
|
157
|
+
};
|
|
158
|
+
exclusion: {
|
|
159
|
+
[key in IKeyOfProjection]?: 0;
|
|
160
|
+
};
|
|
152
161
|
}): Promise<(IOrderWithoutAcceptedOffers & {
|
|
153
162
|
id: string;
|
|
154
163
|
})[]>;
|