refactor: combine payload

This commit is contained in:
Methapon Metanipat 2024-09-16 14:37:03 +07:00
parent ad422c48aa
commit 1b82bb616f
2 changed files with 42 additions and 35 deletions

View file

@ -59,24 +59,28 @@ function attachmentLocation(customerId: string, branchId: string) {
return `customer/${customerId}/branch/${branchId}`; return `customer/${customerId}/branch/${branchId}`;
} }
export type CustomerBranchCreate = ( export type CustomerBranchCreate = {
| {
// NOTE: About (Natural Person)
citizenId: string;
}
| {
// NOTE: About (Legal Entity)
legalPersonNo: string;
registerName: string;
registerNameEN: string;
registerDate: Date;
authorizedCapital: string;
authorizedName: string;
authorizedNameEN: string;
}
) & {
customerId: string; customerId: string;
customerName: string;
// NOTE: About (Natural Person)
citizenId?: string;
namePrefix?: string;
firstName?: string;
firstNameEN?: string;
lastName?: string;
lastNameEN?: string;
gender?: string;
birthDate?: Date;
// NOTE: About (Legal Entity)
legalPersonNo?: string;
registerName?: string;
registerNameEN?: string;
registerDate?: Date;
authorizedCapital?: string;
authorizedName?: string;
authorizedNameEN?: string;
customerName?: string;
telephoneNo: string; telephoneNo: string;

View file

@ -51,23 +51,26 @@ export type CustomerCreate = {
status?: Status; status?: Status;
selectedImage?: string; selectedImage?: string;
branch: (( branch: {
| { // NOTE: About (Natural Person)
// NOTE: About (Natural Person) citizenId?: string;
citizenId: string; namePrefix?: string;
} firstName?: string;
| { firstNameEN?: string;
// NOTE: About (Legal Entity) lastName?: string;
legalPersonNo: string; lastNameEN?: string;
registerName: string; gender?: string;
registerNameEN: string; birthDate?: Date;
registerDate: Date;
authorizedCapital: string; // NOTE: About (Legal Entity)
authorizedName: string; legalPersonNo?: string;
authorizedNameEN: string; registerName?: string;
} registerNameEN?: string;
) & { registerDate?: Date;
customerName: string; authorizedCapital?: string;
authorizedName?: string;
authorizedNameEN?: string;
customerName?: string;
telephoneNo: string; telephoneNo: string;
@ -102,7 +105,7 @@ export type CustomerCreate = {
subDistrictId?: string | null; subDistrictId?: string | null;
districtId?: string | null; districtId?: string | null;
provinceId?: string | null; provinceId?: string | null;
})[]; }[];
}; };
export type CustomerUpdate = { export type CustomerUpdate = {