New Features: - Comprehensive course content management system - Multi-type content support (Documents, Images, Videos, Articles, Quizzes, Certificates) - File upload system with 100MB limit and type validation - Quiz system with multiple question types - Complete enrollment and subscriber management - Status tracking (pending, active, completed, cancelled) - Payment management (pending, paid, failed, refunded) - Progress tracking (0-100%) with automatic updates - Course capacity limits and validation - Certificate issuance tracking - Enrollment analytics and statistics Technical Improvements: - Enhanced file upload system with type validation - New database models: CourseContent, QuizQuestion - Comprehensive API endpoints for content and enrollment management - Role-based access control for all new features - Enhanced error handling and validation - File management with automatic cleanup This version provides a complete foundation for creating rich educational content and managing student enrollments.
70 lines
No EOL
1.3 KiB
JavaScript
70 lines
No EOL
1.3 KiB
JavaScript
const { DataTypes } = require('sequelize');
|
|
const { sequelize } = require('../config/database');
|
|
|
|
const QuizQuestion = sequelize.define('QuizQuestion', {
|
|
id: {
|
|
type: DataTypes.UUID,
|
|
defaultValue: DataTypes.UUIDV4,
|
|
primaryKey: true
|
|
},
|
|
contentId: {
|
|
type: DataTypes.UUID,
|
|
allowNull: false
|
|
},
|
|
question: {
|
|
type: DataTypes.TEXT,
|
|
allowNull: false
|
|
},
|
|
questionType: {
|
|
type: DataTypes.ENUM('multiple_choice', 'single_choice', 'true_false', 'text', 'file_upload'),
|
|
allowNull: false,
|
|
defaultValue: 'multiple_choice'
|
|
},
|
|
options: {
|
|
type: DataTypes.JSONB,
|
|
allowNull: true,
|
|
defaultValue: []
|
|
},
|
|
correctAnswer: {
|
|
type: DataTypes.JSONB,
|
|
allowNull: true
|
|
},
|
|
points: {
|
|
type: DataTypes.INTEGER,
|
|
allowNull: false,
|
|
defaultValue: 1
|
|
},
|
|
order: {
|
|
type: DataTypes.INTEGER,
|
|
allowNull: false,
|
|
defaultValue: 0
|
|
},
|
|
isRequired: {
|
|
type: DataTypes.BOOLEAN,
|
|
defaultValue: true
|
|
},
|
|
explanation: {
|
|
type: DataTypes.TEXT,
|
|
allowNull: true
|
|
},
|
|
metadata: {
|
|
type: DataTypes.JSONB,
|
|
allowNull: true,
|
|
defaultValue: {}
|
|
}
|
|
}, {
|
|
tableName: 'quiz_questions',
|
|
indexes: [
|
|
{
|
|
fields: ['contentId']
|
|
},
|
|
{
|
|
fields: ['questionType']
|
|
},
|
|
{
|
|
fields: ['order']
|
|
}
|
|
]
|
|
});
|
|
|
|
module.exports = QuizQuestion;
|