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

    Variable LevelSchemaConst

    LevelSchema: ZodObject<
        { id: ZodString; code: ZodString; name: ZodString; order: ZodNumber },
        "strip",
        ZodTypeAny,
        { id: string; code: string; name: string; order: number },
        { id: string; code: string; name: string; order: number },
    > = ...

    Level validation schema for course difficulty and progression levels

    Validation schema for course levels that represent different difficulty stages or proficiency levels within a language learning course. Levels provide structured progression paths for learners, organizing content from beginner to advanced stages while maintaining proper sequencing and identification within the course hierarchy.

    The level schema enforces proper identification through URL-safe ID formatting, provides short codes for easy reference and display, includes descriptive names for user interfaces, and maintains proper ordering for sequential progression through the learning material.

    Educational structure considerations include support for common proficiency frameworks (A1, A2, B1, B2, C1, C2), flexible naming that accommodates various pedagogical approaches, and ordering systems that support both linear and branching learning paths.

    // Standard proficiency levels
    const proficiencyLevels = [
    {
    id: 'beginner-a1',
    code: 'A1',
    name: 'Beginner Level 1',
    order: 1
    },
    {
    id: 'beginner-a2',
    code: 'A2',
    name: 'Beginner Level 2',
    order: 2
    },
    {
    id: 'intermediate-b1',
    code: 'B1',
    name: 'Intermediate Level 1',
    order: 3
    }
    ];
    // Level creation in course structure
    router.post('/courses/:courseId/levels',
    validate({ body: LevelSchema }),
    async (req, res) => {
    const levelData = req.body; // Validated level data
    const level = await levelService.create(req.params.courseId, levelData);
    res.status(201).json({ level });
    }
    );