feat: add order field
This commit is contained in:
parent
aa8dcdaf86
commit
0bd2c1ecf2
11 changed files with 79 additions and 26 deletions
|
|
@ -287,6 +287,7 @@ export class CustomerBranchController extends Controller {
|
|||
},
|
||||
data: {
|
||||
...rest,
|
||||
statusOrder: +(rest.status === "INACTIVE"),
|
||||
branchNo: count + 1,
|
||||
code: `${customer.code}-${(count + 1).toString().padStart(2, "0")}`,
|
||||
customer: { connect: { id: customerId } },
|
||||
|
|
@ -365,6 +366,7 @@ export class CustomerBranchController extends Controller {
|
|||
},
|
||||
data: {
|
||||
...rest,
|
||||
statusOrder: +(rest.status === "INACTIVE"),
|
||||
customer: { connect: customerId ? { id: customerId } : undefined },
|
||||
province: {
|
||||
connect: provinceId ? { id: provinceId } : undefined,
|
||||
|
|
@ -403,7 +405,11 @@ export class CustomerBranchController extends Controller {
|
|||
}
|
||||
|
||||
if (record.status !== Status.CREATED) {
|
||||
throw new HttpError(HttpStatus.FORBIDDEN, "Customer branch is in used.", "customerBranchInUsed");
|
||||
throw new HttpError(
|
||||
HttpStatus.FORBIDDEN,
|
||||
"Customer branch is in used.",
|
||||
"customerBranchInUsed",
|
||||
);
|
||||
}
|
||||
|
||||
return await prisma.customerBranch.delete({ where: { id: branchId } }).then((v) => {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue