fix: validate error

This commit is contained in:
Methapon2001 2024-06-07 11:34:04 +07:00
parent e5dcc86747
commit 2c134aa68a

View file

@ -18,7 +18,6 @@ import prisma from "../db";
import minio from "../services/minio";
import HttpStatus from "../interfaces/http-status";
import HttpError from "../interfaces/http-error";
import { CustomerBranchCreate } from "./customer-branch-controller";
if (!process.env.MINIO_BUCKET) {
throw Error("Require MinIO bucket.");
@ -32,7 +31,38 @@ export type CustomerCreate = {
customerName: string;
customerNameEN: string;
taxNo?: string | null;
customerBranch?: Omit<CustomerBranchCreate, "customerId">[];
customerBranch?: {
status?: Status;
legalPersonNo: string;
taxNo: string | null;
name: string;
nameEN: string;
addressEN: string;
address: string;
zipCode: string;
email: string;
telephoneNo: string;
registerName: string;
registerDate: Date;
authorizedCapital: string;
employmentOffice: string;
bussinessType: string;
bussinessTypeEN: string;
jobPosition: string;
jobPositionEN: string;
jobDescription: string;
saleEmployee: string;
payDate: string;
wageDate: string;
subDistrictId?: string | null;
districtId?: string | null;
provinceId?: string | null;
}[];
};
export type CustomerUpdate = {
@ -41,7 +71,40 @@ export type CustomerUpdate = {
customerName?: string;
customerNameEN?: string;
taxNo?: string | null;
customerBranch?: (Omit<CustomerBranchCreate, "customerId"> & { id?: string })[];
customerBranch?: {
id?: string;
status?: Status;
legalPersonNo: string;
taxNo: string | null;
name: string;
nameEN: string;
addressEN: string;
address: string;
zipCode: string;
email: string;
telephoneNo: string;
registerName: string;
registerDate: Date;
authorizedCapital: string;
employmentOffice: string;
bussinessType: string;
bussinessTypeEN: string;
jobPosition: string;
jobPositionEN: string;
jobDescription: string;
saleEmployee: string;
payDate: string;
wageDate: string;
subDistrictId?: string | null;
districtId?: string | null;
provinceId?: string | null;
}[];
};
function imageLocation(id: string) {