refactor: combine payload
This commit is contained in:
parent
46c79d50ce
commit
c7b5f91d31
1 changed files with 17 additions and 20 deletions
|
|
@ -51,24 +51,21 @@ 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;
|
||||
}
|
||||
) & {
|
||||
customerId: string;
|
||||
customerName: 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;
|
||||
|
||||
customerId?: string;
|
||||
|
||||
telephoneNo: string;
|
||||
|
||||
|
|
@ -103,7 +100,7 @@ export type CustomerCreate = {
|
|||
subDistrictId?: string | null;
|
||||
districtId?: string | null;
|
||||
provinceId?: string | null;
|
||||
})[];
|
||||
}[];
|
||||
};
|
||||
|
||||
export type CustomerUpdate = {
|
||||
|
|
@ -267,7 +264,7 @@ export class CustomerController extends Controller {
|
|||
);
|
||||
}
|
||||
|
||||
const runningKey = `CUSTOMER_BRANCH_${company}_${"citizenId" in headoffice ? headoffice.citizenId : headoffice.legalPersonNo}`;
|
||||
const runningKey = `CUSTOMER_BRANCH_${company}_${headoffice.citizenId || headoffice.legalPersonNo}`;
|
||||
|
||||
const last = await tx.runningNo.upsert({
|
||||
where: { key: runningKey },
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue