refactor: restructure purchase receipts module and related workflows

- Removed old DTOs for creating and updating purchase receipts.
- Updated purchase receipts controller and service to use new DTOs and workflows.
- Introduced transaction helper for managing database transactions.
- Added new workflows for handling purchase receipt payments and supplier ledgers.
- Implemented new logic for managing purchase receipt items and payments.
- Enhanced error handling for payment processing in workflows.
- Updated supplier ledger management to reflect changes in purchase receipts.
This commit is contained in:
2026-01-05 10:07:23 +03:30
parent a2db2daa70
commit fda190f902
38 changed files with 617 additions and 486 deletions
+11
View File
@@ -0,0 +1,11 @@
// src/common/database/transaction.helper.ts
import { PrismaService } from '../../prisma/prisma.service'
export async function withTransaction<T>(
prisma: PrismaService,
fn: (tx: PrismaService) => Promise<T>,
): Promise<T> {
return prisma.$transaction(async tx => {
return fn(tx as PrismaService)
})
}