FactuGES_ERP/modules/customers/src/web/shared/api/create-customer.api.ts

15 lines
542 B
TypeScript
Raw Normal View History

2026-04-03 19:49:59 +00:00
import type { IDataSource } from "@erp/core/client";
import type { CreateCustomerRequestDTO, CustomerCreationResponseDTO } from "../../../common";
export type CustomerCreateInput = CreateCustomerRequestDTO;
export type CustomerCreateOutput = CustomerCreationResponseDTO;
export function createCustomer(dataSource: IDataSource, id: string, data: CustomerCreateInput) {
if (!id) throw new Error("customerId is required");
return dataSource.createOne<CustomerCreateInput, CustomerCreateOutput>("customers", {
...data,
id,
});
}