From 2c134aa68aa8c430498512613a1e32e65535dede Mon Sep 17 00:00:00 2001 From: Methapon2001 <61303214+Methapon2001@users.noreply.github.com> Date: Fri, 7 Jun 2024 11:34:04 +0700 Subject: [PATCH] fix: validate error --- src/controllers/customer-controller.ts | 69 ++++++++++++++++++++++++-- 1 file changed, 66 insertions(+), 3 deletions(-) diff --git a/src/controllers/customer-controller.ts b/src/controllers/customer-controller.ts index 047a711..9dbf98d 100644 --- a/src/controllers/customer-controller.ts +++ b/src/controllers/customer-controller.ts @@ -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[]; + 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 & { 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) {