Revert "refactor: combine payload"

This reverts commit c7b5f91d31.
This commit is contained in:
Methapon Metanipat 2024-09-16 14:14:53 +07:00
parent 13f8b34d7e
commit 2ae0824fa9

View file

@ -51,21 +51,24 @@ 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;
customerId?: 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;
telephoneNo: string;
@ -100,7 +103,7 @@ export type CustomerCreate = {
subDistrictId?: string | null;
districtId?: string | null;
provinceId?: string | null;
}[];
})[];
};
export type CustomerUpdate = {
@ -264,7 +267,7 @@ export class CustomerController extends Controller {
);
}
const runningKey = `CUSTOMER_BRANCH_${company}_${headoffice.citizenId || headoffice.legalPersonNo}`;
const runningKey = `CUSTOMER_BRANCH_${company}_${"citizenId" in headoffice ? headoffice.citizenId : headoffice.legalPersonNo}`;
const last = await tx.runningNo.upsert({
where: { key: runningKey },