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.
51 lines
No EOL
1.9 KiB
JavaScript
51 lines
No EOL
1.9 KiB
JavaScript
const { sequelize } = require('../config/database');
|
|
const { LessonCompletion, CourseSection, Course } = require('../models');
|
|
|
|
const setupDatabase = async () => {
|
|
try {
|
|
console.log('🔄 Setting up database...');
|
|
|
|
// Sync all models
|
|
await sequelize.sync({ alter: true });
|
|
console.log('✅ Database synchronized successfully');
|
|
|
|
// Create lesson_completions table if it doesn't exist
|
|
try {
|
|
await LessonCompletion.sync({ alter: true });
|
|
console.log('✅ Lesson completions table created/updated');
|
|
} catch (error) {
|
|
console.log('⚠️ Lesson completions table already exists or error:', error.message);
|
|
}
|
|
|
|
// Create course_sections table if it doesn't exist
|
|
try {
|
|
await CourseSection.sync({ alter: true });
|
|
console.log('✅ Course sections table created/updated');
|
|
} catch (error) {
|
|
console.log('⚠️ Course sections table already exists or error:', error.message);
|
|
}
|
|
|
|
// Create/update courses table with Course Type fields
|
|
try {
|
|
await Course.sync({ alter: true });
|
|
console.log('✅ Courses table created/updated with Course Type fields');
|
|
console.log(' - courseType (online/classroom/hybrid)');
|
|
console.log(' - location (for classroom/hybrid courses)');
|
|
console.log(' - allowRecording, recordForReplay, recordForFutureStudents');
|
|
} catch (error) {
|
|
console.log('⚠️ Courses table already exists or error:', error.message);
|
|
}
|
|
|
|
console.log('🎉 Database setup completed successfully!');
|
|
console.log('🚀 Course Type system is now available:');
|
|
console.log(' • Online Courses: Pre-recorded, self-paced learning');
|
|
console.log(' • Classroom Courses: Physical location + live trainer');
|
|
console.log(' • Hybrid Courses: Live classroom + online streaming');
|
|
process.exit(0);
|
|
} catch (error) {
|
|
console.error('❌ Database setup failed:', error);
|
|
process.exit(1);
|
|
}
|
|
};
|
|
|
|
setupDatabase();
|