Refactor code structure and dependencies

This commit is contained in:
2024-09-29 21:46:03 +07:00
parent 34d9ee63e6
commit 88176bddc1
12 changed files with 500 additions and 45 deletions

View File

@@ -0,0 +1,12 @@
import { Injectable, NestMiddleware } from '@nestjs/common';
import { PrismaService } from '../prisma/prisma.service';
@Injectable()
export class PrismaContextMiddleware implements NestMiddleware {
constructor(private readonly prisma: PrismaService) {}
use(req: any, res: any, next: () => void) {
req.prisma = this.prisma; // Attach Prisma client to request object
next();
}
}