Skip to content

Add PassportModule and JwtModule to LessonsModule and QuizzesModule So Auth Guards Resolve Correctly #154

@portableDD

Description

@portableDD

Description

Both LessonsController and QuizzesController use @UseGuards(JwtAuthGuard, RolesGuard) on their admin-only endpoints. However neither LessonsModule nor QuizzesModule imports PassportModule or JwtModule. This means the JWT strategy is not available in these modules and the guards will fail with a NestJS dependency injection error when those endpoints are hit.


Proposed Actions

  • Add PassportModule and JwtModule.register(...) to the imports array of LessonsModule
  • Add PassportModule and JwtModule.register(...) to the imports array of QuizzesModule
  • Long-term fix (after Issue Add a Pull Request (PR) Template #1 restructure and Issue Install and Set Up ShadCN #3 JWT fix): export JwtModule from AuthModule and simply import AuthModule into feature modules that need auth guards — removing the need to re-register JWT in each module

Expected Outcome

  • Admin-protected endpoints in LessonsController and QuizzesController resolve guards without DI errors
  • JWT authentication works correctly on POST /lessons, PATCH /lessons/:id, DELETE /lessons/:id, POST /quizzes, PATCH /quizzes/:id

Complexity

Trivial

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions