@chevre/domain 28.0.0-alpha.9 → 28.1.0-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/chevre/emailMessageBuilder.d.ts +9 -5
- package/lib/chevre/emailMessageBuilder.js +12 -11
- package/lib/chevre/factory/event.d.ts +1 -1
- package/lib/chevre/factory/event.js +1 -5
- package/lib/chevre/repo/acceptedOffer.d.ts +6 -5
- package/lib/chevre/repo/acceptedOffer.js +14 -9
- package/lib/chevre/repo/acceptedOfferInReserve.d.ts +6 -8
- package/lib/chevre/repo/acceptedOfferInReserve.js +13 -7
- package/lib/chevre/repo/action/unknown2actionError.d.ts +1 -0
- package/lib/chevre/repo/action/unknown2actionError.js +29 -1
- package/lib/chevre/repo/adminAcceptedOffer.d.ts +36 -12
- package/lib/chevre/repo/adminAcceptedOffer.js +40 -10
- package/lib/chevre/repo/adminAccountTitle.d.ts +49 -0
- package/lib/chevre/repo/adminAccountTitle.js +212 -0
- package/lib/chevre/repo/adminAccountTitleCategory.d.ts +37 -0
- package/lib/chevre/repo/adminAccountTitleCategory.js +127 -0
- package/lib/chevre/repo/adminAccountTitleSet.d.ts +42 -0
- package/lib/chevre/repo/adminAccountTitleSet.js +149 -0
- package/lib/chevre/repo/adminEvent.d.ts +1 -1
- package/lib/chevre/repo/adminEventSeries.d.ts +0 -22
- package/lib/chevre/repo/adminEventSeries.js +35 -31
- package/lib/chevre/repo/{paymentServiceChannel.d.ts → adminPaymentServiceChannel.d.ts} +13 -11
- package/lib/chevre/repo/{paymentServiceChannel.js → adminPaymentServiceChannel.js} +20 -19
- package/lib/chevre/repo/adminTask.d.ts +2 -2
- package/lib/chevre/repo/adminTransaction.d.ts +15 -15
- package/lib/chevre/repo/categoryCode.js +0 -21
- package/lib/chevre/repo/emailMessage.d.ts +3 -1
- package/lib/chevre/repo/emailMessage.js +20 -13
- package/lib/chevre/repo/eventSeries.d.ts +2 -2
- package/lib/chevre/repo/eventSeries.js +19 -12
- package/lib/chevre/repo/factory/acceptedOffer/reserveTransaction2itemOffered.d.ts +1 -1
- package/lib/chevre/repo/issuer.d.ts +2 -6
- package/lib/chevre/repo/memberProgram.d.ts +1 -38
- package/lib/chevre/repo/memberProgram.js +1 -62
- package/lib/chevre/repo/mongoose/schemas/accountTitle.d.ts +1 -1
- package/lib/chevre/repo/mongoose/schemas/accountTitle.js +22 -26
- package/lib/chevre/repo/mongoose/schemas/civicStructure.d.ts +1 -0
- package/lib/chevre/repo/mongoose/schemas/event.js +0 -13
- package/lib/chevre/repo/mongoose/schemas/eventSeries.js +1 -18
- package/lib/chevre/repo/mongoose/schemas/issuer.d.ts +1 -3
- package/lib/chevre/repo/mongoose/schemas/issuer.js +0 -10
- package/lib/chevre/repo/mongoose/schemas/message.d.ts +5 -1
- package/lib/chevre/repo/mongoose/schemas/offerCatalog.d.ts +0 -1
- package/lib/chevre/repo/mongoose/schemas/offerCatalog.js +3 -12
- package/lib/chevre/repo/mongoose/schemas/offerCatalogItem.d.ts +1 -2
- package/lib/chevre/repo/mongoose/schemas/offerCatalogItem.js +6 -15
- package/lib/chevre/repo/mongoose/schemas/order.d.ts +22 -1
- package/lib/chevre/repo/mongoose/schemas/paymentServiceChannel.d.ts +1 -1
- package/lib/chevre/repo/mongoose/schemas/place.js +0 -9
- package/lib/chevre/repo/mongoose/schemas/project.d.ts +1 -2
- package/lib/chevre/repo/mongoose/schemas/project.js +1 -1
- package/lib/chevre/repo/mongoose/schemas/seller.d.ts +3 -1
- package/lib/chevre/repo/mongoose/schemas/seller.js +0 -2
- package/lib/chevre/repo/offerCatalog.d.ts +0 -2
- package/lib/chevre/repo/offerCatalogItem.d.ts +13 -20
- package/lib/chevre/repo/offerCatalogItem.js +8 -86
- package/lib/chevre/repo/order.d.ts +2 -2
- package/lib/chevre/repo/order.js +0 -31
- package/lib/chevre/repo/orderInTransaction.d.ts +5 -25
- package/lib/chevre/repo/place/movieTheater.d.ts +3 -1
- package/lib/chevre/repo/place/movieTheater.js +3 -1
- package/lib/chevre/repo/place/{hasPOS.d.ts → pos.d.ts} +13 -20
- package/lib/chevre/repo/place/{hasPOS.js → pos.js} +66 -29
- package/lib/chevre/repo/place/screeningRoom.d.ts +2 -2
- package/lib/chevre/repo/priceSpecification.d.ts +8 -8
- package/lib/chevre/repo/project.d.ts +14 -20
- package/lib/chevre/repo/project.js +28 -44
- package/lib/chevre/repo/projectMakesOffer.js +2 -2
- package/lib/chevre/repo/role.d.ts +1 -1
- package/lib/chevre/repo/role.js +1 -30
- package/lib/chevre/repo/seller.d.ts +11 -4
- package/lib/chevre/repo/seller.js +31 -58
- package/lib/chevre/repo/sellerPaymentAccepted.d.ts +14 -21
- package/lib/chevre/repo/sellerPaymentAccepted.js +65 -38
- package/lib/chevre/repo/task.d.ts +3 -3
- package/lib/chevre/repository.d.ts +25 -15
- package/lib/chevre/repository.js +52 -30
- package/lib/chevre/service/aggregation/event/aggregateScreeningEvent.js +2 -1
- package/lib/chevre/service/aggregation.d.ts +0 -2
- package/lib/chevre/service/aggregation.js +1 -3
- package/lib/chevre/service/assetTransaction/pay/start/preStart/fixPaymentService.d.ts +1 -1
- package/lib/chevre/service/assetTransaction/pay/start/preStart/fixPaymentService.js +1 -15
- package/lib/chevre/service/assetTransaction/pay/start/preStart/validateSeller.d.ts +1 -1
- package/lib/chevre/service/assetTransaction/pay/start/preStart/validateSeller.js +9 -3
- package/lib/chevre/service/assetTransaction/pay/start.js +3 -3
- package/lib/chevre/service/assetTransaction/reserve/start.js +2 -1
- package/lib/chevre/service/delivery/reservation/factory.d.ts +1 -1
- package/lib/chevre/service/event/saveScreeningEventSeries.js +1 -2
- package/lib/chevre/service/event/saveScreeningEvents.js +4 -4
- package/lib/chevre/service/notification/sendEmailMessage.d.ts +2 -0
- package/lib/chevre/service/notification/sendEmailMessage.js +23 -6
- package/lib/chevre/service/offer/any.d.ts +1 -1
- package/lib/chevre/service/offer/event/authorize/factory.d.ts +3 -3
- package/lib/chevre/service/offer/event/authorize/factory.js +1 -8
- package/lib/chevre/service/offer/event/authorize/processStartReserve4chevre.d.ts +1 -1
- package/lib/chevre/service/offer/event/issueEventOfferTicket.js +0 -11
- package/lib/chevre/service/offer/event/searchEventTicketOffers.d.ts +1 -4
- package/lib/chevre/service/offer/event/searchEventTicketOffers.js +9 -13
- package/lib/chevre/service/offer/event/searchOfferAppliesToMovieTicket.js +2 -8
- package/lib/chevre/service/offer/event/searchOfferCatalogItems.js +2 -2
- package/lib/chevre/service/offer/event/searchOffersByIds.js +3 -9
- package/lib/chevre/service/offer/eventServiceByCOA/authorize/factory.d.ts +1 -1
- package/lib/chevre/service/offer/eventServiceByCOA/authorize/factory.js +0 -7
- package/lib/chevre/service/offer/onEventChanged.js +9 -18
- package/lib/chevre/service/order/onOrderStatusChanged/onOrderDeliveredPartially/factory.d.ts +4 -6
- package/lib/chevre/service/order/onOrderStatusChanged/onOrderDeliveredPartially/factory.js +23 -4
- package/lib/chevre/service/order/onOrderStatusChanged/onOrderProcessing/createSendEmailMessageTaskIfNotExist.d.ts +1 -1
- package/lib/chevre/service/order/onOrderStatusChanged/onOrderProcessing/processOrder.d.ts +1 -1
- package/lib/chevre/service/order/onOrderStatusChanged/onOrderProcessing.d.ts +1 -1
- package/lib/chevre/service/order/placeOrder/factory/orderedItem.d.ts +1 -1
- package/lib/chevre/service/order/placeOrder/factory.d.ts +1 -1
- package/lib/chevre/service/order/sendOrder.js +2 -14
- package/lib/chevre/service/payment/creditCard/getGMOInfoFromSeller.js +1 -1
- package/lib/chevre/service/payment/factory/createPayObjectServiceOutput.d.ts +3 -3
- package/lib/chevre/service/payment/movieTicket/checkMovieTicket.js +1 -1
- package/lib/chevre/service/payment/movieTicket/payMovieTicket/payActionParams2seatInfoSyncIn.js +1 -1
- package/lib/chevre/service/payment/movieTicket/validation.js +1 -1
- package/lib/chevre/service/project.d.ts +3 -3
- package/lib/chevre/service/project.js +1 -1
- package/lib/chevre/service/task/onResourceDeleted.js +8 -8
- package/lib/chevre/service/task/onResourceUpdated/onAggregateOfferUpdated.js +8 -8
- package/lib/chevre/service/task/onResourceUpdated/onHasPOSUpdated.d.ts +7 -3
- package/lib/chevre/service/task/onResourceUpdated/onHasPOSUpdated.js +51 -50
- package/lib/chevre/service/task/onResourceUpdated/onOfferCatalogUpdated.js +1 -1
- package/lib/chevre/service/task/onResourceUpdated/syncOfferCatalog.js +1 -1
- package/lib/chevre/service/task/onResourceUpdated.js +10 -47
- package/lib/chevre/service/task/sendEmailMessage.js +3 -1
- package/lib/chevre/service/task/syncResourcesFromCOA.js +2 -2
- package/lib/chevre/service/transaction/placeOrder/confirm/potentialActions/sendEmailMessage.d.ts +6 -3
- package/lib/chevre/service/transaction/placeOrder/confirm/potentialActions/sendEmailMessage.js +2 -15
- package/lib/chevre/service/transaction/placeOrder/confirm/potentialActions.d.ts +6 -4
- package/lib/chevre/service/transaction/placeOrder/confirm/potentialActions.js +3 -7
- package/lib/chevre/service/transaction/placeOrder/confirm/prepareUnitPriceOfferConditions.d.ts +1 -1
- package/lib/chevre/service/transaction/placeOrder/confirm/validation/validateInvoiceReferencesOrder.d.ts +1 -1
- package/lib/chevre/service/transaction/placeOrder/confirm/validation/validateMovieTicket.d.ts +1 -1
- package/lib/chevre/service/transaction/placeOrder/confirm/validation.d.ts +4 -2
- package/lib/chevre/service/transaction/placeOrder/confirm/validation.js +7 -1
- package/lib/chevre/service/transaction/placeOrder/confirm.d.ts +5 -2
- package/lib/chevre/service/transaction/placeOrder/confirm.js +7 -12
- package/lib/chevre/service/transaction/returnOrder/potentialActions/returnPaymentMethod.d.ts +6 -3
- package/lib/chevre/service/transaction/returnOrder/potentialActions/returnPaymentMethod.js +8 -9
- package/lib/chevre/service/transaction/returnOrder/potentialActions/sendEmailMessage.d.ts +6 -3
- package/lib/chevre/service/transaction/returnOrder/potentialActions/sendEmailMessage.js +2 -7
- package/lib/chevre/service/transaction/returnOrder/potentialActions.d.ts +6 -3
- package/lib/chevre/service/transaction/returnOrder/potentialActions.js +4 -3
- package/lib/chevre/service/transaction/returnOrder/preStart/factory.d.ts +1 -1
- package/lib/chevre/service/transaction/returnOrder.d.ts +0 -2
- package/lib/chevre/service/transaction/returnOrder.js +6 -6
- package/package.json +2 -2
- package/lib/chevre/repo/accountTitle.d.ts +0 -28
- package/lib/chevre/repo/accountTitle.js +0 -30
- package/lib/chevre/service/aggregation/project.d.ts +0 -17
- package/lib/chevre/service/aggregation/project.js +0 -98
- package/lib/chevre/service/delivery/factory.d.ts +0 -16
- package/lib/chevre/service/delivery/factory.js +0 -124
|
@@ -1,12 +1,15 @@
|
|
|
1
1
|
import { IOrderAsCreateEmailParams } from '../../../../emailMessageBuilder';
|
|
2
2
|
import { factory } from '../../../../factory';
|
|
3
|
-
import type { ISetting } from '../../../../repo/setting';
|
|
4
3
|
type IPotentialSendEmailMessageAction = factory.action.transfer.returnAction.order.IPotentialSendEmailMessageAction;
|
|
5
4
|
export declare function createSendEmailMessaegActionsOnReturn(params: {
|
|
6
5
|
order: IOrderAsCreateEmailParams;
|
|
7
6
|
returnOrderActionParams?: factory.transaction.returnOrder.IReturnOrderActionParams;
|
|
8
|
-
}
|
|
9
|
-
emailMessagesOnReturn: factory.action.transfer.send.message.email.IObjectAsEmailMessage
|
|
7
|
+
}): Promise<{
|
|
8
|
+
emailMessagesOnReturn: (Pick<factory.action.transfer.send.message.email.IObjectAsEmailMessage, 'about' | 'identifier' | 'name' | 'text' | 'toRecipient' | 'typeOf'> & {
|
|
9
|
+
sender: Pick<factory.action.transfer.send.message.email.IObjectAsEmailMessage['sender'], 'name' | 'typeOf'> & {
|
|
10
|
+
email?: never;
|
|
11
|
+
};
|
|
12
|
+
})[];
|
|
10
13
|
sendEmailMessaegActionsOnReturn: IPotentialSendEmailMessageAction[];
|
|
11
14
|
}>;
|
|
12
15
|
export {};
|
|
@@ -3,9 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.createSendEmailMessaegActionsOnReturn = createSendEmailMessaegActionsOnReturn;
|
|
4
4
|
const emailMessageBuilder_1 = require("../../../../emailMessageBuilder");
|
|
5
5
|
const factory_1 = require("../../../../factory");
|
|
6
|
-
async function createSendEmailMessaegActionsOnReturn(params
|
|
7
|
-
// settings: Settings
|
|
8
|
-
setting) {
|
|
6
|
+
async function createSendEmailMessaegActionsOnReturn(params) {
|
|
9
7
|
const order = params.order;
|
|
10
8
|
// 返品後のEメール送信アクション
|
|
11
9
|
const emailMessagesOnReturn = [];
|
|
@@ -17,10 +15,7 @@ setting) {
|
|
|
17
15
|
order,
|
|
18
16
|
index,
|
|
19
17
|
...(sendEmailMessageParams.object !== undefined) ? { email: sendEmailMessageParams.object } : undefined,
|
|
20
|
-
|
|
21
|
-
// ? { emailMessage: params.emailMessageOnOrderReturned }
|
|
22
|
-
// : undefined
|
|
23
|
-
}, setting);
|
|
18
|
+
});
|
|
24
19
|
emailMessagesOnReturn.push(emailMessage);
|
|
25
20
|
return {
|
|
26
21
|
object: {
|
|
@@ -1,13 +1,16 @@
|
|
|
1
1
|
import { factory } from '../../../factory';
|
|
2
|
-
import type { ISetting } from '../../../repo/setting';
|
|
3
2
|
type IReturningOrder4potentialActions = Pick<factory.order.IOrder, 'confirmationNumber' | 'customer' | 'orderDate' | 'orderNumber' | 'orderStatus' | 'orderedItem' | 'paymentMethods' | 'price' | 'priceCurrency' | 'project' | 'seller' | 'typeOf'>;
|
|
4
3
|
declare function createPotentialActions(params: {
|
|
5
4
|
dateReturned: Date;
|
|
6
5
|
orders: IReturningOrder4potentialActions[];
|
|
7
6
|
potentialActions?: factory.transaction.returnOrder.IPotentialActionsParams;
|
|
8
7
|
transaction: Pick<factory.transaction.returnOrder.ITransaction, 'agent' | 'object'>;
|
|
9
|
-
}
|
|
10
|
-
emailMessages: factory.action.transfer.send.message.email.IObjectAsEmailMessage
|
|
8
|
+
}): Promise<{
|
|
9
|
+
emailMessages: (Pick<factory.action.transfer.send.message.email.IObjectAsEmailMessage, 'about' | 'identifier' | 'name' | 'text' | 'toRecipient' | 'typeOf'> & {
|
|
10
|
+
sender: Pick<factory.action.transfer.send.message.email.IObjectAsEmailMessage['sender'], 'name' | 'typeOf'> & {
|
|
11
|
+
email?: never;
|
|
12
|
+
};
|
|
13
|
+
})[];
|
|
11
14
|
potentialActions: factory.transaction.returnOrder.IPotentialActions;
|
|
12
15
|
}>;
|
|
13
16
|
export { createPotentialActions, IReturningOrder4potentialActions };
|
|
@@ -2,9 +2,10 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.createPotentialActions = createPotentialActions;
|
|
4
4
|
const factory_1 = require("../../../factory");
|
|
5
|
+
// import type { ISetting } from '../../../repo/setting';
|
|
5
6
|
const returnPaymentMethod_1 = require("./potentialActions/returnPaymentMethod");
|
|
6
7
|
const sendEmailMessage_1 = require("./potentialActions/sendEmailMessage");
|
|
7
|
-
async function createPotentialActions(params
|
|
8
|
+
async function createPotentialActions(params) {
|
|
8
9
|
const emailMessages = [];
|
|
9
10
|
const returnOrderActions = await Promise.all(params.orders.map(async (order) => {
|
|
10
11
|
let returnOrderParams = params.potentialActions?.returnOrder;
|
|
@@ -18,14 +19,14 @@ async function createPotentialActions(params, setting) {
|
|
|
18
19
|
...params,
|
|
19
20
|
order,
|
|
20
21
|
...(returnOrderActionParams !== undefined) ? { returnOrderActionParams } : undefined
|
|
21
|
-
}
|
|
22
|
+
});
|
|
22
23
|
emailMessages.push(...emailMessagesOnReturnInvoice);
|
|
23
24
|
// 返品後のEメール送信アクション
|
|
24
25
|
const { emailMessagesOnReturn, sendEmailMessaegActionsOnReturn } = await (0, sendEmailMessage_1.createSendEmailMessaegActionsOnReturn)({
|
|
25
26
|
...params,
|
|
26
27
|
order,
|
|
27
28
|
...(returnOrderActionParams !== undefined) ? { returnOrderActionParams } : undefined
|
|
28
|
-
}
|
|
29
|
+
});
|
|
29
30
|
emailMessages.push(...emailMessagesOnReturn);
|
|
30
31
|
const potentialActionsOnReturnOrder = {
|
|
31
32
|
returnPaymentMethod: returnPaymentMethodActions,
|
|
@@ -15,6 +15,6 @@ type ICustomSellerReturnPolicy = Pick<factory.sellerReturnPolicy.ISellerReturnPo
|
|
|
15
15
|
applicablePaymentMethod?: never;
|
|
16
16
|
merchantReturnDays?: never;
|
|
17
17
|
};
|
|
18
|
-
type IFixedAcceptedOffer = Pick<factory.
|
|
18
|
+
type IFixedAcceptedOffer = Pick<factory.acceptedOffer.IAcceptedOffer, 'id' | 'priceSpecification' | 'itemOffered'>;
|
|
19
19
|
type IFixedOrder = Pick<factory.order.IOrder, 'confirmationNumber' | 'dateReturned' | 'orderDate' | 'orderNumber' | 'orderStatus' | 'paymentMethods' | 'price' | 'project' | 'seller' | 'typeOf'>;
|
|
20
20
|
export { IAvailableSellerReturnPolicy, ICustomSellerReturnPolicy, IFixedAcceptedOffer, IFixedOrder };
|
|
@@ -10,7 +10,6 @@ import type { ProjectRepo } from '../../repo/project';
|
|
|
10
10
|
import type { ReservationRepo } from '../../repo/reservation';
|
|
11
11
|
import type { SellerRepo } from '../../repo/seller';
|
|
12
12
|
import type { SellerReturnPolicyRepo } from '../../repo/sellerReturnPolicy';
|
|
13
|
-
import type { SettingRepo } from '../../repo/setting';
|
|
14
13
|
import type { TaskRepo } from '../../repo/task';
|
|
15
14
|
import type { IStartedTransaction, ReturnOrderInProgressRepo } from '../../repo/transaction/returnOrderInProgress';
|
|
16
15
|
import { preStart, IStartParamsWithoutDetail } from './returnOrder/preStart';
|
|
@@ -36,7 +35,6 @@ interface IConfirmRepos {
|
|
|
36
35
|
acceptedOffer: AcceptedOfferRepo;
|
|
37
36
|
message: MessageRepo;
|
|
38
37
|
order: OrderRepo;
|
|
39
|
-
setting: SettingRepo;
|
|
40
38
|
returnOrderInProgress: ReturnOrderInProgressRepo;
|
|
41
39
|
task: TaskRepo;
|
|
42
40
|
}
|
|
@@ -86,17 +86,17 @@ function confirm(params) {
|
|
|
86
86
|
if (orderStatus === factory_1.factory.orderStatus.OrderReturned) {
|
|
87
87
|
throw new factory_1.factory.errors.Argument('orderNumber', `invalid orderStatus: ${orderStatus}`);
|
|
88
88
|
}
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
89
|
+
// defaultSenderEmail参照不要(2026-10-20~)
|
|
90
|
+
// const setting = await repos.setting.findOne({ project: { id: { $eq: '*' } } }, ['defaultSenderEmail']) as Pick<ISetting, 'defaultSenderEmail'> | null;
|
|
91
|
+
// if (typeof setting?.defaultSenderEmail !== 'string') {
|
|
92
|
+
// throw new factory.errors.NotFound('setting.defaultSenderEmail');
|
|
93
|
+
// }
|
|
93
94
|
const { emailMessages, potentialActions } = await (0, potentialActions_1.createPotentialActions)({
|
|
94
95
|
dateReturned: params.object.order.dateReturned,
|
|
95
96
|
orders: returningOrders,
|
|
96
97
|
transaction: transaction,
|
|
97
98
|
...(params.potentialActions !== undefined) ? { potentialActions: params.potentialActions } : undefined,
|
|
98
|
-
|
|
99
|
-
}, setting);
|
|
99
|
+
});
|
|
100
100
|
// save messages(2024-06-27~)
|
|
101
101
|
await saveMessagesIfNeeded({
|
|
102
102
|
project: { id: transaction.project.id },
|
package/package.json
CHANGED
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"@aws-sdk/client-cognito-identity-provider": "3.1090.0",
|
|
13
13
|
"@aws-sdk/credential-providers": "3.1090.0",
|
|
14
|
-
"@chevre/factory": "11.
|
|
14
|
+
"@chevre/factory": "11.1.0",
|
|
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",
|
|
@@ -88,5 +88,5 @@
|
|
|
88
88
|
"postversion": "git push origin --tags",
|
|
89
89
|
"prepublishOnly": "npm run clean && npm run build"
|
|
90
90
|
},
|
|
91
|
-
"version": "28.
|
|
91
|
+
"version": "28.1.0-alpha.0"
|
|
92
92
|
}
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import type { Connection } from 'mongoose';
|
|
2
|
-
import { factory } from '../factory';
|
|
3
|
-
import { IModel } from './mongoose/schemas/accountTitle';
|
|
4
|
-
/**
|
|
5
|
-
* 科目リポジトリ
|
|
6
|
-
*/
|
|
7
|
-
export declare class AccountTitleRepo {
|
|
8
|
-
readonly accountTitleModel: IModel;
|
|
9
|
-
constructor(connection: Connection);
|
|
10
|
-
deleteByProject(params: {
|
|
11
|
-
project: {
|
|
12
|
-
id: string;
|
|
13
|
-
};
|
|
14
|
-
}): Promise<void>;
|
|
15
|
-
getCursor(conditions: any, projection: any): import("mongoose").Cursor<import("mongoose").Document<unknown, Record<string, never>, factory.accountTitle.IAccountTitle, import("./mongoose/virtuals").IVirtuals, {}> & factory.accountTitle.IAccountTitle & {
|
|
16
|
-
_id: import("mongoose").Types.ObjectId;
|
|
17
|
-
} & {
|
|
18
|
-
__v: number;
|
|
19
|
-
}, import("mongoose").QueryOptions<factory.accountTitle.IAccountTitle>, (import("mongoose").Document<unknown, Record<string, never>, factory.accountTitle.IAccountTitle, import("./mongoose/virtuals").IVirtuals, {}> & factory.accountTitle.IAccountTitle & {
|
|
20
|
-
_id: import("mongoose").Types.ObjectId;
|
|
21
|
-
} & {
|
|
22
|
-
__v: number;
|
|
23
|
-
}) | null>;
|
|
24
|
-
unsetUnnecessaryFields(params: {
|
|
25
|
-
filter: any;
|
|
26
|
-
$unset: any;
|
|
27
|
-
}): Promise<import("mongoose").UpdateWriteOpResult>;
|
|
28
|
-
}
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.AccountTitleRepo = void 0;
|
|
4
|
-
const factory_1 = require("../factory");
|
|
5
|
-
const accountTitle_1 = require("./mongoose/schemas/accountTitle");
|
|
6
|
-
/**
|
|
7
|
-
* 科目リポジトリ
|
|
8
|
-
*/
|
|
9
|
-
class AccountTitleRepo {
|
|
10
|
-
accountTitleModel;
|
|
11
|
-
constructor(connection) {
|
|
12
|
-
this.accountTitleModel = connection.model(accountTitle_1.modelName, (0, accountTitle_1.createSchema)());
|
|
13
|
-
}
|
|
14
|
-
async deleteByProject(params) {
|
|
15
|
-
await this.accountTitleModel.deleteMany({
|
|
16
|
-
'project.id': { $exists: true, $eq: params.project.id }
|
|
17
|
-
})
|
|
18
|
-
.exec();
|
|
19
|
-
}
|
|
20
|
-
getCursor(conditions, projection) {
|
|
21
|
-
return this.accountTitleModel.find(conditions, projection)
|
|
22
|
-
.sort({ codeValue: factory_1.factory.sortType.Descending })
|
|
23
|
-
.cursor();
|
|
24
|
-
}
|
|
25
|
-
async unsetUnnecessaryFields(params) {
|
|
26
|
-
return this.accountTitleModel.updateMany(params.filter, { $unset: params.$unset }, { timestamps: false })
|
|
27
|
-
.exec();
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
exports.AccountTitleRepo = AccountTitleRepo;
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import type { ProjectRepo } from '../../repo/project';
|
|
2
|
-
import type { ReservationRepo } from '../../repo/reservation';
|
|
3
|
-
import type { TaskRepo } from '../../repo/task';
|
|
4
|
-
export type IAggregateOperation<T> = (repos: {
|
|
5
|
-
project: ProjectRepo;
|
|
6
|
-
reservation: ReservationRepo;
|
|
7
|
-
task: TaskRepo;
|
|
8
|
-
}) => Promise<T>;
|
|
9
|
-
export declare function aggregate(params: {
|
|
10
|
-
project: {
|
|
11
|
-
id: string;
|
|
12
|
-
};
|
|
13
|
-
reservationFor: {
|
|
14
|
-
startFrom: Date;
|
|
15
|
-
startThrough: Date;
|
|
16
|
-
};
|
|
17
|
-
}): IAggregateOperation<void>;
|
|
@@ -1,98 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.aggregate = aggregate;
|
|
7
|
-
/**
|
|
8
|
-
* プロジェクト集計サービス
|
|
9
|
-
*/
|
|
10
|
-
const debug_1 = __importDefault(require("debug"));
|
|
11
|
-
const moment_1 = __importDefault(require("moment"));
|
|
12
|
-
const factory_1 = require("../../factory");
|
|
13
|
-
const debug = (0, debug_1.default)('chevre-domain:service');
|
|
14
|
-
function aggregate(params) {
|
|
15
|
-
return async (repos) => {
|
|
16
|
-
const now = new Date();
|
|
17
|
-
// 集計対象プロジェクト検索
|
|
18
|
-
const project = await repos.project.findById({
|
|
19
|
-
id: params.project.id,
|
|
20
|
-
inclusion: ['typeOf']
|
|
21
|
-
});
|
|
22
|
-
// 予約集計
|
|
23
|
-
const { aggregateReservation } = await aggregateReservationOnProject({
|
|
24
|
-
aggregateDate: now,
|
|
25
|
-
project: { id: project.id, typeOf: project.typeOf },
|
|
26
|
-
reservationFor: {
|
|
27
|
-
startFrom: (0, moment_1.default)(params.reservationFor.startFrom)
|
|
28
|
-
.toDate(),
|
|
29
|
-
startThrough: (0, moment_1.default)(params.reservationFor.startThrough)
|
|
30
|
-
.toDate()
|
|
31
|
-
}
|
|
32
|
-
})(repos);
|
|
33
|
-
debug('aggregated. aggregateReservation:', aggregateReservation);
|
|
34
|
-
// 保管
|
|
35
|
-
await repos.project.updateAggregateReservation({
|
|
36
|
-
id: project.id,
|
|
37
|
-
aggregateReservation
|
|
38
|
-
});
|
|
39
|
-
};
|
|
40
|
-
}
|
|
41
|
-
function aggregateReservationOnProject(params) {
|
|
42
|
-
return async (repos) => {
|
|
43
|
-
let attendeeCount = 0;
|
|
44
|
-
let checkInCount = 0;
|
|
45
|
-
let reservationCount = 0;
|
|
46
|
-
const reservationForConditions = {
|
|
47
|
-
startFrom: (0, moment_1.default)(params.reservationFor.startFrom)
|
|
48
|
-
.add(-1, 'day')
|
|
49
|
-
.toDate()
|
|
50
|
-
};
|
|
51
|
-
while (reservationForConditions.startThrough === undefined
|
|
52
|
-
|| (0, moment_1.default)(params.reservationFor.startThrough)
|
|
53
|
-
.isAfter((0, moment_1.default)(reservationForConditions.startThrough))) {
|
|
54
|
-
reservationForConditions.startFrom = (0, moment_1.default)(reservationForConditions.startFrom)
|
|
55
|
-
.add(1, 'day')
|
|
56
|
-
.toDate();
|
|
57
|
-
reservationForConditions.startThrough = (0, moment_1.default)(reservationForConditions.startFrom)
|
|
58
|
-
.add(1, 'day')
|
|
59
|
-
.add(-1, 'millisecond')
|
|
60
|
-
.toDate();
|
|
61
|
-
debug('counting...', reservationForConditions);
|
|
62
|
-
reservationCount += await repos.reservation.count({
|
|
63
|
-
project: { id: { $eq: params.project.id } },
|
|
64
|
-
typeOf: factory_1.factory.reservationType.EventReservation,
|
|
65
|
-
reservationFor: reservationForConditions,
|
|
66
|
-
reservationStatuses: [factory_1.factory.reservationStatusType.ReservationConfirmed]
|
|
67
|
-
});
|
|
68
|
-
attendeeCount += await repos.reservation.count({
|
|
69
|
-
project: { id: { $eq: params.project.id } },
|
|
70
|
-
typeOf: factory_1.factory.reservationType.EventReservation,
|
|
71
|
-
reservationFor: reservationForConditions,
|
|
72
|
-
// reservationStatuses: [factory.reservationStatusType.ReservationConfirmed],
|
|
73
|
-
attended: true
|
|
74
|
-
});
|
|
75
|
-
checkInCount += await repos.reservation.count({
|
|
76
|
-
project: { id: { $eq: params.project.id } },
|
|
77
|
-
typeOf: factory_1.factory.reservationType.EventReservation,
|
|
78
|
-
reservationFor: reservationForConditions,
|
|
79
|
-
// reservationStatuses: [factory.reservationStatusType.ReservationConfirmed],
|
|
80
|
-
checkedIn: true
|
|
81
|
-
});
|
|
82
|
-
}
|
|
83
|
-
return {
|
|
84
|
-
aggregateReservation: {
|
|
85
|
-
typeOf: 'AggregateReservation',
|
|
86
|
-
aggregateDate: params.aggregateDate,
|
|
87
|
-
reservationFor: {
|
|
88
|
-
startDate: `${(0, moment_1.default)(params.reservationFor.startFrom)
|
|
89
|
-
.toISOString()}/${(0, moment_1.default)(params.reservationFor.startThrough)
|
|
90
|
-
.toISOString()}`
|
|
91
|
-
},
|
|
92
|
-
attendeeCount,
|
|
93
|
-
checkInCount,
|
|
94
|
-
reservationCount
|
|
95
|
-
}
|
|
96
|
-
};
|
|
97
|
-
};
|
|
98
|
-
}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { factory } from '../../factory';
|
|
2
|
-
export type IOwnershipInfo = factory.ownershipInfo.IOwnershipInfo<factory.ownershipInfo.IGood>;
|
|
3
|
-
/**
|
|
4
|
-
* 注文から所有権を作成する
|
|
5
|
-
*/
|
|
6
|
-
export declare function createOwnershipInfosFromOrder(params: {
|
|
7
|
-
order: Pick<factory.order.IOrder, 'orderDate' | 'project' | 'customer' | 'orderNumber' | 'seller'> & {
|
|
8
|
-
acceptedOffers: (Omit<factory.order.IAcceptedOffer, 'priceSpecification' | 'name'> & {
|
|
9
|
-
/**
|
|
10
|
-
* COA以外では注文ドキュメントにpriceSpecificationが存在しないのでIFを補完
|
|
11
|
-
*/
|
|
12
|
-
priceSpecification?: factory.order.ITicketPriceSpecification;
|
|
13
|
-
})[];
|
|
14
|
-
};
|
|
15
|
-
offerIndexBase: number;
|
|
16
|
-
}): IOwnershipInfo[];
|
|
@@ -1,124 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.createOwnershipInfosFromOrder = createOwnershipInfosFromOrder;
|
|
7
|
-
const moment_timezone_1 = __importDefault(require("moment-timezone"));
|
|
8
|
-
const util_1 = require("util");
|
|
9
|
-
const factory_1 = require("../../factory");
|
|
10
|
-
// import { createProductOwnershipInfo } from './product/factory';
|
|
11
|
-
const factory_2 = require("./reservation/factory");
|
|
12
|
-
/**
|
|
13
|
-
* 注文から所有権を作成する
|
|
14
|
-
*/
|
|
15
|
-
function createOwnershipInfosFromOrder(params) {
|
|
16
|
-
const ownershipInfos = [];
|
|
17
|
-
if (!Array.isArray(params.order.acceptedOffers)) {
|
|
18
|
-
throw new factory_1.factory.errors.ArgumentNull('order.acceptedOffers');
|
|
19
|
-
}
|
|
20
|
-
params.order.acceptedOffers.forEach((acceptedOffer, offerIndex) => {
|
|
21
|
-
const itemOffered = acceptedOffer.itemOffered;
|
|
22
|
-
let ownershipInfo;
|
|
23
|
-
const ownedFrom = (0, moment_timezone_1.default)(params.order.orderDate)
|
|
24
|
-
.toDate();
|
|
25
|
-
const identifier = createOwnershipInfoIdentifier({
|
|
26
|
-
order: params.order,
|
|
27
|
-
itemOffered,
|
|
28
|
-
offerIndex,
|
|
29
|
-
offerIndexBase: params.offerIndexBase
|
|
30
|
-
});
|
|
31
|
-
const acquiredFrom = createAcquiredFrom(params);
|
|
32
|
-
const ownedBy = createOwnedby(params);
|
|
33
|
-
// 所有者があれば所有権を作成する
|
|
34
|
-
if (ownedBy.length > 0) {
|
|
35
|
-
const itemOfferedType = itemOffered.typeOf;
|
|
36
|
-
switch (itemOfferedType) {
|
|
37
|
-
case factory_1.factory.reservationType.EventReservation: {
|
|
38
|
-
const excludeCOAReservation = acceptedOffer.offeredThrough?.identifier === factory_1.factory.service.webAPI.Identifier.COA;
|
|
39
|
-
if (excludeCOAReservation) {
|
|
40
|
-
// bookingService:COAでは作成しない(2024-12-31~)
|
|
41
|
-
}
|
|
42
|
-
else {
|
|
43
|
-
ownershipInfo = (0, factory_2.createReservationOwnershipInfo)({
|
|
44
|
-
project: params.order.project,
|
|
45
|
-
ownedBy: ownedBy,
|
|
46
|
-
acceptedOffer,
|
|
47
|
-
ownedFrom: ownedFrom,
|
|
48
|
-
identifier: identifier,
|
|
49
|
-
acquiredFrom: acquiredFrom
|
|
50
|
-
});
|
|
51
|
-
}
|
|
52
|
-
break;
|
|
53
|
-
}
|
|
54
|
-
// case factory.permit.PermitType.Permit:
|
|
55
|
-
// ownershipInfo = createProductOwnershipInfo({
|
|
56
|
-
// project: params.order.project,
|
|
57
|
-
// ownedBy: ownedBy,
|
|
58
|
-
// acceptedOffer: { ...acceptedOffer, itemOffered },
|
|
59
|
-
// ownedFrom: ownedFrom,
|
|
60
|
-
// identifier: identifier,
|
|
61
|
-
// acquiredFrom: acquiredFrom
|
|
62
|
-
// });
|
|
63
|
-
// break;
|
|
64
|
-
// case factory.actionType.MoneyTransfer:
|
|
65
|
-
// // no op
|
|
66
|
-
// // 所有権は発生しない
|
|
67
|
-
// break;
|
|
68
|
-
default:
|
|
69
|
-
throw new factory_1.factory.errors.NotImplemented(`Offered item type ${itemOfferedType} not implemented`);
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
if (ownershipInfo !== undefined) {
|
|
73
|
-
ownershipInfos.push(ownershipInfo);
|
|
74
|
-
}
|
|
75
|
-
});
|
|
76
|
-
return ownershipInfos;
|
|
77
|
-
}
|
|
78
|
-
function createOwnershipInfoIdentifier(params) {
|
|
79
|
-
return (0, util_1.format)('%s-%s-%s-%s', params.order.customer.id, params.itemOffered.typeOf, params.order.orderNumber, (params.offerIndexBase + params.offerIndex));
|
|
80
|
-
}
|
|
81
|
-
function createAcquiredFrom(params) {
|
|
82
|
-
// 最低限の情報に絞る
|
|
83
|
-
const seller = params.order.seller;
|
|
84
|
-
return {
|
|
85
|
-
// 最適化(2022-11-15~)
|
|
86
|
-
// project: { typeOf: params.order.project.typeOf, id: params.order.project.id },
|
|
87
|
-
id: seller.id,
|
|
88
|
-
typeOf: seller.typeOf,
|
|
89
|
-
name: (typeof seller.name === 'string')
|
|
90
|
-
? seller.name
|
|
91
|
-
: String(seller.typeOf)
|
|
92
|
-
};
|
|
93
|
-
}
|
|
94
|
-
function createOwnedby(params) {
|
|
95
|
-
const customer = params.order.customer;
|
|
96
|
-
let owner;
|
|
97
|
-
// 顧客組織の場合
|
|
98
|
-
if (customer.typeOf === factory_1.factory.organizationType.Organization) {
|
|
99
|
-
// discontinue(2026-03-15~)
|
|
100
|
-
// const ownerAsOrganization: factory.ownershipInfo.IOwnerAsOrganization = {
|
|
101
|
-
// // 個人情報排除するように
|
|
102
|
-
// typeOf: customer.typeOf,
|
|
103
|
-
// id: customer.id
|
|
104
|
-
// };
|
|
105
|
-
// owner = ownerAsOrganization;
|
|
106
|
-
}
|
|
107
|
-
else if (customer.typeOf === factory_1.factory.personType.Person) {
|
|
108
|
-
const ownerAsPerson = {
|
|
109
|
-
// 個人情報排除するように
|
|
110
|
-
typeOf: customer.typeOf,
|
|
111
|
-
id: customer.id
|
|
112
|
-
};
|
|
113
|
-
owner = ownerAsPerson;
|
|
114
|
-
}
|
|
115
|
-
else {
|
|
116
|
-
// discontinue(2026-03-15~)
|
|
117
|
-
// owner = {
|
|
118
|
-
// // 個人情報排除するように
|
|
119
|
-
// typeOf: customer.typeOf,
|
|
120
|
-
// id: customer.id
|
|
121
|
-
// };
|
|
122
|
-
}
|
|
123
|
-
return (owner !== undefined) ? [owner] : [];
|
|
124
|
-
}
|