Creates and configures an Express router with lesson management and lesson-exercise assignment routes.
This factory function initializes a complete Express router configuration for lesson-related operations,
including full CRUD operations for lessons within modules and specialized endpoints for managing the
many-to-many relationship between lessons and exercises. The function instantiates a LessonController
with the provided PrismaClient and configures all routes with appropriate middleware for authentication,
authorization, validation, and error handling.
The returned router includes two main categories of endpoints: lesson management routes (nested under
modules) for creating, reading, updating, and deleting lessons, and lesson-exercise assignment routes
for managing exercise assignments, ordering, and reordering within lessons. All routes implement
comprehensive input validation using Zod schemas and role-based access control.
Parameters
prisma: PrismaClient
Prisma database client instance for controller initialization and database operations
Returns Router
Configured Express router with all lesson management and exercise assignment endpoints
Throws
When PrismaClient initialization fails or database connection is unavailable
Example
// Basic usage in main application import { createLessonRoutes } from'@/modules/content/routes/lessonRoutes'; import { prisma } from'@/shared/database/connection';
Creates and configures an Express router with lesson management and lesson-exercise assignment routes.
This factory function initializes a complete Express router configuration for lesson-related operations, including full CRUD operations for lessons within modules and specialized endpoints for managing the many-to-many relationship between lessons and exercises. The function instantiates a LessonController with the provided PrismaClient and configures all routes with appropriate middleware for authentication, authorization, validation, and error handling.
The returned router includes two main categories of endpoints: lesson management routes (nested under modules) for creating, reading, updating, and deleting lessons, and lesson-exercise assignment routes for managing exercise assignments, ordering, and reordering within lessons. All routes implement comprehensive input validation using Zod schemas and role-based access control.