Major Features Added: - Complete Plugin Architecture System with financial plugin - Multi-currency support with exchange rates - Course type system (online, classroom, hybrid) - Attendance tracking and QR code scanning - Classroom sessions management - Course sections and content management - Professional video player with authentication - Secure media serving system - Shopping cart and checkout system - Financial dashboard and earnings tracking - Trainee progress tracking - User notes and assignments system Backend Infrastructure: - Plugin loader and registry system - Multi-currency database models - Secure media middleware - Course access middleware - Financial plugin with payment processing - Database migrations for new features - API endpoints for all new functionality Frontend Components: - Course management interface - Content creation and editing - Section management with drag-and-drop - Professional video player - QR scanner for attendance - Shopping cart and checkout flow - Financial dashboard - Plugin management interface - Trainee details and progress views This represents a major evolution of CourseWorx from a basic LMS to a comprehensive educational platform with plugin architecture.
114 lines
No EOL
2 KiB
JavaScript
114 lines
No EOL
2 KiB
JavaScript
const { DataTypes } = require('sequelize');
|
|
const { sequelize } = require('../config/database');
|
|
|
|
const CourseContent = sequelize.define('CourseContent', {
|
|
id: {
|
|
type: DataTypes.UUID,
|
|
defaultValue: DataTypes.UUIDV4,
|
|
primaryKey: true
|
|
},
|
|
courseId: {
|
|
type: DataTypes.UUID,
|
|
allowNull: false
|
|
},
|
|
sectionId: {
|
|
type: DataTypes.UUID,
|
|
allowNull: true
|
|
},
|
|
title: {
|
|
type: DataTypes.STRING,
|
|
allowNull: false,
|
|
validate: {
|
|
notEmpty: true,
|
|
len: [1, 200]
|
|
}
|
|
},
|
|
description: {
|
|
type: DataTypes.TEXT,
|
|
allowNull: true
|
|
},
|
|
type: {
|
|
type: DataTypes.ENUM('document', 'image', 'video', 'article', 'quiz', 'certificate'),
|
|
allowNull: false
|
|
},
|
|
content: {
|
|
type: DataTypes.JSONB,
|
|
allowNull: true,
|
|
defaultValue: {}
|
|
},
|
|
fileUrl: {
|
|
type: DataTypes.STRING,
|
|
allowNull: true
|
|
},
|
|
fileSize: {
|
|
type: DataTypes.INTEGER, // in bytes
|
|
allowNull: true
|
|
},
|
|
fileType: {
|
|
type: DataTypes.STRING,
|
|
allowNull: true
|
|
},
|
|
duration: {
|
|
type: DataTypes.INTEGER, // in seconds, for videos
|
|
allowNull: true
|
|
},
|
|
order: {
|
|
type: DataTypes.INTEGER,
|
|
allowNull: false,
|
|
defaultValue: 0
|
|
},
|
|
isPublished: {
|
|
type: DataTypes.BOOLEAN,
|
|
defaultValue: true
|
|
},
|
|
isRequired: {
|
|
type: DataTypes.BOOLEAN,
|
|
defaultValue: true
|
|
},
|
|
points: {
|
|
type: DataTypes.INTEGER,
|
|
allowNull: true,
|
|
defaultValue: 0
|
|
},
|
|
// For quizzes
|
|
quizData: {
|
|
type: DataTypes.JSONB,
|
|
allowNull: true,
|
|
defaultValue: {}
|
|
},
|
|
// For articles
|
|
articleContent: {
|
|
type: DataTypes.TEXT,
|
|
allowNull: true
|
|
},
|
|
// For certificates
|
|
certificateTemplate: {
|
|
type: DataTypes.JSONB,
|
|
allowNull: true,
|
|
defaultValue: {}
|
|
},
|
|
// Metadata
|
|
metadata: {
|
|
type: DataTypes.JSONB,
|
|
allowNull: true,
|
|
defaultValue: {}
|
|
}
|
|
}, {
|
|
tableName: 'course_contents',
|
|
indexes: [
|
|
{
|
|
fields: ['courseId']
|
|
},
|
|
{
|
|
fields: ['sectionId']
|
|
},
|
|
{
|
|
fields: ['type']
|
|
},
|
|
{
|
|
fields: ['order']
|
|
}
|
|
]
|
|
});
|
|
|
|
module.exports = CourseContent;
|