feat: add bank field
This commit is contained in:
parent
3e4709d8ff
commit
0bd3ce55a7
3 changed files with 34 additions and 3 deletions
|
|
@ -0,0 +1,20 @@
|
|||
/*
|
||||
Warnings:
|
||||
|
||||
- Added the required column `accountType` to the `BranchBank` table without a default value. This is not possible if the table is not empty.
|
||||
- Added the required column `bankBranch` to the `BranchBank` table without a default value. This is not possible if the table is not empty.
|
||||
- Added the required column `currentlyUse` to the `BranchBank` table without a default value. This is not possible if the table is not empty.
|
||||
- Made the column `branchId` on table `BranchBank` required. This step will fail if there are existing NULL values in that column.
|
||||
|
||||
*/
|
||||
-- DropForeignKey
|
||||
ALTER TABLE "BranchBank" DROP CONSTRAINT "BranchBank_branchId_fkey";
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE "BranchBank" ADD COLUMN "accountType" TEXT NOT NULL,
|
||||
ADD COLUMN "bankBranch" TEXT NOT NULL,
|
||||
ADD COLUMN "currentlyUse" BOOLEAN NOT NULL,
|
||||
ALTER COLUMN "branchId" SET NOT NULL;
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE "BranchBank" ADD CONSTRAINT "BranchBank_branchId_fkey" FOREIGN KEY ("branchId") REFERENCES "Branch"("id") ON DELETE CASCADE ON UPDATE CASCADE;
|
||||
|
|
@ -241,11 +241,14 @@ model Branch {
|
|||
model BranchBank {
|
||||
id String @id @default(uuid())
|
||||
bankName String
|
||||
bankBranch String
|
||||
accountName String
|
||||
accountNumber String
|
||||
accountType String
|
||||
currentlyUse Boolean
|
||||
|
||||
branch Branch? @relation(fields: [branchId], references: [id])
|
||||
branchId String?
|
||||
branch Branch @relation(fields: [branchId], references: [id], onDelete: Cascade)
|
||||
branchId String
|
||||
}
|
||||
|
||||
model BranchContact {
|
||||
|
|
|
|||
|
|
@ -44,8 +44,11 @@ type BranchCreate = {
|
|||
|
||||
bank?: {
|
||||
bankName: string;
|
||||
bankBranch: string;
|
||||
accountName: string;
|
||||
accountNumber: string;
|
||||
accountType: string;
|
||||
currentlyUse: boolean;
|
||||
}[];
|
||||
|
||||
subDistrictId?: string | null;
|
||||
|
|
@ -77,8 +80,11 @@ type BranchUpdate = {
|
|||
|
||||
bank?: {
|
||||
bankName: string;
|
||||
bankBranch: string;
|
||||
accountName: string;
|
||||
accountNumber: string;
|
||||
accountType: string;
|
||||
currentlyUse: boolean;
|
||||
}[];
|
||||
};
|
||||
|
||||
|
|
@ -199,6 +205,7 @@ export class BranchController extends Controller {
|
|||
subDistrict: true,
|
||||
},
|
||||
},
|
||||
bank: true,
|
||||
_count: {
|
||||
select: { branch: true },
|
||||
},
|
||||
|
|
@ -236,6 +243,7 @@ export class BranchController extends Controller {
|
|||
subDistrict: true,
|
||||
},
|
||||
},
|
||||
bank: true,
|
||||
contact: includeContact,
|
||||
},
|
||||
where: { id: branchId },
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue