fix: relation
This commit is contained in:
parent
1b82bb616f
commit
06d4647462
1 changed files with 7 additions and 0 deletions
|
|
@ -26,6 +26,7 @@ import {
|
||||||
import { filterStatus } from "../services/prisma";
|
import { filterStatus } from "../services/prisma";
|
||||||
import { deleteFile, deleteFolder, fileLocation, getFile, listFile, setFile } from "../utils/minio";
|
import { deleteFile, deleteFolder, fileLocation, getFile, listFile, setFile } from "../utils/minio";
|
||||||
import { notFoundError, relationError } from "../utils/error";
|
import { notFoundError, relationError } from "../utils/error";
|
||||||
|
import { connectOrNot } from "../utils/relation";
|
||||||
|
|
||||||
const MANAGE_ROLES = [
|
const MANAGE_ROLES = [
|
||||||
"system",
|
"system",
|
||||||
|
|
@ -299,6 +300,12 @@ export class CustomerController extends Controller {
|
||||||
...v,
|
...v,
|
||||||
code: `${runningKey.replace("CUSTOMER_BRANCH_", "")}-${`${last.value - branch.length + i}`.padStart(2, "0")}`,
|
code: `${runningKey.replace("CUSTOMER_BRANCH_", "")}-${`${last.value - branch.length + i}`.padStart(2, "0")}`,
|
||||||
codeCustomer: runningKey.replace("CUSTOMER_BRANCH_", ""),
|
codeCustomer: runningKey.replace("CUSTOMER_BRANCH_", ""),
|
||||||
|
province: connectOrNot(v.provinceId),
|
||||||
|
provinceId: undefined,
|
||||||
|
district: connectOrNot(v.districtId),
|
||||||
|
districtId: undefined,
|
||||||
|
subDistrict: connectOrNot(v.subDistrictId),
|
||||||
|
subDistrictId: undefined,
|
||||||
createdBy: { connect: { id: req.user.sub } },
|
createdBy: { connect: { id: req.user.sub } },
|
||||||
updatedBy: { connect: { id: req.user.sub } },
|
updatedBy: { connect: { id: req.user.sub } },
|
||||||
})),
|
})),
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue