- 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.
38 lines
855 B
JavaScript
38 lines
855 B
JavaScript
import { Model, DataTypes } from 'sequelize';
|
|
import { sequelize } from '../../utils/sequelize.js';
|
|
|
|
class VocabCourseEnrollment extends Model {}
|
|
|
|
VocabCourseEnrollment.init({
|
|
id: {
|
|
type: DataTypes.INTEGER,
|
|
primaryKey: true,
|
|
autoIncrement: true
|
|
},
|
|
userId: {
|
|
type: DataTypes.INTEGER,
|
|
allowNull: false,
|
|
field: 'user_id'
|
|
},
|
|
courseId: {
|
|
type: DataTypes.INTEGER,
|
|
allowNull: false,
|
|
field: 'course_id'
|
|
},
|
|
enrolledAt: {
|
|
type: DataTypes.DATE,
|
|
allowNull: false,
|
|
defaultValue: DataTypes.NOW,
|
|
field: 'enrolled_at'
|
|
}
|
|
}, {
|
|
sequelize,
|
|
modelName: 'VocabCourseEnrollment',
|
|
tableName: 'vocab_course_enrollment',
|
|
schema: 'community',
|
|
timestamps: false,
|
|
underscored: true
|
|
});
|
|
|
|
export default VocabCourseEnrollment;
|