initial commit

This commit is contained in:
2026-06-09 14:07:37 +03:30
parent 30ac533800
commit 996a4fcda7
121 changed files with 20557 additions and 3 deletions

View File

@@ -0,0 +1,19 @@
import { Injectable, NestMiddleware } from '@nestjs/common';
import { NextFunction, Request, Response } from 'express';
import { v4 as uuidv4 } from 'uuid';
import { REQUEST_ID_HEADER } from '../constants/app.constants';
/**
* Early middleware assignment of request ID (runs before guards).
*/
@Injectable()
export class RequestIdMiddleware implements NestMiddleware {
use(req: Request, res: Response, next: NextFunction): void {
const incoming = req.headers[REQUEST_ID_HEADER] as string | undefined;
const requestId = incoming ?? uuidv4();
(req as Request & { requestId: string }).requestId = requestId;
res.setHeader(REQUEST_ID_HEADER, requestId);
next();
}
}