change: branch code now have 5 digit
This commit is contained in:
parent
a312b797c7
commit
2d056d3b56
1 changed files with 3 additions and 3 deletions
|
|
@ -180,9 +180,9 @@ export class BranchController extends Controller {
|
|||
) {
|
||||
const where = {
|
||||
AND: {
|
||||
zipCode,
|
||||
headOfficeId: headOfficeId ?? (filter === "head" || tree ? null : undefined),
|
||||
NOT: { headOfficeId: filter === "sub" && !headOfficeId ? null : undefined },
|
||||
zipCode,
|
||||
},
|
||||
OR: [
|
||||
{ nameEN: { contains: query } },
|
||||
|
|
@ -323,7 +323,7 @@ export class BranchController extends Controller {
|
|||
|
||||
if (last.value === 1) {
|
||||
const exist = await tx.branch.findFirst({
|
||||
where: { code: `${code?.toLocaleUpperCase()}${`${last.value - 1}`.padStart(6, "0")}` },
|
||||
where: { code: `${code?.toLocaleUpperCase()}${`${last.value - 1}`.padStart(5, "0")}` },
|
||||
});
|
||||
if (exist)
|
||||
throw new HttpError(
|
||||
|
|
@ -352,7 +352,7 @@ export class BranchController extends Controller {
|
|||
data: {
|
||||
...rest,
|
||||
statusOrder: +(rest.status === "INACTIVE"),
|
||||
code: `${code?.toLocaleUpperCase()}${`${last.value - 1}`.padStart(6, "0")}`,
|
||||
code: `${code?.toLocaleUpperCase()}${`${last.value - 1}`.padStart(5, "0")}`,
|
||||
bank: bank ? { createMany: { data: bank } } : undefined,
|
||||
isHeadOffice: !headOfficeId,
|
||||
contact: {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue