Uecko_ERP/apps/server/archive/contexts/customer-billing/application/get-customer-invoice.use-case.ts
2025-05-09 12:45:32 +02:00

19 lines
755 B
TypeScript

import { ICustomerInvoiceService } from "@/contexts/customer-billing/domain";
import { CustomerInvoice } from "@/contexts/customer-billing/domain/aggregates";
import { UniqueID } from "@/core/common/domain";
import { ITransactionManager } from "@/core/common/infrastructure/database";
import { Result } from "@repo/rdx-utils";
export class GetCustomerInvoiceUseCase {
constructor(
private readonly invoiceService: ICustomerInvoiceService,
private readonly transactionManager: ITransactionManager
) {}
public execute(invoiceId: UniqueID): Promise<Result<CustomerInvoice, Error>> {
return this.transactionManager.complete((transaction) => {
return this.invoiceService.findCustomerInvoiceById(invoiceId, transaction);
});
}
}