fix(auth): export JwtModule so JwtAuthGuard works outside AuthModule

JwtAuthGuard is instantiated in the DI context of whichever module
applies @UseGuards() on it, not AuthModule's. SessionsController is the
first consumer outside AuthModule itself, and the app crashed on boot
with "Nest can't resolve dependencies of the JwtAuthGuard" because only
the guard class, not the JwtModule it depends on, was exported.

Found by real end-to-end testing while wiring the Agent 1 frontend:
the app had apparently never actually been started since the sessions
module was added, since unit tests bypass real DI via .overrideGuard().

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
william
2026-10-31 22:09:54 +01:00
co-authored by Claude Sonnet 5
parent 717729242f
commit 242aa1d708
+4 -1
View File
@@ -24,6 +24,9 @@ const ACCESS_TOKEN_TTL = '1h';
], ],
controllers: [AuthController], controllers: [AuthController],
providers: [AuthService, JwtAuthGuard], providers: [AuthService, JwtAuthGuard],
exports: [JwtAuthGuard], // JwtModule doit aussi etre exporte : JwtAuthGuard est instancie dans le contexte d'injection du
// module CONSOMMATEUR (ex: SessionsModule) quand il est utilise via @UseGuards() hors d'AuthModule,
// et a donc besoin d'y resoudre JwtService lui-meme (sinon UnknownDependenciesException).
exports: [JwtAuthGuard, JwtModule],
}) })
export class AuthModule {} export class AuthModule {}