feat: add CampusScope request-level provider for data isolation

This commit is contained in:
2026-07-05 23:50:22 +08:00
parent ca53f9471b
commit abcfbc6121
3 changed files with 89 additions and 2 deletions

View File

@@ -0,0 +1,13 @@
import { Injectable, NestMiddleware } from '@nestjs/common';
import { Request, Response, NextFunction } from 'express';
import { CampusScope, CampusRequest } from './campus-scope';
@Injectable()
export class CampusScopeMiddleware implements NestMiddleware {
constructor(private readonly scope: CampusScope) {}
use(req: Request, _res: Response, next: NextFunction): void {
(req as CampusRequest).campusScope = this.scope;
next();
}
}