Add customer management

This commit is contained in:
2025-07-06 08:31:48 +00:00
parent 2bd76aa6bb
commit 916dbfcf95
57 changed files with 2442 additions and 161 deletions

View File

@@ -0,0 +1,21 @@
"use server";
import {CreateCustomerDto} from "@/services/customers/dtos/createCustomer.dto";
import {CustomerRepository} from "@/services/customers/repositories/customerRepository";
export async function addCustomer(params: CreateCustomerDto): Promise<void> {
const {email, name, companyName, street, zip, city, phoneNumbers, notes} = params;
const payload: CreateCustomerDto = {
email,
name,
companyName,
street,
zip,
city,
phoneNumbers,
notes: notes.map(({text}) => ({text})),
};
await CustomerRepository.create(payload);
}

View File

@@ -0,0 +1,15 @@
"use server";
import {callApi} from "@/lib/api/callApi";
import {Customer} from "@/app/customers/page";
import {customerRoutes} from "@/app/api/customers/customerRoutes";
export async function validateCustomer(input: {
email: string;
companyName: string;
street: string;
zip: string;
city: string;
}): Promise<Customer[]> {
return await callApi<Customer[]>(customerRoutes.validate, "POST", input);
}