FactuGES_ERP/modules/customers/src/web/shared/api/create-customer.api.ts
2026-04-03 21:49:59 +02:00

15 lines
542 B
TypeScript

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,
});
}