Content management API controller providing comprehensive REST endpoints for hierarchical content
operations in the WayrApp language learning platform. This controller serves as the primary HTTP
interface for managing the complete content hierarchy including courses, levels, sections, and modules
with full CRUD operations, advanced filtering, pagination, and caching capabilities.
The controller implements a RESTful API design following industry standards with proper HTTP status
codes, standardized response formats, comprehensive error handling, and security middleware integration.
It provides endpoints for both individual resource operations and hierarchical queries, supporting
complex content management workflows and efficient content delivery for learning applications.
Key architectural features include hierarchical resource management with parent-child relationships,
comprehensive pagination support with configurable sorting and filtering, advanced caching strategies
for packaged content delivery, role-based access control integration, and standardized API response
formatting. The controller integrates seamlessly with Express.js middleware patterns and provides
robust error handling with detailed error responses.
Content hierarchy management includes course creation and management, level organization within courses,
section structuring within levels, and module management within sections. Each endpoint supports
appropriate HTTP methods (GET, POST, PUT, DELETE) with proper authentication and authorization
requirements based on user roles and permissions.
Advanced features include packaged content delivery with conditional requests and caching headers,
search functionality across content hierarchies, bulk operations for content management, and
comprehensive validation using Zod schemas. The controller maintains data consistency across
the content hierarchy while providing flexible querying options for various client applications.
Author
Exequiel Trujillo
Since
1.0.0
Example
// Initialize controller with Prisma client constcontentController = newContentController(prisma);
// Set up course management routes router.post('/courses', authenticateToken, requireRole(['admin', 'content_creator']), validate({ body:CreateCourseSchema }), contentController.createCourse );
Content management API controller providing comprehensive REST endpoints for hierarchical content operations in the WayrApp language learning platform. This controller serves as the primary HTTP interface for managing the complete content hierarchy including courses, levels, sections, and modules with full CRUD operations, advanced filtering, pagination, and caching capabilities.
The controller implements a RESTful API design following industry standards with proper HTTP status codes, standardized response formats, comprehensive error handling, and security middleware integration. It provides endpoints for both individual resource operations and hierarchical queries, supporting complex content management workflows and efficient content delivery for learning applications.
Key architectural features include hierarchical resource management with parent-child relationships, comprehensive pagination support with configurable sorting and filtering, advanced caching strategies for packaged content delivery, role-based access control integration, and standardized API response formatting. The controller integrates seamlessly with Express.js middleware patterns and provides robust error handling with detailed error responses.
Content hierarchy management includes course creation and management, level organization within courses, section structuring within levels, and module management within sections. Each endpoint supports appropriate HTTP methods (GET, POST, PUT, DELETE) with proper authentication and authorization requirements based on user roles and permissions.
Advanced features include packaged content delivery with conditional requests and caching headers, search functionality across content hierarchies, bulk operations for content management, and comprehensive validation using Zod schemas. The controller maintains data consistency across the content hierarchy while providing flexible querying options for various client applications.
Author
Exequiel Trujillo
Since
1.0.0
Example