Files
psp_api/prisma/schema/bank.prisma
T
ahasani b05048e62f feat(bank-accounts): add transaction retrieval and update service logic
- Implemented a new endpoint to fetch transactions for a specific bank account.
- Refactored the bank account service to streamline transaction handling and balance calculations.
- Removed the bank account balance table and adjusted related logic in workflows and services.
- Enhanced transaction mapping to include references to sales and purchase records.
2026-01-05 18:35:08 +03:30

52 lines
1.9 KiB
Plaintext

model BankBranch {
id Int @id @default(autoincrement())
name String @db.VarChar(255)
code String @unique() @db.VarChar(10)
address String? @db.VarChar(500)
createdAt DateTime @default(now()) @db.Timestamp(0)
updatedAt DateTime @updatedAt @db.Timestamp(0)
deletedAt DateTime? @db.Timestamp(0)
bankId Int
bank Bank @relation("bank_branches", fields: [bankId], references: [id])
bankAccounts BankAccount[] @relation("Bank_Accounts_branchId_fkey")
@@map("Bank_Branches")
}
model BankAccount {
id Int @id @default(autoincrement())
accountNumber String? @unique @db.VarChar(20)
cardNumber String? @unique @db.VarChar(16)
name String @db.VarChar(255)
iban String? @unique @db.VarChar(34)
branchId Int
createdAt DateTime @default(now()) @db.Timestamp(0)
updatedAt DateTime @updatedAt @db.Timestamp(0)
deletedAt DateTime? @db.Timestamp(0)
branch BankBranch @relation("Bank_Accounts_branchId_fkey", fields: [branchId], references: [id])
inventoryBankAccounts InventoryBankAccount[]
purchaseReceiptPayments PurchaseReceiptPayments[]
bankAccountTransactions BankAccountTransaction[]
@@map("Bank_Accounts")
}
model BankAccountTransaction {
id Int @id @default(autoincrement())
bankAccountId Int
type BankAccountTransactionType
amount Decimal @db.Decimal(15, 2)
balanceAfter Decimal @db.Decimal(15, 2)
referenceId Int
referenceType BankTransactionRefType
description String? @db.Text
createdAt DateTime @default(now()) @db.Timestamp(0)
bankAccount BankAccount @relation(fields: [bankAccountId], references: [id])
@@index([bankAccountId])
@@map("Bank_Account_Transactions")
}