Add Prisma middleware for automatic soft-delete filtering #10
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Context:
where: { deletedAt: null }is manually added to 50+ Prisma queries across all CRUD services. This is error-prone and verbose.Files affected: All service files (vips, drivers, vehicles, events, users, flights)
Suggested fix:
prisma.service.tsthat automatically appendsdeletedAt: nullto allfindMany,findFirst,findUnique,count, andaggregatequeries{ includeDeleted: true }for queries that need to see soft-deleted recordsEffort: Medium
Added Prisma middleware in prisma.service.ts that auto-appends deletedAt: null to all queries on soft-deletable models. Removed manual filters from 50+ queries across all services.