Uecko_ERP/apps/server/archive/contexts/customer-billing/application/get-customer-invoice.use-case.ts

19 lines
755 B
TypeScript
Raw Normal View History

2025-05-02 21:43:51 +00:00
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";
2025-05-09 10:45:32 +00:00
import { Result } from "@repo/rdx-utils";
2025-02-25 15:25:30 +00:00
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);
});
}
}