WayrApp Backend & Ecosystem Documentation - v1.0.0
    Preparing search index...

    Module ProgressRepository

    Comprehensive data access layer for progress tracking operations using Prisma ORM.

    This repository provides a complete abstraction over the database layer for all progress-related data operations in the WayrApp language learning platform. It handles user progress tracking, lesson completion records, and analytics data with robust error handling and transaction support.

    The repository implements the Repository pattern, providing a clean interface between the business logic layer and the database. It includes comprehensive Prisma error handling, automatic data mapping between database models and application interfaces, and optimized queries for performance.

    Key features include atomic transaction support for batch operations, intelligent error mapping from Prisma errors to application-specific errors, pagination support for large datasets, aggregation queries for analytics, and comprehensive CRUD operations for both user progress and lesson completion entities.

    The repository ensures data consistency through proper constraint handling, provides efficient upsert operations for progress updates, and includes specialized methods for offline synchronization scenarios with duplicate detection and conflict resolution.

    Exequiel Trujillo

    1.0.0

    // Initialize repository with Prisma client
    const progressRepository = new ProgressRepository(prisma);

    // Create user progress
    const progress = await progressRepository.createUserProgress({
    user_id: 'user-123',
    experience_points: 0,
    lives_current: 5,
    streak_current: 0
    });

    // Record lesson completion
    const completion = await progressRepository.createLessonCompletion({
    user_id: 'user-123',
    lesson_id: 'lesson-456',
    score: 85,
    time_spent_seconds: 120
    });

    Classes

    ProgressRepository