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}`;
}
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;
}
) & {
export type CustomerBranchCreate = {
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;

View file

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