Creates a new CourseRepository instance
Initialized Prisma client for database operations
Creates a new course in the database with automatic field mapping and validation. Transforms DTO field names to match database schema and applies default values.
Course creation data with all required fields
Unique identifier for the course
Source language code (e.g., 'en', 'es')
Target language code (e.g., 'en', 'es')
Display name of the course
Optional detailed description of the course
Whether the course is publicly accessible (defaults to true)
Unique identifier for the course
Promise resolving to the created course with transformed field names
Retrieves a single course by its unique identifier with level count information. Includes relationship counting for associated levels to provide comprehensive course data.
Unique identifier of the course to retrieve
Promise resolving to course with level count or null if not found
Retrieves a paginated list of courses with advanced filtering, searching, and sorting capabilities. Supports text search across course names and descriptions, boolean filtering for public/private courses, and comprehensive sorting options with level count information included for each course.
Optional
options: QueryOptions = {}Query configuration options for filtering, pagination, and sorting
Page number for pagination (1-based)
Maximum number of courses per page
Text search query applied to course names and descriptions
Filter conditions (supports 'is_public' boolean filter)
Field to sort by (must be in allowed sort fields)
Sort direction
Promise resolving to paginated course results with level counts
Updates an existing course with partial data and field mapping transformation. Supports updating any combination of course fields with proper null/undefined handling for optional fields like description.
Unique identifier of the course to update
Partial course data with fields to update
Updated source language code
Updated target language code
Updated course name
Updated description (undefined to remove)
Updated public visibility status
Promise resolving to updated course with level count
Deletes a course from the database by its unique identifier. Handles deletion gracefully with error catching to prevent application crashes.
Unique identifier of the course to delete
Promise resolving to true if deletion succeeded, false if failed or course not found
Checks if a course exists in the database by its unique identifier. Uses efficient count query to determine existence without retrieving full course data.
Unique identifier of the course to check
Promise resolving to true if course exists, false otherwise
Course repository class providing comprehensive data access operations for course management. Implements standardized CRUD operations with advanced querying, filtering, and pagination capabilities.