Creates an instance of ProgressRepository.
Prisma client instance for database operations
Updates user progress record with specified changes.
Automatically updates the last activity date and handles lesson relationship updates.
The unique identifier of the user
Object containing fields to update
Promise resolving to the updated progress record
Creates new user progress or updates existing record atomically (upsert operation).
This method provides atomic create-or-update functionality, ensuring data consistency when the existence of user progress is uncertain.
User progress data for creation or update
Promise resolving to the created or updated progress record
Creates a new lesson completion record in the database.
Lesson completion data to create
Promise resolving to the created completion record
Retrieves a specific lesson completion record by user and lesson ID.
The unique identifier of the user
The unique identifier of the lesson
Promise resolving to completion record or null if not found
Retrieves paginated list of lesson completions for a specific user.
Supports pagination, sorting, and filtering options for efficient data retrieval.
The unique identifier of the user
Optional
options: QueryOptions = {}Query options including pagination and sorting parameters
Promise resolving to paginated completion results
Creates multiple lesson completion records atomically within a transaction.
This method is optimized for offline synchronization scenarios, automatically skipping duplicate completions and ensuring data consistency through transaction handling.
Array of lesson completion data to create
Promise resolving to array of successfully created completion records
Retrieves comprehensive progress summary with aggregated statistics.
Calculates lessons completed, courses started, and other analytics data by performing complex queries across multiple related tables. Includes advanced analytics like longest streak, completion percentage, and average score.
The unique identifier of the user
Promise resolving to progress summary or null if user progress not found
Checks whether a specific lesson has been completed by the user.
The unique identifier of the user
The unique identifier of the lesson
Promise resolving to true if lesson is completed, false otherwise
Retrieves aggregated completion statistics for a specific lesson.
Calculates total completions, average score, and average time spent using database aggregation functions.
The unique identifier of the lesson
Promise resolving to lesson completion statistics
Data access layer for progress tracking operations.
ProgressRepository