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.
151 lines
3.7 KiB
JavaScript
151 lines
3.7 KiB
JavaScript
const { DataTypes } = require('sequelize');
|
|
|
|
module.exports = {
|
|
up: async (queryInterface, Sequelize) => {
|
|
// Create course_stats table
|
|
await queryInterface.createTable('course_stats', {
|
|
id: {
|
|
type: DataTypes.UUID,
|
|
defaultValue: DataTypes.UUIDV4,
|
|
primaryKey: true
|
|
},
|
|
courseId: {
|
|
type: DataTypes.UUID,
|
|
allowNull: false,
|
|
references: {
|
|
model: 'courses',
|
|
key: 'id'
|
|
},
|
|
onUpdate: 'CASCADE',
|
|
onDelete: 'CASCADE'
|
|
},
|
|
rating: {
|
|
type: DataTypes.DECIMAL(3, 2),
|
|
allowNull: true
|
|
},
|
|
totalRatings: {
|
|
type: DataTypes.INTEGER,
|
|
allowNull: false,
|
|
defaultValue: 0
|
|
},
|
|
enrollmentCount: {
|
|
type: DataTypes.INTEGER,
|
|
allowNull: false,
|
|
defaultValue: 0
|
|
},
|
|
totalDuration: {
|
|
type: DataTypes.INTEGER,
|
|
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
|
|
},
|
|
createdAt: {
|
|
type: DataTypes.DATE,
|
|
allowNull: false,
|
|
defaultValue: Sequelize.NOW
|
|
},
|
|
updatedAt: {
|
|
type: DataTypes.DATE,
|
|
allowNull: false,
|
|
defaultValue: Sequelize.NOW
|
|
}
|
|
});
|
|
|
|
// Create user_notes table
|
|
await queryInterface.createTable('user_notes', {
|
|
id: {
|
|
type: DataTypes.UUID,
|
|
defaultValue: DataTypes.UUIDV4,
|
|
primaryKey: true
|
|
},
|
|
userId: {
|
|
type: DataTypes.UUID,
|
|
allowNull: false,
|
|
references: {
|
|
model: 'users',
|
|
key: 'id'
|
|
},
|
|
onUpdate: 'CASCADE',
|
|
onDelete: 'CASCADE'
|
|
},
|
|
courseId: {
|
|
type: DataTypes.UUID,
|
|
allowNull: false,
|
|
references: {
|
|
model: 'courses',
|
|
key: 'id'
|
|
},
|
|
onUpdate: 'CASCADE',
|
|
onDelete: 'CASCADE'
|
|
},
|
|
contentId: {
|
|
type: DataTypes.UUID,
|
|
allowNull: true,
|
|
references: {
|
|
model: 'course_content',
|
|
key: 'id'
|
|
},
|
|
onUpdate: 'CASCADE',
|
|
onDelete: 'CASCADE'
|
|
},
|
|
notes: {
|
|
type: DataTypes.TEXT,
|
|
allowNull: false,
|
|
defaultValue: ''
|
|
},
|
|
tabType: {
|
|
type: DataTypes.ENUM('overview', 'notes', 'announcements', 'reviews', 'learning-tools', 'resources', 'analysis'),
|
|
allowNull: false,
|
|
defaultValue: 'notes'
|
|
},
|
|
isPublic: {
|
|
type: DataTypes.BOOLEAN,
|
|
allowNull: false,
|
|
defaultValue: false
|
|
},
|
|
createdAt: {
|
|
type: DataTypes.DATE,
|
|
allowNull: false,
|
|
defaultValue: Sequelize.NOW
|
|
},
|
|
updatedAt: {
|
|
type: DataTypes.DATE,
|
|
allowNull: false,
|
|
defaultValue: Sequelize.NOW
|
|
}
|
|
});
|
|
|
|
// Add indexes for better performance
|
|
await queryInterface.addIndex('course_stats', ['courseId']);
|
|
await queryInterface.addIndex('user_notes', ['userId', 'courseId']);
|
|
await queryInterface.addIndex('user_notes', ['courseId', 'contentId']);
|
|
},
|
|
|
|
down: async (queryInterface, Sequelize) => {
|
|
await queryInterface.dropTable('user_notes');
|
|
await queryInterface.dropTable('course_stats');
|
|
}
|
|
};
|