infoalloggi-monorepo/apps/infoalloggi/src/server/controllers/fic.controller.ts

47 lines
1,007 B
TypeScript
Raw Normal View History

2025-08-04 17:45:44 +02:00
import { clientsApi, companyId } from "~/server/FattureInCloud";
// export const getClientList = async () => {
// const clients = await clientsApi.listClients(
// companyId,
// undefined,
// "detailed",
// undefined,
// undefined,
// 100,
// );
// return clients.data;
// };
2025-08-04 17:45:44 +02:00
// export const searchClient = async (cognome: string) => {
// const clients = await clientsApi.listClients(
// companyId,
// undefined,
// "detailed",
// undefined,
// undefined,
// 100,
// `name contains '${cognome}'`,
// );
// return clients.data;
// };
2025-08-04 17:45:44 +02:00
export const getClientFromCF = async (cf: string) => {
2025-08-28 18:27:07 +02:00
if (cf.length < 11) {
return null;
}
const clients = await clientsApi.listClients(
companyId,
undefined,
"detailed",
undefined,
undefined,
100,
`tax_code = '${cf}'`,
);
return clients.data;
2025-08-04 17:45:44 +02:00
};
// export const addClient = async (client: Client) => {
// const newClient = await clientsApi.createClient(companyId, { data: client });
// return newClient.data;
// };