feat: add code customer field
This commit is contained in:
parent
03d25219c1
commit
fffd20ea0f
3 changed files with 11 additions and 1 deletions
8
prisma/migrations/20240823033311_add_field/migration.sql
Normal file
8
prisma/migrations/20240823033311_add_field/migration.sql
Normal file
|
|
@ -0,0 +1,8 @@
|
||||||
|
/*
|
||||||
|
Warnings:
|
||||||
|
|
||||||
|
- Added the required column `codeCustomer` to the `CustomerBranch` table without a default value. This is not possible if the table is not empty.
|
||||||
|
|
||||||
|
*/
|
||||||
|
-- AlterTable
|
||||||
|
ALTER TABLE "CustomerBranch" ADD COLUMN "codeCustomer" TEXT NOT NULL;
|
||||||
|
|
@ -437,7 +437,8 @@ model CustomerBranch {
|
||||||
customer Customer @relation(fields: [customerId], references: [id], onDelete: Cascade)
|
customer Customer @relation(fields: [customerId], references: [id], onDelete: Cascade)
|
||||||
customerId String
|
customerId String
|
||||||
|
|
||||||
code String
|
code String
|
||||||
|
codeCustomer String
|
||||||
|
|
||||||
// NOTE: About (Natural Person)
|
// NOTE: About (Natural Person)
|
||||||
citizenId String?
|
citizenId String?
|
||||||
|
|
|
||||||
|
|
@ -376,6 +376,7 @@ export class CustomerBranchController extends Controller {
|
||||||
data: {
|
data: {
|
||||||
...rest,
|
...rest,
|
||||||
code: `${runningKey.replace("CUSTOMER_BRANCH_", "")}-${`${last.value - 1}`.padStart(2, "0")}`,
|
code: `${runningKey.replace("CUSTOMER_BRANCH_", "")}-${`${last.value - 1}`.padStart(2, "0")}`,
|
||||||
|
codeCustomer: runningKey.replace("CUSTOMER_BRANCH_", ""),
|
||||||
customer: { connect: { id: customerId } },
|
customer: { connect: { id: customerId } },
|
||||||
province: { connect: provinceId ? { id: provinceId } : undefined },
|
province: { connect: provinceId ? { id: provinceId } : undefined },
|
||||||
district: { connect: districtId ? { id: districtId } : undefined },
|
district: { connect: districtId ? { id: districtId } : undefined },
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue