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.
This commit is contained in:
@@ -0,0 +1,11 @@
|
|||||||
|
/*
|
||||||
|
Warnings:
|
||||||
|
|
||||||
|
- You are about to drop the `Bank_Account_Balance` table. If the table is not empty, all the data it contains will be lost.
|
||||||
|
|
||||||
|
*/
|
||||||
|
-- DropForeignKey
|
||||||
|
ALTER TABLE `Bank_Account_Balance` DROP FOREIGN KEY `Bank_Account_Balance_bankAccountId_fkey`;
|
||||||
|
|
||||||
|
-- DropTable
|
||||||
|
DROP TABLE `Bank_Account_Balance`;
|
||||||
@@ -29,7 +29,6 @@ model BankAccount {
|
|||||||
inventoryBankAccounts InventoryBankAccount[]
|
inventoryBankAccounts InventoryBankAccount[]
|
||||||
purchaseReceiptPayments PurchaseReceiptPayments[]
|
purchaseReceiptPayments PurchaseReceiptPayments[]
|
||||||
bankAccountTransactions BankAccountTransaction[]
|
bankAccountTransactions BankAccountTransaction[]
|
||||||
bankAccountBalances BankAccountBalance[]
|
|
||||||
|
|
||||||
@@map("Bank_Accounts")
|
@@map("Bank_Accounts")
|
||||||
}
|
}
|
||||||
@@ -50,13 +49,3 @@ model BankAccountTransaction {
|
|||||||
@@index([bankAccountId])
|
@@index([bankAccountId])
|
||||||
@@map("Bank_Account_Transactions")
|
@@map("Bank_Account_Transactions")
|
||||||
}
|
}
|
||||||
|
|
||||||
model BankAccountBalance {
|
|
||||||
bankAccountId Int @unique
|
|
||||||
balance Decimal @db.Decimal(15, 2)
|
|
||||||
updatedAt DateTime @updatedAt @db.Timestamp(0)
|
|
||||||
|
|
||||||
bankAccount BankAccount @relation(fields: [bankAccountId], references: [id])
|
|
||||||
|
|
||||||
@@map("Bank_Account_Balance")
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -52,11 +52,6 @@ export type BankAccount = Prisma.BankAccountModel
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
export type BankAccountTransaction = Prisma.BankAccountTransactionModel
|
export type BankAccountTransaction = Prisma.BankAccountTransactionModel
|
||||||
/**
|
|
||||||
* Model BankAccountBalance
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
export type BankAccountBalance = Prisma.BankAccountBalanceModel
|
|
||||||
/**
|
/**
|
||||||
* Model Inventory
|
* Model Inventory
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -72,11 +72,6 @@ export type BankAccount = Prisma.BankAccountModel
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
export type BankAccountTransaction = Prisma.BankAccountTransactionModel
|
export type BankAccountTransaction = Prisma.BankAccountTransactionModel
|
||||||
/**
|
|
||||||
* Model BankAccountBalance
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
export type BankAccountBalance = Prisma.BankAccountBalanceModel
|
|
||||||
/**
|
/**
|
||||||
* Model Inventory
|
* Model Inventory
|
||||||
*
|
*
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
@@ -391,7 +391,6 @@ export const ModelName = {
|
|||||||
BankBranch: 'BankBranch',
|
BankBranch: 'BankBranch',
|
||||||
BankAccount: 'BankAccount',
|
BankAccount: 'BankAccount',
|
||||||
BankAccountTransaction: 'BankAccountTransaction',
|
BankAccountTransaction: 'BankAccountTransaction',
|
||||||
BankAccountBalance: 'BankAccountBalance',
|
|
||||||
Inventory: 'Inventory',
|
Inventory: 'Inventory',
|
||||||
InventoryBankAccount: 'InventoryBankAccount',
|
InventoryBankAccount: 'InventoryBankAccount',
|
||||||
PosAccount: 'PosAccount',
|
PosAccount: 'PosAccount',
|
||||||
@@ -433,7 +432,7 @@ export type TypeMap<ExtArgs extends runtime.Types.Extensions.InternalArgs = runt
|
|||||||
omit: GlobalOmitOptions
|
omit: GlobalOmitOptions
|
||||||
}
|
}
|
||||||
meta: {
|
meta: {
|
||||||
modelProps: "user" | "role" | "otpCode" | "refreshToken" | "bankBranch" | "bankAccount" | "bankAccountTransaction" | "bankAccountBalance" | "inventory" | "inventoryBankAccount" | "posAccount" | "inventoryTransfer" | "inventoryTransferItem" | "bank" | "order" | "orderItem" | "customer" | "triggerLog" | "productVariant" | "product" | "productBrand" | "productCategory" | "purchaseReceipt" | "purchaseReceiptItem" | "purchaseReceiptPayments" | "salesInvoice" | "salesInvoiceItem" | "salesInvoicePayment" | "stockMovement" | "stockBalance" | "stockAdjustment" | "stockReservation" | "supplier" | "supplierLedger"
|
modelProps: "user" | "role" | "otpCode" | "refreshToken" | "bankBranch" | "bankAccount" | "bankAccountTransaction" | "inventory" | "inventoryBankAccount" | "posAccount" | "inventoryTransfer" | "inventoryTransferItem" | "bank" | "order" | "orderItem" | "customer" | "triggerLog" | "productVariant" | "product" | "productBrand" | "productCategory" | "purchaseReceipt" | "purchaseReceiptItem" | "purchaseReceiptPayments" | "salesInvoice" | "salesInvoiceItem" | "salesInvoicePayment" | "stockMovement" | "stockBalance" | "stockAdjustment" | "stockReservation" | "supplier" | "supplierLedger"
|
||||||
txIsolationLevel: TransactionIsolationLevel
|
txIsolationLevel: TransactionIsolationLevel
|
||||||
}
|
}
|
||||||
model: {
|
model: {
|
||||||
@@ -899,72 +898,6 @@ export type TypeMap<ExtArgs extends runtime.Types.Extensions.InternalArgs = runt
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
BankAccountBalance: {
|
|
||||||
payload: Prisma.$BankAccountBalancePayload<ExtArgs>
|
|
||||||
fields: Prisma.BankAccountBalanceFieldRefs
|
|
||||||
operations: {
|
|
||||||
findUnique: {
|
|
||||||
args: Prisma.BankAccountBalanceFindUniqueArgs<ExtArgs>
|
|
||||||
result: runtime.Types.Utils.PayloadToResult<Prisma.$BankAccountBalancePayload> | null
|
|
||||||
}
|
|
||||||
findUniqueOrThrow: {
|
|
||||||
args: Prisma.BankAccountBalanceFindUniqueOrThrowArgs<ExtArgs>
|
|
||||||
result: runtime.Types.Utils.PayloadToResult<Prisma.$BankAccountBalancePayload>
|
|
||||||
}
|
|
||||||
findFirst: {
|
|
||||||
args: Prisma.BankAccountBalanceFindFirstArgs<ExtArgs>
|
|
||||||
result: runtime.Types.Utils.PayloadToResult<Prisma.$BankAccountBalancePayload> | null
|
|
||||||
}
|
|
||||||
findFirstOrThrow: {
|
|
||||||
args: Prisma.BankAccountBalanceFindFirstOrThrowArgs<ExtArgs>
|
|
||||||
result: runtime.Types.Utils.PayloadToResult<Prisma.$BankAccountBalancePayload>
|
|
||||||
}
|
|
||||||
findMany: {
|
|
||||||
args: Prisma.BankAccountBalanceFindManyArgs<ExtArgs>
|
|
||||||
result: runtime.Types.Utils.PayloadToResult<Prisma.$BankAccountBalancePayload>[]
|
|
||||||
}
|
|
||||||
create: {
|
|
||||||
args: Prisma.BankAccountBalanceCreateArgs<ExtArgs>
|
|
||||||
result: runtime.Types.Utils.PayloadToResult<Prisma.$BankAccountBalancePayload>
|
|
||||||
}
|
|
||||||
createMany: {
|
|
||||||
args: Prisma.BankAccountBalanceCreateManyArgs<ExtArgs>
|
|
||||||
result: BatchPayload
|
|
||||||
}
|
|
||||||
delete: {
|
|
||||||
args: Prisma.BankAccountBalanceDeleteArgs<ExtArgs>
|
|
||||||
result: runtime.Types.Utils.PayloadToResult<Prisma.$BankAccountBalancePayload>
|
|
||||||
}
|
|
||||||
update: {
|
|
||||||
args: Prisma.BankAccountBalanceUpdateArgs<ExtArgs>
|
|
||||||
result: runtime.Types.Utils.PayloadToResult<Prisma.$BankAccountBalancePayload>
|
|
||||||
}
|
|
||||||
deleteMany: {
|
|
||||||
args: Prisma.BankAccountBalanceDeleteManyArgs<ExtArgs>
|
|
||||||
result: BatchPayload
|
|
||||||
}
|
|
||||||
updateMany: {
|
|
||||||
args: Prisma.BankAccountBalanceUpdateManyArgs<ExtArgs>
|
|
||||||
result: BatchPayload
|
|
||||||
}
|
|
||||||
upsert: {
|
|
||||||
args: Prisma.BankAccountBalanceUpsertArgs<ExtArgs>
|
|
||||||
result: runtime.Types.Utils.PayloadToResult<Prisma.$BankAccountBalancePayload>
|
|
||||||
}
|
|
||||||
aggregate: {
|
|
||||||
args: Prisma.BankAccountBalanceAggregateArgs<ExtArgs>
|
|
||||||
result: runtime.Types.Utils.Optional<Prisma.AggregateBankAccountBalance>
|
|
||||||
}
|
|
||||||
groupBy: {
|
|
||||||
args: Prisma.BankAccountBalanceGroupByArgs<ExtArgs>
|
|
||||||
result: runtime.Types.Utils.Optional<Prisma.BankAccountBalanceGroupByOutputType>[]
|
|
||||||
}
|
|
||||||
count: {
|
|
||||||
args: Prisma.BankAccountBalanceCountArgs<ExtArgs>
|
|
||||||
result: runtime.Types.Utils.Optional<Prisma.BankAccountBalanceCountAggregateOutputType> | number
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Inventory: {
|
Inventory: {
|
||||||
payload: Prisma.$InventoryPayload<ExtArgs>
|
payload: Prisma.$InventoryPayload<ExtArgs>
|
||||||
fields: Prisma.InventoryFieldRefs
|
fields: Prisma.InventoryFieldRefs
|
||||||
@@ -2816,15 +2749,6 @@ export const BankAccountTransactionScalarFieldEnum = {
|
|||||||
export type BankAccountTransactionScalarFieldEnum = (typeof BankAccountTransactionScalarFieldEnum)[keyof typeof BankAccountTransactionScalarFieldEnum]
|
export type BankAccountTransactionScalarFieldEnum = (typeof BankAccountTransactionScalarFieldEnum)[keyof typeof BankAccountTransactionScalarFieldEnum]
|
||||||
|
|
||||||
|
|
||||||
export const BankAccountBalanceScalarFieldEnum = {
|
|
||||||
bankAccountId: 'bankAccountId',
|
|
||||||
balance: 'balance',
|
|
||||||
updatedAt: 'updatedAt'
|
|
||||||
} as const
|
|
||||||
|
|
||||||
export type BankAccountBalanceScalarFieldEnum = (typeof BankAccountBalanceScalarFieldEnum)[keyof typeof BankAccountBalanceScalarFieldEnum]
|
|
||||||
|
|
||||||
|
|
||||||
export const InventoryScalarFieldEnum = {
|
export const InventoryScalarFieldEnum = {
|
||||||
id: 'id',
|
id: 'id',
|
||||||
name: 'name',
|
name: 'name',
|
||||||
@@ -3684,7 +3608,6 @@ export type GlobalOmitConfig = {
|
|||||||
bankBranch?: Prisma.BankBranchOmit
|
bankBranch?: Prisma.BankBranchOmit
|
||||||
bankAccount?: Prisma.BankAccountOmit
|
bankAccount?: Prisma.BankAccountOmit
|
||||||
bankAccountTransaction?: Prisma.BankAccountTransactionOmit
|
bankAccountTransaction?: Prisma.BankAccountTransactionOmit
|
||||||
bankAccountBalance?: Prisma.BankAccountBalanceOmit
|
|
||||||
inventory?: Prisma.InventoryOmit
|
inventory?: Prisma.InventoryOmit
|
||||||
inventoryBankAccount?: Prisma.InventoryBankAccountOmit
|
inventoryBankAccount?: Prisma.InventoryBankAccountOmit
|
||||||
posAccount?: Prisma.PosAccountOmit
|
posAccount?: Prisma.PosAccountOmit
|
||||||
|
|||||||
@@ -58,7 +58,6 @@ export const ModelName = {
|
|||||||
BankBranch: 'BankBranch',
|
BankBranch: 'BankBranch',
|
||||||
BankAccount: 'BankAccount',
|
BankAccount: 'BankAccount',
|
||||||
BankAccountTransaction: 'BankAccountTransaction',
|
BankAccountTransaction: 'BankAccountTransaction',
|
||||||
BankAccountBalance: 'BankAccountBalance',
|
|
||||||
Inventory: 'Inventory',
|
Inventory: 'Inventory',
|
||||||
InventoryBankAccount: 'InventoryBankAccount',
|
InventoryBankAccount: 'InventoryBankAccount',
|
||||||
PosAccount: 'PosAccount',
|
PosAccount: 'PosAccount',
|
||||||
@@ -199,15 +198,6 @@ export const BankAccountTransactionScalarFieldEnum = {
|
|||||||
export type BankAccountTransactionScalarFieldEnum = (typeof BankAccountTransactionScalarFieldEnum)[keyof typeof BankAccountTransactionScalarFieldEnum]
|
export type BankAccountTransactionScalarFieldEnum = (typeof BankAccountTransactionScalarFieldEnum)[keyof typeof BankAccountTransactionScalarFieldEnum]
|
||||||
|
|
||||||
|
|
||||||
export const BankAccountBalanceScalarFieldEnum = {
|
|
||||||
bankAccountId: 'bankAccountId',
|
|
||||||
balance: 'balance',
|
|
||||||
updatedAt: 'updatedAt'
|
|
||||||
} as const
|
|
||||||
|
|
||||||
export type BankAccountBalanceScalarFieldEnum = (typeof BankAccountBalanceScalarFieldEnum)[keyof typeof BankAccountBalanceScalarFieldEnum]
|
|
||||||
|
|
||||||
|
|
||||||
export const InventoryScalarFieldEnum = {
|
export const InventoryScalarFieldEnum = {
|
||||||
id: 'id',
|
id: 'id',
|
||||||
name: 'name',
|
name: 'name',
|
||||||
|
|||||||
@@ -15,7 +15,6 @@ export type * from './models/RefreshToken.js'
|
|||||||
export type * from './models/BankBranch.js'
|
export type * from './models/BankBranch.js'
|
||||||
export type * from './models/BankAccount.js'
|
export type * from './models/BankAccount.js'
|
||||||
export type * from './models/BankAccountTransaction.js'
|
export type * from './models/BankAccountTransaction.js'
|
||||||
export type * from './models/BankAccountBalance.js'
|
|
||||||
export type * from './models/Inventory.js'
|
export type * from './models/Inventory.js'
|
||||||
export type * from './models/InventoryBankAccount.js'
|
export type * from './models/InventoryBankAccount.js'
|
||||||
export type * from './models/PosAccount.js'
|
export type * from './models/PosAccount.js'
|
||||||
|
|||||||
@@ -256,7 +256,6 @@ export type BankAccountWhereInput = {
|
|||||||
inventoryBankAccounts?: Prisma.InventoryBankAccountListRelationFilter
|
inventoryBankAccounts?: Prisma.InventoryBankAccountListRelationFilter
|
||||||
purchaseReceiptPayments?: Prisma.PurchaseReceiptPaymentsListRelationFilter
|
purchaseReceiptPayments?: Prisma.PurchaseReceiptPaymentsListRelationFilter
|
||||||
bankAccountTransactions?: Prisma.BankAccountTransactionListRelationFilter
|
bankAccountTransactions?: Prisma.BankAccountTransactionListRelationFilter
|
||||||
bankAccountBalances?: Prisma.BankAccountBalanceListRelationFilter
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export type BankAccountOrderByWithRelationInput = {
|
export type BankAccountOrderByWithRelationInput = {
|
||||||
@@ -273,7 +272,6 @@ export type BankAccountOrderByWithRelationInput = {
|
|||||||
inventoryBankAccounts?: Prisma.InventoryBankAccountOrderByRelationAggregateInput
|
inventoryBankAccounts?: Prisma.InventoryBankAccountOrderByRelationAggregateInput
|
||||||
purchaseReceiptPayments?: Prisma.PurchaseReceiptPaymentsOrderByRelationAggregateInput
|
purchaseReceiptPayments?: Prisma.PurchaseReceiptPaymentsOrderByRelationAggregateInput
|
||||||
bankAccountTransactions?: Prisma.BankAccountTransactionOrderByRelationAggregateInput
|
bankAccountTransactions?: Prisma.BankAccountTransactionOrderByRelationAggregateInput
|
||||||
bankAccountBalances?: Prisma.BankAccountBalanceOrderByRelationAggregateInput
|
|
||||||
_relevance?: Prisma.BankAccountOrderByRelevanceInput
|
_relevance?: Prisma.BankAccountOrderByRelevanceInput
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -294,7 +292,6 @@ export type BankAccountWhereUniqueInput = Prisma.AtLeast<{
|
|||||||
inventoryBankAccounts?: Prisma.InventoryBankAccountListRelationFilter
|
inventoryBankAccounts?: Prisma.InventoryBankAccountListRelationFilter
|
||||||
purchaseReceiptPayments?: Prisma.PurchaseReceiptPaymentsListRelationFilter
|
purchaseReceiptPayments?: Prisma.PurchaseReceiptPaymentsListRelationFilter
|
||||||
bankAccountTransactions?: Prisma.BankAccountTransactionListRelationFilter
|
bankAccountTransactions?: Prisma.BankAccountTransactionListRelationFilter
|
||||||
bankAccountBalances?: Prisma.BankAccountBalanceListRelationFilter
|
|
||||||
}, "id" | "accountNumber" | "cardNumber" | "iban">
|
}, "id" | "accountNumber" | "cardNumber" | "iban">
|
||||||
|
|
||||||
export type BankAccountOrderByWithAggregationInput = {
|
export type BankAccountOrderByWithAggregationInput = {
|
||||||
@@ -341,7 +338,6 @@ export type BankAccountCreateInput = {
|
|||||||
inventoryBankAccounts?: Prisma.InventoryBankAccountCreateNestedManyWithoutBankAccountInput
|
inventoryBankAccounts?: Prisma.InventoryBankAccountCreateNestedManyWithoutBankAccountInput
|
||||||
purchaseReceiptPayments?: Prisma.PurchaseReceiptPaymentsCreateNestedManyWithoutBankAccountInput
|
purchaseReceiptPayments?: Prisma.PurchaseReceiptPaymentsCreateNestedManyWithoutBankAccountInput
|
||||||
bankAccountTransactions?: Prisma.BankAccountTransactionCreateNestedManyWithoutBankAccountInput
|
bankAccountTransactions?: Prisma.BankAccountTransactionCreateNestedManyWithoutBankAccountInput
|
||||||
bankAccountBalances?: Prisma.BankAccountBalanceCreateNestedManyWithoutBankAccountInput
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export type BankAccountUncheckedCreateInput = {
|
export type BankAccountUncheckedCreateInput = {
|
||||||
@@ -357,7 +353,6 @@ export type BankAccountUncheckedCreateInput = {
|
|||||||
inventoryBankAccounts?: Prisma.InventoryBankAccountUncheckedCreateNestedManyWithoutBankAccountInput
|
inventoryBankAccounts?: Prisma.InventoryBankAccountUncheckedCreateNestedManyWithoutBankAccountInput
|
||||||
purchaseReceiptPayments?: Prisma.PurchaseReceiptPaymentsUncheckedCreateNestedManyWithoutBankAccountInput
|
purchaseReceiptPayments?: Prisma.PurchaseReceiptPaymentsUncheckedCreateNestedManyWithoutBankAccountInput
|
||||||
bankAccountTransactions?: Prisma.BankAccountTransactionUncheckedCreateNestedManyWithoutBankAccountInput
|
bankAccountTransactions?: Prisma.BankAccountTransactionUncheckedCreateNestedManyWithoutBankAccountInput
|
||||||
bankAccountBalances?: Prisma.BankAccountBalanceUncheckedCreateNestedManyWithoutBankAccountInput
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export type BankAccountUpdateInput = {
|
export type BankAccountUpdateInput = {
|
||||||
@@ -372,7 +367,6 @@ export type BankAccountUpdateInput = {
|
|||||||
inventoryBankAccounts?: Prisma.InventoryBankAccountUpdateManyWithoutBankAccountNestedInput
|
inventoryBankAccounts?: Prisma.InventoryBankAccountUpdateManyWithoutBankAccountNestedInput
|
||||||
purchaseReceiptPayments?: Prisma.PurchaseReceiptPaymentsUpdateManyWithoutBankAccountNestedInput
|
purchaseReceiptPayments?: Prisma.PurchaseReceiptPaymentsUpdateManyWithoutBankAccountNestedInput
|
||||||
bankAccountTransactions?: Prisma.BankAccountTransactionUpdateManyWithoutBankAccountNestedInput
|
bankAccountTransactions?: Prisma.BankAccountTransactionUpdateManyWithoutBankAccountNestedInput
|
||||||
bankAccountBalances?: Prisma.BankAccountBalanceUpdateManyWithoutBankAccountNestedInput
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export type BankAccountUncheckedUpdateInput = {
|
export type BankAccountUncheckedUpdateInput = {
|
||||||
@@ -388,7 +382,6 @@ export type BankAccountUncheckedUpdateInput = {
|
|||||||
inventoryBankAccounts?: Prisma.InventoryBankAccountUncheckedUpdateManyWithoutBankAccountNestedInput
|
inventoryBankAccounts?: Prisma.InventoryBankAccountUncheckedUpdateManyWithoutBankAccountNestedInput
|
||||||
purchaseReceiptPayments?: Prisma.PurchaseReceiptPaymentsUncheckedUpdateManyWithoutBankAccountNestedInput
|
purchaseReceiptPayments?: Prisma.PurchaseReceiptPaymentsUncheckedUpdateManyWithoutBankAccountNestedInput
|
||||||
bankAccountTransactions?: Prisma.BankAccountTransactionUncheckedUpdateManyWithoutBankAccountNestedInput
|
bankAccountTransactions?: Prisma.BankAccountTransactionUncheckedUpdateManyWithoutBankAccountNestedInput
|
||||||
bankAccountBalances?: Prisma.BankAccountBalanceUncheckedUpdateManyWithoutBankAccountNestedInput
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export type BankAccountCreateManyInput = {
|
export type BankAccountCreateManyInput = {
|
||||||
@@ -548,20 +541,6 @@ export type BankAccountUpdateOneRequiredWithoutBankAccountTransactionsNestedInpu
|
|||||||
update?: Prisma.XOR<Prisma.XOR<Prisma.BankAccountUpdateToOneWithWhereWithoutBankAccountTransactionsInput, Prisma.BankAccountUpdateWithoutBankAccountTransactionsInput>, Prisma.BankAccountUncheckedUpdateWithoutBankAccountTransactionsInput>
|
update?: Prisma.XOR<Prisma.XOR<Prisma.BankAccountUpdateToOneWithWhereWithoutBankAccountTransactionsInput, Prisma.BankAccountUpdateWithoutBankAccountTransactionsInput>, Prisma.BankAccountUncheckedUpdateWithoutBankAccountTransactionsInput>
|
||||||
}
|
}
|
||||||
|
|
||||||
export type BankAccountCreateNestedOneWithoutBankAccountBalancesInput = {
|
|
||||||
create?: Prisma.XOR<Prisma.BankAccountCreateWithoutBankAccountBalancesInput, Prisma.BankAccountUncheckedCreateWithoutBankAccountBalancesInput>
|
|
||||||
connectOrCreate?: Prisma.BankAccountCreateOrConnectWithoutBankAccountBalancesInput
|
|
||||||
connect?: Prisma.BankAccountWhereUniqueInput
|
|
||||||
}
|
|
||||||
|
|
||||||
export type BankAccountUpdateOneRequiredWithoutBankAccountBalancesNestedInput = {
|
|
||||||
create?: Prisma.XOR<Prisma.BankAccountCreateWithoutBankAccountBalancesInput, Prisma.BankAccountUncheckedCreateWithoutBankAccountBalancesInput>
|
|
||||||
connectOrCreate?: Prisma.BankAccountCreateOrConnectWithoutBankAccountBalancesInput
|
|
||||||
upsert?: Prisma.BankAccountUpsertWithoutBankAccountBalancesInput
|
|
||||||
connect?: Prisma.BankAccountWhereUniqueInput
|
|
||||||
update?: Prisma.XOR<Prisma.XOR<Prisma.BankAccountUpdateToOneWithWhereWithoutBankAccountBalancesInput, Prisma.BankAccountUpdateWithoutBankAccountBalancesInput>, Prisma.BankAccountUncheckedUpdateWithoutBankAccountBalancesInput>
|
|
||||||
}
|
|
||||||
|
|
||||||
export type BankAccountCreateNestedOneWithoutInventoryBankAccountsInput = {
|
export type BankAccountCreateNestedOneWithoutInventoryBankAccountsInput = {
|
||||||
create?: Prisma.XOR<Prisma.BankAccountCreateWithoutInventoryBankAccountsInput, Prisma.BankAccountUncheckedCreateWithoutInventoryBankAccountsInput>
|
create?: Prisma.XOR<Prisma.BankAccountCreateWithoutInventoryBankAccountsInput, Prisma.BankAccountUncheckedCreateWithoutInventoryBankAccountsInput>
|
||||||
connectOrCreate?: Prisma.BankAccountCreateOrConnectWithoutInventoryBankAccountsInput
|
connectOrCreate?: Prisma.BankAccountCreateOrConnectWithoutInventoryBankAccountsInput
|
||||||
@@ -601,7 +580,6 @@ export type BankAccountCreateWithoutBranchInput = {
|
|||||||
inventoryBankAccounts?: Prisma.InventoryBankAccountCreateNestedManyWithoutBankAccountInput
|
inventoryBankAccounts?: Prisma.InventoryBankAccountCreateNestedManyWithoutBankAccountInput
|
||||||
purchaseReceiptPayments?: Prisma.PurchaseReceiptPaymentsCreateNestedManyWithoutBankAccountInput
|
purchaseReceiptPayments?: Prisma.PurchaseReceiptPaymentsCreateNestedManyWithoutBankAccountInput
|
||||||
bankAccountTransactions?: Prisma.BankAccountTransactionCreateNestedManyWithoutBankAccountInput
|
bankAccountTransactions?: Prisma.BankAccountTransactionCreateNestedManyWithoutBankAccountInput
|
||||||
bankAccountBalances?: Prisma.BankAccountBalanceCreateNestedManyWithoutBankAccountInput
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export type BankAccountUncheckedCreateWithoutBranchInput = {
|
export type BankAccountUncheckedCreateWithoutBranchInput = {
|
||||||
@@ -616,7 +594,6 @@ export type BankAccountUncheckedCreateWithoutBranchInput = {
|
|||||||
inventoryBankAccounts?: Prisma.InventoryBankAccountUncheckedCreateNestedManyWithoutBankAccountInput
|
inventoryBankAccounts?: Prisma.InventoryBankAccountUncheckedCreateNestedManyWithoutBankAccountInput
|
||||||
purchaseReceiptPayments?: Prisma.PurchaseReceiptPaymentsUncheckedCreateNestedManyWithoutBankAccountInput
|
purchaseReceiptPayments?: Prisma.PurchaseReceiptPaymentsUncheckedCreateNestedManyWithoutBankAccountInput
|
||||||
bankAccountTransactions?: Prisma.BankAccountTransactionUncheckedCreateNestedManyWithoutBankAccountInput
|
bankAccountTransactions?: Prisma.BankAccountTransactionUncheckedCreateNestedManyWithoutBankAccountInput
|
||||||
bankAccountBalances?: Prisma.BankAccountBalanceUncheckedCreateNestedManyWithoutBankAccountInput
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export type BankAccountCreateOrConnectWithoutBranchInput = {
|
export type BankAccountCreateOrConnectWithoutBranchInput = {
|
||||||
@@ -671,7 +648,6 @@ export type BankAccountCreateWithoutBankAccountTransactionsInput = {
|
|||||||
branch: Prisma.BankBranchCreateNestedOneWithoutBankAccountsInput
|
branch: Prisma.BankBranchCreateNestedOneWithoutBankAccountsInput
|
||||||
inventoryBankAccounts?: Prisma.InventoryBankAccountCreateNestedManyWithoutBankAccountInput
|
inventoryBankAccounts?: Prisma.InventoryBankAccountCreateNestedManyWithoutBankAccountInput
|
||||||
purchaseReceiptPayments?: Prisma.PurchaseReceiptPaymentsCreateNestedManyWithoutBankAccountInput
|
purchaseReceiptPayments?: Prisma.PurchaseReceiptPaymentsCreateNestedManyWithoutBankAccountInput
|
||||||
bankAccountBalances?: Prisma.BankAccountBalanceCreateNestedManyWithoutBankAccountInput
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export type BankAccountUncheckedCreateWithoutBankAccountTransactionsInput = {
|
export type BankAccountUncheckedCreateWithoutBankAccountTransactionsInput = {
|
||||||
@@ -686,7 +662,6 @@ export type BankAccountUncheckedCreateWithoutBankAccountTransactionsInput = {
|
|||||||
deletedAt?: Date | string | null
|
deletedAt?: Date | string | null
|
||||||
inventoryBankAccounts?: Prisma.InventoryBankAccountUncheckedCreateNestedManyWithoutBankAccountInput
|
inventoryBankAccounts?: Prisma.InventoryBankAccountUncheckedCreateNestedManyWithoutBankAccountInput
|
||||||
purchaseReceiptPayments?: Prisma.PurchaseReceiptPaymentsUncheckedCreateNestedManyWithoutBankAccountInput
|
purchaseReceiptPayments?: Prisma.PurchaseReceiptPaymentsUncheckedCreateNestedManyWithoutBankAccountInput
|
||||||
bankAccountBalances?: Prisma.BankAccountBalanceUncheckedCreateNestedManyWithoutBankAccountInput
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export type BankAccountCreateOrConnectWithoutBankAccountTransactionsInput = {
|
export type BankAccountCreateOrConnectWithoutBankAccountTransactionsInput = {
|
||||||
@@ -716,7 +691,6 @@ export type BankAccountUpdateWithoutBankAccountTransactionsInput = {
|
|||||||
branch?: Prisma.BankBranchUpdateOneRequiredWithoutBankAccountsNestedInput
|
branch?: Prisma.BankBranchUpdateOneRequiredWithoutBankAccountsNestedInput
|
||||||
inventoryBankAccounts?: Prisma.InventoryBankAccountUpdateManyWithoutBankAccountNestedInput
|
inventoryBankAccounts?: Prisma.InventoryBankAccountUpdateManyWithoutBankAccountNestedInput
|
||||||
purchaseReceiptPayments?: Prisma.PurchaseReceiptPaymentsUpdateManyWithoutBankAccountNestedInput
|
purchaseReceiptPayments?: Prisma.PurchaseReceiptPaymentsUpdateManyWithoutBankAccountNestedInput
|
||||||
bankAccountBalances?: Prisma.BankAccountBalanceUpdateManyWithoutBankAccountNestedInput
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export type BankAccountUncheckedUpdateWithoutBankAccountTransactionsInput = {
|
export type BankAccountUncheckedUpdateWithoutBankAccountTransactionsInput = {
|
||||||
@@ -731,81 +705,6 @@ export type BankAccountUncheckedUpdateWithoutBankAccountTransactionsInput = {
|
|||||||
deletedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null
|
deletedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null
|
||||||
inventoryBankAccounts?: Prisma.InventoryBankAccountUncheckedUpdateManyWithoutBankAccountNestedInput
|
inventoryBankAccounts?: Prisma.InventoryBankAccountUncheckedUpdateManyWithoutBankAccountNestedInput
|
||||||
purchaseReceiptPayments?: Prisma.PurchaseReceiptPaymentsUncheckedUpdateManyWithoutBankAccountNestedInput
|
purchaseReceiptPayments?: Prisma.PurchaseReceiptPaymentsUncheckedUpdateManyWithoutBankAccountNestedInput
|
||||||
bankAccountBalances?: Prisma.BankAccountBalanceUncheckedUpdateManyWithoutBankAccountNestedInput
|
|
||||||
}
|
|
||||||
|
|
||||||
export type BankAccountCreateWithoutBankAccountBalancesInput = {
|
|
||||||
accountNumber?: string | null
|
|
||||||
cardNumber?: string | null
|
|
||||||
name: string
|
|
||||||
iban?: string | null
|
|
||||||
createdAt?: Date | string
|
|
||||||
updatedAt?: Date | string
|
|
||||||
deletedAt?: Date | string | null
|
|
||||||
branch: Prisma.BankBranchCreateNestedOneWithoutBankAccountsInput
|
|
||||||
inventoryBankAccounts?: Prisma.InventoryBankAccountCreateNestedManyWithoutBankAccountInput
|
|
||||||
purchaseReceiptPayments?: Prisma.PurchaseReceiptPaymentsCreateNestedManyWithoutBankAccountInput
|
|
||||||
bankAccountTransactions?: Prisma.BankAccountTransactionCreateNestedManyWithoutBankAccountInput
|
|
||||||
}
|
|
||||||
|
|
||||||
export type BankAccountUncheckedCreateWithoutBankAccountBalancesInput = {
|
|
||||||
id?: number
|
|
||||||
accountNumber?: string | null
|
|
||||||
cardNumber?: string | null
|
|
||||||
name: string
|
|
||||||
iban?: string | null
|
|
||||||
branchId: number
|
|
||||||
createdAt?: Date | string
|
|
||||||
updatedAt?: Date | string
|
|
||||||
deletedAt?: Date | string | null
|
|
||||||
inventoryBankAccounts?: Prisma.InventoryBankAccountUncheckedCreateNestedManyWithoutBankAccountInput
|
|
||||||
purchaseReceiptPayments?: Prisma.PurchaseReceiptPaymentsUncheckedCreateNestedManyWithoutBankAccountInput
|
|
||||||
bankAccountTransactions?: Prisma.BankAccountTransactionUncheckedCreateNestedManyWithoutBankAccountInput
|
|
||||||
}
|
|
||||||
|
|
||||||
export type BankAccountCreateOrConnectWithoutBankAccountBalancesInput = {
|
|
||||||
where: Prisma.BankAccountWhereUniqueInput
|
|
||||||
create: Prisma.XOR<Prisma.BankAccountCreateWithoutBankAccountBalancesInput, Prisma.BankAccountUncheckedCreateWithoutBankAccountBalancesInput>
|
|
||||||
}
|
|
||||||
|
|
||||||
export type BankAccountUpsertWithoutBankAccountBalancesInput = {
|
|
||||||
update: Prisma.XOR<Prisma.BankAccountUpdateWithoutBankAccountBalancesInput, Prisma.BankAccountUncheckedUpdateWithoutBankAccountBalancesInput>
|
|
||||||
create: Prisma.XOR<Prisma.BankAccountCreateWithoutBankAccountBalancesInput, Prisma.BankAccountUncheckedCreateWithoutBankAccountBalancesInput>
|
|
||||||
where?: Prisma.BankAccountWhereInput
|
|
||||||
}
|
|
||||||
|
|
||||||
export type BankAccountUpdateToOneWithWhereWithoutBankAccountBalancesInput = {
|
|
||||||
where?: Prisma.BankAccountWhereInput
|
|
||||||
data: Prisma.XOR<Prisma.BankAccountUpdateWithoutBankAccountBalancesInput, Prisma.BankAccountUncheckedUpdateWithoutBankAccountBalancesInput>
|
|
||||||
}
|
|
||||||
|
|
||||||
export type BankAccountUpdateWithoutBankAccountBalancesInput = {
|
|
||||||
accountNumber?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
|
||||||
cardNumber?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
|
||||||
name?: Prisma.StringFieldUpdateOperationsInput | string
|
|
||||||
iban?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
|
||||||
createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
|
||||||
updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
|
||||||
deletedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null
|
|
||||||
branch?: Prisma.BankBranchUpdateOneRequiredWithoutBankAccountsNestedInput
|
|
||||||
inventoryBankAccounts?: Prisma.InventoryBankAccountUpdateManyWithoutBankAccountNestedInput
|
|
||||||
purchaseReceiptPayments?: Prisma.PurchaseReceiptPaymentsUpdateManyWithoutBankAccountNestedInput
|
|
||||||
bankAccountTransactions?: Prisma.BankAccountTransactionUpdateManyWithoutBankAccountNestedInput
|
|
||||||
}
|
|
||||||
|
|
||||||
export type BankAccountUncheckedUpdateWithoutBankAccountBalancesInput = {
|
|
||||||
id?: Prisma.IntFieldUpdateOperationsInput | number
|
|
||||||
accountNumber?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
|
||||||
cardNumber?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
|
||||||
name?: Prisma.StringFieldUpdateOperationsInput | string
|
|
||||||
iban?: Prisma.NullableStringFieldUpdateOperationsInput | string | null
|
|
||||||
branchId?: Prisma.IntFieldUpdateOperationsInput | number
|
|
||||||
createdAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
|
||||||
updatedAt?: Prisma.DateTimeFieldUpdateOperationsInput | Date | string
|
|
||||||
deletedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null
|
|
||||||
inventoryBankAccounts?: Prisma.InventoryBankAccountUncheckedUpdateManyWithoutBankAccountNestedInput
|
|
||||||
purchaseReceiptPayments?: Prisma.PurchaseReceiptPaymentsUncheckedUpdateManyWithoutBankAccountNestedInput
|
|
||||||
bankAccountTransactions?: Prisma.BankAccountTransactionUncheckedUpdateManyWithoutBankAccountNestedInput
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export type BankAccountCreateWithoutInventoryBankAccountsInput = {
|
export type BankAccountCreateWithoutInventoryBankAccountsInput = {
|
||||||
@@ -819,7 +718,6 @@ export type BankAccountCreateWithoutInventoryBankAccountsInput = {
|
|||||||
branch: Prisma.BankBranchCreateNestedOneWithoutBankAccountsInput
|
branch: Prisma.BankBranchCreateNestedOneWithoutBankAccountsInput
|
||||||
purchaseReceiptPayments?: Prisma.PurchaseReceiptPaymentsCreateNestedManyWithoutBankAccountInput
|
purchaseReceiptPayments?: Prisma.PurchaseReceiptPaymentsCreateNestedManyWithoutBankAccountInput
|
||||||
bankAccountTransactions?: Prisma.BankAccountTransactionCreateNestedManyWithoutBankAccountInput
|
bankAccountTransactions?: Prisma.BankAccountTransactionCreateNestedManyWithoutBankAccountInput
|
||||||
bankAccountBalances?: Prisma.BankAccountBalanceCreateNestedManyWithoutBankAccountInput
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export type BankAccountUncheckedCreateWithoutInventoryBankAccountsInput = {
|
export type BankAccountUncheckedCreateWithoutInventoryBankAccountsInput = {
|
||||||
@@ -834,7 +732,6 @@ export type BankAccountUncheckedCreateWithoutInventoryBankAccountsInput = {
|
|||||||
deletedAt?: Date | string | null
|
deletedAt?: Date | string | null
|
||||||
purchaseReceiptPayments?: Prisma.PurchaseReceiptPaymentsUncheckedCreateNestedManyWithoutBankAccountInput
|
purchaseReceiptPayments?: Prisma.PurchaseReceiptPaymentsUncheckedCreateNestedManyWithoutBankAccountInput
|
||||||
bankAccountTransactions?: Prisma.BankAccountTransactionUncheckedCreateNestedManyWithoutBankAccountInput
|
bankAccountTransactions?: Prisma.BankAccountTransactionUncheckedCreateNestedManyWithoutBankAccountInput
|
||||||
bankAccountBalances?: Prisma.BankAccountBalanceUncheckedCreateNestedManyWithoutBankAccountInput
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export type BankAccountCreateOrConnectWithoutInventoryBankAccountsInput = {
|
export type BankAccountCreateOrConnectWithoutInventoryBankAccountsInput = {
|
||||||
@@ -864,7 +761,6 @@ export type BankAccountUpdateWithoutInventoryBankAccountsInput = {
|
|||||||
branch?: Prisma.BankBranchUpdateOneRequiredWithoutBankAccountsNestedInput
|
branch?: Prisma.BankBranchUpdateOneRequiredWithoutBankAccountsNestedInput
|
||||||
purchaseReceiptPayments?: Prisma.PurchaseReceiptPaymentsUpdateManyWithoutBankAccountNestedInput
|
purchaseReceiptPayments?: Prisma.PurchaseReceiptPaymentsUpdateManyWithoutBankAccountNestedInput
|
||||||
bankAccountTransactions?: Prisma.BankAccountTransactionUpdateManyWithoutBankAccountNestedInput
|
bankAccountTransactions?: Prisma.BankAccountTransactionUpdateManyWithoutBankAccountNestedInput
|
||||||
bankAccountBalances?: Prisma.BankAccountBalanceUpdateManyWithoutBankAccountNestedInput
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export type BankAccountUncheckedUpdateWithoutInventoryBankAccountsInput = {
|
export type BankAccountUncheckedUpdateWithoutInventoryBankAccountsInput = {
|
||||||
@@ -879,7 +775,6 @@ export type BankAccountUncheckedUpdateWithoutInventoryBankAccountsInput = {
|
|||||||
deletedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null
|
deletedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null
|
||||||
purchaseReceiptPayments?: Prisma.PurchaseReceiptPaymentsUncheckedUpdateManyWithoutBankAccountNestedInput
|
purchaseReceiptPayments?: Prisma.PurchaseReceiptPaymentsUncheckedUpdateManyWithoutBankAccountNestedInput
|
||||||
bankAccountTransactions?: Prisma.BankAccountTransactionUncheckedUpdateManyWithoutBankAccountNestedInput
|
bankAccountTransactions?: Prisma.BankAccountTransactionUncheckedUpdateManyWithoutBankAccountNestedInput
|
||||||
bankAccountBalances?: Prisma.BankAccountBalanceUncheckedUpdateManyWithoutBankAccountNestedInput
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export type BankAccountCreateWithoutPurchaseReceiptPaymentsInput = {
|
export type BankAccountCreateWithoutPurchaseReceiptPaymentsInput = {
|
||||||
@@ -893,7 +788,6 @@ export type BankAccountCreateWithoutPurchaseReceiptPaymentsInput = {
|
|||||||
branch: Prisma.BankBranchCreateNestedOneWithoutBankAccountsInput
|
branch: Prisma.BankBranchCreateNestedOneWithoutBankAccountsInput
|
||||||
inventoryBankAccounts?: Prisma.InventoryBankAccountCreateNestedManyWithoutBankAccountInput
|
inventoryBankAccounts?: Prisma.InventoryBankAccountCreateNestedManyWithoutBankAccountInput
|
||||||
bankAccountTransactions?: Prisma.BankAccountTransactionCreateNestedManyWithoutBankAccountInput
|
bankAccountTransactions?: Prisma.BankAccountTransactionCreateNestedManyWithoutBankAccountInput
|
||||||
bankAccountBalances?: Prisma.BankAccountBalanceCreateNestedManyWithoutBankAccountInput
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export type BankAccountUncheckedCreateWithoutPurchaseReceiptPaymentsInput = {
|
export type BankAccountUncheckedCreateWithoutPurchaseReceiptPaymentsInput = {
|
||||||
@@ -908,7 +802,6 @@ export type BankAccountUncheckedCreateWithoutPurchaseReceiptPaymentsInput = {
|
|||||||
deletedAt?: Date | string | null
|
deletedAt?: Date | string | null
|
||||||
inventoryBankAccounts?: Prisma.InventoryBankAccountUncheckedCreateNestedManyWithoutBankAccountInput
|
inventoryBankAccounts?: Prisma.InventoryBankAccountUncheckedCreateNestedManyWithoutBankAccountInput
|
||||||
bankAccountTransactions?: Prisma.BankAccountTransactionUncheckedCreateNestedManyWithoutBankAccountInput
|
bankAccountTransactions?: Prisma.BankAccountTransactionUncheckedCreateNestedManyWithoutBankAccountInput
|
||||||
bankAccountBalances?: Prisma.BankAccountBalanceUncheckedCreateNestedManyWithoutBankAccountInput
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export type BankAccountCreateOrConnectWithoutPurchaseReceiptPaymentsInput = {
|
export type BankAccountCreateOrConnectWithoutPurchaseReceiptPaymentsInput = {
|
||||||
@@ -938,7 +831,6 @@ export type BankAccountUpdateWithoutPurchaseReceiptPaymentsInput = {
|
|||||||
branch?: Prisma.BankBranchUpdateOneRequiredWithoutBankAccountsNestedInput
|
branch?: Prisma.BankBranchUpdateOneRequiredWithoutBankAccountsNestedInput
|
||||||
inventoryBankAccounts?: Prisma.InventoryBankAccountUpdateManyWithoutBankAccountNestedInput
|
inventoryBankAccounts?: Prisma.InventoryBankAccountUpdateManyWithoutBankAccountNestedInput
|
||||||
bankAccountTransactions?: Prisma.BankAccountTransactionUpdateManyWithoutBankAccountNestedInput
|
bankAccountTransactions?: Prisma.BankAccountTransactionUpdateManyWithoutBankAccountNestedInput
|
||||||
bankAccountBalances?: Prisma.BankAccountBalanceUpdateManyWithoutBankAccountNestedInput
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export type BankAccountUncheckedUpdateWithoutPurchaseReceiptPaymentsInput = {
|
export type BankAccountUncheckedUpdateWithoutPurchaseReceiptPaymentsInput = {
|
||||||
@@ -953,7 +845,6 @@ export type BankAccountUncheckedUpdateWithoutPurchaseReceiptPaymentsInput = {
|
|||||||
deletedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null
|
deletedAt?: Prisma.NullableDateTimeFieldUpdateOperationsInput | Date | string | null
|
||||||
inventoryBankAccounts?: Prisma.InventoryBankAccountUncheckedUpdateManyWithoutBankAccountNestedInput
|
inventoryBankAccounts?: Prisma.InventoryBankAccountUncheckedUpdateManyWithoutBankAccountNestedInput
|
||||||
bankAccountTransactions?: Prisma.BankAccountTransactionUncheckedUpdateManyWithoutBankAccountNestedInput
|
bankAccountTransactions?: Prisma.BankAccountTransactionUncheckedUpdateManyWithoutBankAccountNestedInput
|
||||||
bankAccountBalances?: Prisma.BankAccountBalanceUncheckedUpdateManyWithoutBankAccountNestedInput
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export type BankAccountCreateManyBranchInput = {
|
export type BankAccountCreateManyBranchInput = {
|
||||||
@@ -978,7 +869,6 @@ export type BankAccountUpdateWithoutBranchInput = {
|
|||||||
inventoryBankAccounts?: Prisma.InventoryBankAccountUpdateManyWithoutBankAccountNestedInput
|
inventoryBankAccounts?: Prisma.InventoryBankAccountUpdateManyWithoutBankAccountNestedInput
|
||||||
purchaseReceiptPayments?: Prisma.PurchaseReceiptPaymentsUpdateManyWithoutBankAccountNestedInput
|
purchaseReceiptPayments?: Prisma.PurchaseReceiptPaymentsUpdateManyWithoutBankAccountNestedInput
|
||||||
bankAccountTransactions?: Prisma.BankAccountTransactionUpdateManyWithoutBankAccountNestedInput
|
bankAccountTransactions?: Prisma.BankAccountTransactionUpdateManyWithoutBankAccountNestedInput
|
||||||
bankAccountBalances?: Prisma.BankAccountBalanceUpdateManyWithoutBankAccountNestedInput
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export type BankAccountUncheckedUpdateWithoutBranchInput = {
|
export type BankAccountUncheckedUpdateWithoutBranchInput = {
|
||||||
@@ -993,7 +883,6 @@ export type BankAccountUncheckedUpdateWithoutBranchInput = {
|
|||||||
inventoryBankAccounts?: Prisma.InventoryBankAccountUncheckedUpdateManyWithoutBankAccountNestedInput
|
inventoryBankAccounts?: Prisma.InventoryBankAccountUncheckedUpdateManyWithoutBankAccountNestedInput
|
||||||
purchaseReceiptPayments?: Prisma.PurchaseReceiptPaymentsUncheckedUpdateManyWithoutBankAccountNestedInput
|
purchaseReceiptPayments?: Prisma.PurchaseReceiptPaymentsUncheckedUpdateManyWithoutBankAccountNestedInput
|
||||||
bankAccountTransactions?: Prisma.BankAccountTransactionUncheckedUpdateManyWithoutBankAccountNestedInput
|
bankAccountTransactions?: Prisma.BankAccountTransactionUncheckedUpdateManyWithoutBankAccountNestedInput
|
||||||
bankAccountBalances?: Prisma.BankAccountBalanceUncheckedUpdateManyWithoutBankAccountNestedInput
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export type BankAccountUncheckedUpdateManyWithoutBranchInput = {
|
export type BankAccountUncheckedUpdateManyWithoutBranchInput = {
|
||||||
@@ -1016,14 +905,12 @@ export type BankAccountCountOutputType = {
|
|||||||
inventoryBankAccounts: number
|
inventoryBankAccounts: number
|
||||||
purchaseReceiptPayments: number
|
purchaseReceiptPayments: number
|
||||||
bankAccountTransactions: number
|
bankAccountTransactions: number
|
||||||
bankAccountBalances: number
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export type BankAccountCountOutputTypeSelect<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = {
|
export type BankAccountCountOutputTypeSelect<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = {
|
||||||
inventoryBankAccounts?: boolean | BankAccountCountOutputTypeCountInventoryBankAccountsArgs
|
inventoryBankAccounts?: boolean | BankAccountCountOutputTypeCountInventoryBankAccountsArgs
|
||||||
purchaseReceiptPayments?: boolean | BankAccountCountOutputTypeCountPurchaseReceiptPaymentsArgs
|
purchaseReceiptPayments?: boolean | BankAccountCountOutputTypeCountPurchaseReceiptPaymentsArgs
|
||||||
bankAccountTransactions?: boolean | BankAccountCountOutputTypeCountBankAccountTransactionsArgs
|
bankAccountTransactions?: boolean | BankAccountCountOutputTypeCountBankAccountTransactionsArgs
|
||||||
bankAccountBalances?: boolean | BankAccountCountOutputTypeCountBankAccountBalancesArgs
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -1057,13 +944,6 @@ export type BankAccountCountOutputTypeCountBankAccountTransactionsArgs<ExtArgs e
|
|||||||
where?: Prisma.BankAccountTransactionWhereInput
|
where?: Prisma.BankAccountTransactionWhereInput
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* BankAccountCountOutputType without action
|
|
||||||
*/
|
|
||||||
export type BankAccountCountOutputTypeCountBankAccountBalancesArgs<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = {
|
|
||||||
where?: Prisma.BankAccountBalanceWhereInput
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
export type BankAccountSelect<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = runtime.Types.Extensions.GetSelect<{
|
export type BankAccountSelect<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = runtime.Types.Extensions.GetSelect<{
|
||||||
id?: boolean
|
id?: boolean
|
||||||
@@ -1079,7 +959,6 @@ export type BankAccountSelect<ExtArgs extends runtime.Types.Extensions.InternalA
|
|||||||
inventoryBankAccounts?: boolean | Prisma.BankAccount$inventoryBankAccountsArgs<ExtArgs>
|
inventoryBankAccounts?: boolean | Prisma.BankAccount$inventoryBankAccountsArgs<ExtArgs>
|
||||||
purchaseReceiptPayments?: boolean | Prisma.BankAccount$purchaseReceiptPaymentsArgs<ExtArgs>
|
purchaseReceiptPayments?: boolean | Prisma.BankAccount$purchaseReceiptPaymentsArgs<ExtArgs>
|
||||||
bankAccountTransactions?: boolean | Prisma.BankAccount$bankAccountTransactionsArgs<ExtArgs>
|
bankAccountTransactions?: boolean | Prisma.BankAccount$bankAccountTransactionsArgs<ExtArgs>
|
||||||
bankAccountBalances?: boolean | Prisma.BankAccount$bankAccountBalancesArgs<ExtArgs>
|
|
||||||
_count?: boolean | Prisma.BankAccountCountOutputTypeDefaultArgs<ExtArgs>
|
_count?: boolean | Prisma.BankAccountCountOutputTypeDefaultArgs<ExtArgs>
|
||||||
}, ExtArgs["result"]["bankAccount"]>
|
}, ExtArgs["result"]["bankAccount"]>
|
||||||
|
|
||||||
@@ -1103,7 +982,6 @@ export type BankAccountInclude<ExtArgs extends runtime.Types.Extensions.Internal
|
|||||||
inventoryBankAccounts?: boolean | Prisma.BankAccount$inventoryBankAccountsArgs<ExtArgs>
|
inventoryBankAccounts?: boolean | Prisma.BankAccount$inventoryBankAccountsArgs<ExtArgs>
|
||||||
purchaseReceiptPayments?: boolean | Prisma.BankAccount$purchaseReceiptPaymentsArgs<ExtArgs>
|
purchaseReceiptPayments?: boolean | Prisma.BankAccount$purchaseReceiptPaymentsArgs<ExtArgs>
|
||||||
bankAccountTransactions?: boolean | Prisma.BankAccount$bankAccountTransactionsArgs<ExtArgs>
|
bankAccountTransactions?: boolean | Prisma.BankAccount$bankAccountTransactionsArgs<ExtArgs>
|
||||||
bankAccountBalances?: boolean | Prisma.BankAccount$bankAccountBalancesArgs<ExtArgs>
|
|
||||||
_count?: boolean | Prisma.BankAccountCountOutputTypeDefaultArgs<ExtArgs>
|
_count?: boolean | Prisma.BankAccountCountOutputTypeDefaultArgs<ExtArgs>
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1114,7 +992,6 @@ export type $BankAccountPayload<ExtArgs extends runtime.Types.Extensions.Interna
|
|||||||
inventoryBankAccounts: Prisma.$InventoryBankAccountPayload<ExtArgs>[]
|
inventoryBankAccounts: Prisma.$InventoryBankAccountPayload<ExtArgs>[]
|
||||||
purchaseReceiptPayments: Prisma.$PurchaseReceiptPaymentsPayload<ExtArgs>[]
|
purchaseReceiptPayments: Prisma.$PurchaseReceiptPaymentsPayload<ExtArgs>[]
|
||||||
bankAccountTransactions: Prisma.$BankAccountTransactionPayload<ExtArgs>[]
|
bankAccountTransactions: Prisma.$BankAccountTransactionPayload<ExtArgs>[]
|
||||||
bankAccountBalances: Prisma.$BankAccountBalancePayload<ExtArgs>[]
|
|
||||||
}
|
}
|
||||||
scalars: runtime.Types.Extensions.GetPayloadResult<{
|
scalars: runtime.Types.Extensions.GetPayloadResult<{
|
||||||
id: number
|
id: number
|
||||||
@@ -1470,7 +1347,6 @@ export interface Prisma__BankAccountClient<T, Null = never, ExtArgs extends runt
|
|||||||
inventoryBankAccounts<T extends Prisma.BankAccount$inventoryBankAccountsArgs<ExtArgs> = {}>(args?: Prisma.Subset<T, Prisma.BankAccount$inventoryBankAccountsArgs<ExtArgs>>): Prisma.PrismaPromise<runtime.Types.Result.GetResult<Prisma.$InventoryBankAccountPayload<ExtArgs>, T, "findMany", GlobalOmitOptions> | Null>
|
inventoryBankAccounts<T extends Prisma.BankAccount$inventoryBankAccountsArgs<ExtArgs> = {}>(args?: Prisma.Subset<T, Prisma.BankAccount$inventoryBankAccountsArgs<ExtArgs>>): Prisma.PrismaPromise<runtime.Types.Result.GetResult<Prisma.$InventoryBankAccountPayload<ExtArgs>, T, "findMany", GlobalOmitOptions> | Null>
|
||||||
purchaseReceiptPayments<T extends Prisma.BankAccount$purchaseReceiptPaymentsArgs<ExtArgs> = {}>(args?: Prisma.Subset<T, Prisma.BankAccount$purchaseReceiptPaymentsArgs<ExtArgs>>): Prisma.PrismaPromise<runtime.Types.Result.GetResult<Prisma.$PurchaseReceiptPaymentsPayload<ExtArgs>, T, "findMany", GlobalOmitOptions> | Null>
|
purchaseReceiptPayments<T extends Prisma.BankAccount$purchaseReceiptPaymentsArgs<ExtArgs> = {}>(args?: Prisma.Subset<T, Prisma.BankAccount$purchaseReceiptPaymentsArgs<ExtArgs>>): Prisma.PrismaPromise<runtime.Types.Result.GetResult<Prisma.$PurchaseReceiptPaymentsPayload<ExtArgs>, T, "findMany", GlobalOmitOptions> | Null>
|
||||||
bankAccountTransactions<T extends Prisma.BankAccount$bankAccountTransactionsArgs<ExtArgs> = {}>(args?: Prisma.Subset<T, Prisma.BankAccount$bankAccountTransactionsArgs<ExtArgs>>): Prisma.PrismaPromise<runtime.Types.Result.GetResult<Prisma.$BankAccountTransactionPayload<ExtArgs>, T, "findMany", GlobalOmitOptions> | Null>
|
bankAccountTransactions<T extends Prisma.BankAccount$bankAccountTransactionsArgs<ExtArgs> = {}>(args?: Prisma.Subset<T, Prisma.BankAccount$bankAccountTransactionsArgs<ExtArgs>>): Prisma.PrismaPromise<runtime.Types.Result.GetResult<Prisma.$BankAccountTransactionPayload<ExtArgs>, T, "findMany", GlobalOmitOptions> | Null>
|
||||||
bankAccountBalances<T extends Prisma.BankAccount$bankAccountBalancesArgs<ExtArgs> = {}>(args?: Prisma.Subset<T, Prisma.BankAccount$bankAccountBalancesArgs<ExtArgs>>): Prisma.PrismaPromise<runtime.Types.Result.GetResult<Prisma.$BankAccountBalancePayload<ExtArgs>, T, "findMany", GlobalOmitOptions> | Null>
|
|
||||||
/**
|
/**
|
||||||
* Attaches callbacks for the resolution and/or rejection of the Promise.
|
* Attaches callbacks for the resolution and/or rejection of the Promise.
|
||||||
* @param onfulfilled The callback to execute when the Promise is resolved.
|
* @param onfulfilled The callback to execute when the Promise is resolved.
|
||||||
@@ -1923,30 +1799,6 @@ export type BankAccount$bankAccountTransactionsArgs<ExtArgs extends runtime.Type
|
|||||||
distinct?: Prisma.BankAccountTransactionScalarFieldEnum | Prisma.BankAccountTransactionScalarFieldEnum[]
|
distinct?: Prisma.BankAccountTransactionScalarFieldEnum | Prisma.BankAccountTransactionScalarFieldEnum[]
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* BankAccount.bankAccountBalances
|
|
||||||
*/
|
|
||||||
export type BankAccount$bankAccountBalancesArgs<ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = {
|
|
||||||
/**
|
|
||||||
* Select specific fields to fetch from the BankAccountBalance
|
|
||||||
*/
|
|
||||||
select?: Prisma.BankAccountBalanceSelect<ExtArgs> | null
|
|
||||||
/**
|
|
||||||
* Omit specific fields from the BankAccountBalance
|
|
||||||
*/
|
|
||||||
omit?: Prisma.BankAccountBalanceOmit<ExtArgs> | null
|
|
||||||
/**
|
|
||||||
* Choose, which related nodes to fetch as well
|
|
||||||
*/
|
|
||||||
include?: Prisma.BankAccountBalanceInclude<ExtArgs> | null
|
|
||||||
where?: Prisma.BankAccountBalanceWhereInput
|
|
||||||
orderBy?: Prisma.BankAccountBalanceOrderByWithRelationInput | Prisma.BankAccountBalanceOrderByWithRelationInput[]
|
|
||||||
cursor?: Prisma.BankAccountBalanceWhereUniqueInput
|
|
||||||
take?: number
|
|
||||||
skip?: number
|
|
||||||
distinct?: Prisma.BankAccountBalanceScalarFieldEnum | Prisma.BankAccountBalanceScalarFieldEnum[]
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* BankAccount without action
|
* BankAccount without action
|
||||||
*/
|
*/
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -31,4 +31,9 @@ export class BankAccountsController {
|
|||||||
remove(@Param('id') id: string) {
|
remove(@Param('id') id: string) {
|
||||||
return this.bankAccountsService.remove(Number(id))
|
return this.bankAccountsService.remove(Number(id))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Get(':id/transactions')
|
||||||
|
getTransactions(@Param('id') id: string) {
|
||||||
|
return this.bankAccountsService.getTransactions(Number(id))
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,26 +1,13 @@
|
|||||||
import { Injectable } from '@nestjs/common'
|
import { Injectable } from '@nestjs/common'
|
||||||
import { withTransaction } from '../../common/database/transaction.helper'
|
|
||||||
import { ResponseMapper } from '../../common/response/response-mapper'
|
import { ResponseMapper } from '../../common/response/response-mapper'
|
||||||
|
import { BankTransactionRefType } from '../../generated/prisma/enums'
|
||||||
import { PrismaService } from '../../prisma/prisma.service'
|
import { PrismaService } from '../../prisma/prisma.service'
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class BankAccountsService {
|
export class BankAccountsService {
|
||||||
constructor(private prisma: PrismaService) {}
|
constructor(private prisma: PrismaService) {}
|
||||||
async create(data: any) {
|
|
||||||
return withTransaction(this.prisma, async tx => {
|
|
||||||
const item = await tx.bankAccount.create({ data })
|
|
||||||
await tx.bankAccountBalance.create({
|
|
||||||
data: {
|
|
||||||
bankAccountId: item.id,
|
|
||||||
balance: 0,
|
|
||||||
},
|
|
||||||
})
|
|
||||||
return ResponseMapper.create(item)
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
async findAll() {
|
private readonly bankAccountQuery = {
|
||||||
const items = await this.prisma.bankAccount.findMany({
|
|
||||||
include: {
|
include: {
|
||||||
branch: {
|
branch: {
|
||||||
select: {
|
select: {
|
||||||
@@ -32,18 +19,43 @@ export class BankAccountsService {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
bankAccountTransactions: {
|
||||||
|
take: 1,
|
||||||
|
select: { id: true, createdAt: true, balanceAfter: true },
|
||||||
|
orderBy: { createdAt: 'desc' as const },
|
||||||
|
},
|
||||||
},
|
},
|
||||||
omit: {
|
omit: {
|
||||||
branchId: true,
|
branchId: true,
|
||||||
},
|
},
|
||||||
})
|
}
|
||||||
return ResponseMapper.list(items)
|
|
||||||
|
async create(data: any) {
|
||||||
|
const item = await this.prisma.bankAccount.create({ data })
|
||||||
|
return ResponseMapper.create(item)
|
||||||
|
}
|
||||||
|
|
||||||
|
async findAll() {
|
||||||
|
const items = await this.prisma.bankAccount.findMany(this.bankAccountQuery)
|
||||||
|
const mappedData = items.map(({ bankAccountTransactions, ...rest }) => ({
|
||||||
|
...rest,
|
||||||
|
currentBalance: Number(bankAccountTransactions[0]?.balanceAfter || 0),
|
||||||
|
}))
|
||||||
|
|
||||||
|
return ResponseMapper.list(mappedData)
|
||||||
}
|
}
|
||||||
|
|
||||||
async findOne(id: number) {
|
async findOne(id: number) {
|
||||||
const item = await this.prisma.bankAccount.findUnique({ where: { id } })
|
const item = await this.prisma.bankAccount.findUniqueOrThrow({
|
||||||
if (!item) return null
|
...this.bankAccountQuery,
|
||||||
return ResponseMapper.single(item)
|
where: { id },
|
||||||
|
})
|
||||||
|
|
||||||
|
const { bankAccountTransactions, ...rest } = item
|
||||||
|
return ResponseMapper.single({
|
||||||
|
...rest,
|
||||||
|
currentBalance: Number(bankAccountTransactions[0]?.balanceAfter || 0),
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
async update(id: number, data: any) {
|
async update(id: number, data: any) {
|
||||||
@@ -55,4 +67,87 @@ export class BankAccountsService {
|
|||||||
const item = await this.prisma.bankAccount.delete({ where: { id } })
|
const item = await this.prisma.bankAccount.delete({ where: { id } })
|
||||||
return ResponseMapper.single(item)
|
return ResponseMapper.single(item)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async getTransactions(bankAccountId: number, page = 1, pageSize = 50) {
|
||||||
|
const query = {
|
||||||
|
where: { bankAccountId },
|
||||||
|
orderBy: { createdAt: 'desc' as const },
|
||||||
|
skip: (page - 1) * pageSize,
|
||||||
|
take: pageSize,
|
||||||
|
}
|
||||||
|
|
||||||
|
const [items, count] = await this.prisma.$transaction([
|
||||||
|
this.prisma.bankAccountTransaction.findMany({
|
||||||
|
...query,
|
||||||
|
omit: { bankAccountId: true },
|
||||||
|
}),
|
||||||
|
this.prisma.bankAccountTransaction.count({ where: { bankAccountId } }),
|
||||||
|
])
|
||||||
|
|
||||||
|
const PosReferenceIds = [] as number[]
|
||||||
|
const purchaseReferenceIds = [] as number[]
|
||||||
|
|
||||||
|
items.forEach(({ referenceType, referenceId }) => {
|
||||||
|
if (referenceId && referenceType) {
|
||||||
|
if (
|
||||||
|
referenceType === BankTransactionRefType.POS_SALE ||
|
||||||
|
referenceType === BankTransactionRefType.POS_REFUND
|
||||||
|
) {
|
||||||
|
PosReferenceIds.push(referenceId)
|
||||||
|
} else if (
|
||||||
|
referenceType === BankTransactionRefType.PURCHASE_PAYMENT ||
|
||||||
|
referenceType === BankTransactionRefType.PURCHASE_REFUND
|
||||||
|
) {
|
||||||
|
purchaseReferenceIds.push(referenceId)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
const posRecords = await this.prisma.salesInvoice.findMany({
|
||||||
|
where: { id: { in: PosReferenceIds } },
|
||||||
|
select: {
|
||||||
|
id: true,
|
||||||
|
code: true,
|
||||||
|
totalAmount: true,
|
||||||
|
posAccount: {
|
||||||
|
select: { id: true, name: true },
|
||||||
|
},
|
||||||
|
customer: {
|
||||||
|
select: { id: true, firstName: true, lastName: true },
|
||||||
|
},
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
const purchaseRecords = await this.prisma.purchaseReceipt.findMany({
|
||||||
|
where: { id: { in: purchaseReferenceIds } },
|
||||||
|
select: {
|
||||||
|
id: true,
|
||||||
|
code: true,
|
||||||
|
totalAmount: true,
|
||||||
|
supplier: {
|
||||||
|
select: { id: true, firstName: true, lastName: true },
|
||||||
|
},
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
const mappedItems = items.map(tx => {
|
||||||
|
let reference = null as any
|
||||||
|
if (tx.referenceId && tx.referenceType) {
|
||||||
|
if (
|
||||||
|
tx.referenceType === BankTransactionRefType.POS_SALE ||
|
||||||
|
tx.referenceType === BankTransactionRefType.POS_REFUND
|
||||||
|
) {
|
||||||
|
reference = posRecords.find(r => r.id === tx.referenceId) || null
|
||||||
|
} else if (
|
||||||
|
tx.referenceType === BankTransactionRefType.PURCHASE_PAYMENT ||
|
||||||
|
tx.referenceType === BankTransactionRefType.PURCHASE_REFUND
|
||||||
|
) {
|
||||||
|
reference = purchaseRecords.find(r => r.id === tx.referenceId) || null
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return { ...tx, reference }
|
||||||
|
})
|
||||||
|
|
||||||
|
return ResponseMapper.paginate(mappedItems, count, page, pageSize)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,13 +8,13 @@ export class BankAccountsWorkflow {
|
|||||||
tx: Prisma.TransactionClient,
|
tx: Prisma.TransactionClient,
|
||||||
payload: AddTransactionToBankAccountDto,
|
payload: AddTransactionToBankAccountDto,
|
||||||
) {
|
) {
|
||||||
const item = await tx.bankAccountBalance.findUnique({
|
const item = await tx.bankAccountTransaction.findFirst({
|
||||||
where: {
|
where: {
|
||||||
bankAccountId: payload.bankAccountId,
|
bankAccountId: payload.bankAccountId,
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
const balance = item ? Number(item.balance) : 0
|
const balance = item ? Number(item?.balanceAfter) : 0
|
||||||
|
|
||||||
const newBalance = item
|
const newBalance = item
|
||||||
? payload.type === 'DEPOSIT'
|
? payload.type === 'DEPOSIT'
|
||||||
@@ -35,31 +35,5 @@ export class BankAccountsWorkflow {
|
|||||||
referenceType: payload.referenceType,
|
referenceType: payload.referenceType,
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
console.log('first')
|
|
||||||
|
|
||||||
const bankAccountBalanceItem = await tx.bankAccountBalance.findUnique({
|
|
||||||
where: {
|
|
||||||
bankAccountId: payload.bankAccountId,
|
|
||||||
},
|
|
||||||
})
|
|
||||||
|
|
||||||
if (!bankAccountBalanceItem) {
|
|
||||||
return await tx.bankAccountBalance.create({
|
|
||||||
data: {
|
|
||||||
bankAccount: { connect: { id: payload.bankAccountId } },
|
|
||||||
balance: newBalance,
|
|
||||||
},
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
return await tx.bankAccountBalance.update({
|
|
||||||
where: {
|
|
||||||
bankAccountId: payload.bankAccountId,
|
|
||||||
},
|
|
||||||
data: {
|
|
||||||
balance: newBalance,
|
|
||||||
},
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -89,7 +89,6 @@ export class InventoriesService {
|
|||||||
},
|
},
|
||||||
})
|
})
|
||||||
let info = null as any
|
let info = null as any
|
||||||
console.log(movements)
|
|
||||||
|
|
||||||
const mapped = movements.map(movement => {
|
const mapped = movements.map(movement => {
|
||||||
const { id, quantity, unitPrice, totalCost, avgCost, product } = movement
|
const { id, quantity, unitPrice, totalCost, avgCost, product } = movement
|
||||||
|
|||||||
Reference in New Issue
Block a user