feat: als and prisma

This commit is contained in:
sauravdhakal12
2026-02-10 17:19:53 +05:45
parent 65480c4f8c
commit 9561693cb4
32 changed files with 2124 additions and 35 deletions

View File

@@ -0,0 +1,19 @@
import { Injectable, NestMiddleware } from '@nestjs/common';
import { Request, Response, NextFunction } from 'express';
import { randomUUID } from 'crypto';
import { RequestContextService } from './request-context.service';
@Injectable()
export class RequestContextMiddleware implements NestMiddleware {
constructor(private readonly ctx: RequestContextService) {}
use(req: Request, _: Response, next: NextFunction) {
const context = {
requestId: randomUUID(),
correlationId: (req.headers['x-correlation-id'] as string) ?? undefined,
headers: req.headers as Record<string, string>,
};
this.ctx.run(context, next);
}
}