- Added new course management functionalities in VocabController, including creating, updating, and deleting courses and lessons. - Implemented enrollment and progress tracking for courses, along with grammar exercise creation and management. - Updated database schema to include tables for courses, lessons, enrollments, and grammar exercises. - Enhanced frontend with new routes and views for course listing and details, including internationalization support for course-related texts. - Improved user experience by adding navigation to courses from the main vocab trainer view.
94 lines
2.1 KiB
JavaScript
94 lines
2.1 KiB
JavaScript
import { Model, DataTypes } from 'sequelize';
|
|
import { sequelize } from '../../utils/sequelize.js';
|
|
|
|
class VocabCourseLesson extends Model {}
|
|
|
|
VocabCourseLesson.init({
|
|
id: {
|
|
type: DataTypes.INTEGER,
|
|
primaryKey: true,
|
|
autoIncrement: true
|
|
},
|
|
courseId: {
|
|
type: DataTypes.INTEGER,
|
|
allowNull: false,
|
|
field: 'course_id'
|
|
},
|
|
chapterId: {
|
|
type: DataTypes.INTEGER,
|
|
allowNull: true,
|
|
field: 'chapter_id'
|
|
},
|
|
lessonNumber: {
|
|
type: DataTypes.INTEGER,
|
|
allowNull: false,
|
|
field: 'lesson_number'
|
|
},
|
|
title: {
|
|
type: DataTypes.TEXT,
|
|
allowNull: false
|
|
},
|
|
description: {
|
|
type: DataTypes.TEXT,
|
|
allowNull: true
|
|
},
|
|
weekNumber: {
|
|
type: DataTypes.INTEGER,
|
|
allowNull: true,
|
|
field: 'week_number'
|
|
},
|
|
dayNumber: {
|
|
type: DataTypes.INTEGER,
|
|
allowNull: true,
|
|
field: 'day_number'
|
|
},
|
|
lessonType: {
|
|
type: DataTypes.TEXT,
|
|
allowNull: false,
|
|
defaultValue: 'vocab',
|
|
field: 'lesson_type'
|
|
},
|
|
audioUrl: {
|
|
type: DataTypes.TEXT,
|
|
allowNull: true,
|
|
field: 'audio_url'
|
|
},
|
|
culturalNotes: {
|
|
type: DataTypes.TEXT,
|
|
allowNull: true,
|
|
field: 'cultural_notes'
|
|
},
|
|
targetMinutes: {
|
|
type: DataTypes.INTEGER,
|
|
allowNull: true,
|
|
field: 'target_minutes'
|
|
},
|
|
targetScorePercent: {
|
|
type: DataTypes.INTEGER,
|
|
allowNull: false,
|
|
defaultValue: 80,
|
|
field: 'target_score_percent'
|
|
},
|
|
requiresReview: {
|
|
type: DataTypes.BOOLEAN,
|
|
allowNull: false,
|
|
defaultValue: false,
|
|
field: 'requires_review'
|
|
},
|
|
createdAt: {
|
|
type: DataTypes.DATE,
|
|
allowNull: false,
|
|
defaultValue: DataTypes.NOW,
|
|
field: 'created_at'
|
|
}
|
|
}, {
|
|
sequelize,
|
|
modelName: 'VocabCourseLesson',
|
|
tableName: 'vocab_course_lesson',
|
|
schema: 'community',
|
|
timestamps: false,
|
|
underscored: true
|
|
});
|
|
|
|
export default VocabCourseLesson;
|