courseworx/backend/models/CourseStats.js
mmabdalla 5477297914 v2.0.2 - Complete Plugin Architecture System and Multi-Currency Implementation
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.
2025-09-14 04:20:37 +03:00

78 lines
1.6 KiB
JavaScript

const { DataTypes } = require('sequelize');
module.exports = (sequelize) => {
const CourseStats = sequelize.define('CourseStats', {
id: {
type: DataTypes.UUID,
defaultValue: DataTypes.UUIDV4,
primaryKey: true
},
courseId: {
type: DataTypes.UUID,
allowNull: false,
references: {
model: 'courses',
key: 'id'
}
},
rating: {
type: DataTypes.DECIMAL(3, 2), // 4.50 format
allowNull: true,
validate: {
min: 0,
max: 5
}
},
totalRatings: {
type: DataTypes.INTEGER,
allowNull: false,
defaultValue: 0
},
enrollmentCount: {
type: DataTypes.INTEGER,
allowNull: false,
defaultValue: 0
},
totalDuration: {
type: DataTypes.INTEGER, // in seconds
allowNull: false,
defaultValue: 0
},
skillLevel: {
type: DataTypes.ENUM('beginner', 'intermediate', 'advanced'),
allowNull: false,
defaultValue: 'beginner'
},
language: {
type: DataTypes.STRING,
allowNull: false,
defaultValue: 'English'
},
publishedDate: {
type: DataTypes.DATE,
allowNull: true
},
totalLessons: {
type: DataTypes.INTEGER,
allowNull: false,
defaultValue: 0
},
certificateAvailable: {
type: DataTypes.BOOLEAN,
allowNull: false,
defaultValue: true
}
}, {
tableName: 'course_stats',
timestamps: true
});
CourseStats.associate = (models) => {
CourseStats.belongsTo(models.Course, {
foreignKey: 'courseId',
as: 'course'
});
};
return CourseStats;
};