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

    Variable ModuleSchemaConst

    ModuleSchema: ZodObject<
        {
            id: ZodString;
            module_type: ZodEnum<
                ["informative", "basic_lesson", "reading", "dialogue", "exam"],
            >;
            name: ZodString;
            order: ZodNumber;
        },
        "strip",
        ZodTypeAny,
        {
            id: string;
            module_type: | "informative"
            | "basic_lesson"
            | "reading"
            | "dialogue"
            | "exam";
            name: string;
            order: number;
        },
        {
            id: string;
            module_type: | "informative"
            | "basic_lesson"
            | "reading"
            | "dialogue"
            | "exam";
            name: string;
            order: number;
        },
    > = ...

    Module validation schema for specific learning activities within sections

    Validation schema for learning modules that represent specific educational activities or content types within course sections. Modules define the actual learning experiences including informative content, basic lessons, reading exercises, dialogues, and assessments, providing the granular structure for educational content delivery.

    The module schema enforces proper categorization through module type validation, ensures clear identification and naming for content management, and maintains proper sequencing within the section context. Module types determine the pedagogical approach and user interface presentation for each learning activity.

    Educational methodology support includes various learning modalities through module types, flexible content organization that accommodates different teaching approaches, and proper sequencing that supports both linear progression and adaptive learning paths.

    // Different module types in a section
    const sectionModules = [
    {
    id: 'intro-vocabulary-informative',
    module_type: 'informative',
    name: 'Introduction to Family Vocabulary',
    order: 1
    },
    {
    id: 'family-basic-lesson',
    module_type: 'basic_lesson',
    name: 'Family Members and Relationships',
    order: 2
    },
    {
    id: 'family-dialogue-practice',
    module_type: 'dialogue',
    name: 'Family Conversation Practice',
    order: 3
    },
    {
    id: 'family-knowledge-exam',
    module_type: 'exam',
    name: 'Family Vocabulary Assessment',
    order: 4
    }
    ];
    // Module creation with type-specific handling
    router.post('/sections/:sectionId/modules',
    validate({ body: ModuleSchema }),
    async (req, res) => {
    const moduleData = req.body; // Validated module data
    const module = await moduleService.create(req.params.sectionId, moduleData);

    // Type-specific initialization based on module_type
    switch (moduleData.module_type) {
    case 'informative':
    await contentService.initializeInformativeContent(module.id);
    break;
    case 'exam':
    await assessmentService.initializeExamStructure(module.id);
    break;
    }

    res.status(201).json({ module });
    }
    );