backend: Extend Express Request type to include session object with user and token properties

This commit is contained in:
juancarmore 2025-03-21 00:51:40 +01:00
parent 570c830f63
commit 5e1e418c13
2 changed files with 15 additions and 1 deletions

View File

@ -0,0 +1,13 @@
import { ClaimGrants } from 'livekit-server-sdk';
import { User } from '@typings-ce';
// Override the Express Request type to include a session object with user and token properties
// This will allow controllers to access the user and token information from the request object in a type-safe manner
declare module 'express' {
interface Request {
session?: {
user?: User;
tokenClaims?: ClaimGrants;
};
}
}

View File

@ -15,7 +15,8 @@
"emitDecoratorMetadata": true, /* Enables experimental support for emitting type metadata for decorators. */
"paths": {
"@typings-ce": ["./src/typings/ce/index.ts"]
}
},
"typeRoots": ["src/config/@types"]
},
"include": ["src/**/*.ts", "index.ts"],
"exclude": ["node_modules", "tests/**/*.ts", "tests/**/*.tsx"],