Files
yourpart3/backend/models/community/vocab_srs_item.js
Torsten Schulz (local) e2c1147d75
All checks were successful
Deploy to production / deploy (push) Successful in 2m49s
feat(vocab): implement SRS features and enhance vocabulary management
- Added new endpoints in vocabController for retrieving SRS due items and reviewing SRS items, improving spaced repetition support.
- Updated vocabService to handle SRS item creation and scheduling, ensuring effective tracking of vocabulary exposure.
- Enhanced vocabRouter with new routes for SRS functionalities, facilitating user interaction with spaced repetition features.
- Modified VocabPracticeDialog and VocabCourseView to integrate SRS due items, providing users with timely review opportunities.
- Updated translations and UI elements to reflect new SRS features, enhancing user experience and accessibility.
2026-04-17 09:14:30 +02:00

95 lines
1.8 KiB
JavaScript

import { Model, DataTypes } from 'sequelize';
import { sequelize } from '../../utils/sequelize.js';
class VocabSrsItem extends Model {}
VocabSrsItem.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'
},
lessonId: {
type: DataTypes.INTEGER,
allowNull: true,
field: 'lesson_id'
},
itemKey: {
type: DataTypes.STRING(80),
allowNull: false,
field: 'item_key'
},
learning: {
type: DataTypes.TEXT,
allowNull: false
},
reference: {
type: DataTypes.TEXT,
allowNull: false
},
direction: {
type: DataTypes.STRING(8),
allowNull: false,
defaultValue: 'BOTH'
},
stage: {
type: DataTypes.INTEGER,
allowNull: false,
defaultValue: 0
},
intervalDays: {
type: DataTypes.INTEGER,
allowNull: false,
defaultValue: 0,
field: 'interval_days'
},
lastReviewedAt: {
type: DataTypes.DATE,
allowNull: true,
field: 'last_reviewed_at'
},
nextDueAt: {
type: DataTypes.DATE,
allowNull: false,
defaultValue: DataTypes.NOW,
field: 'next_due_at'
},
correctCount: {
type: DataTypes.INTEGER,
allowNull: false,
defaultValue: 0,
field: 'correct_count'
},
wrongCount: {
type: DataTypes.INTEGER,
allowNull: false,
defaultValue: 0,
field: 'wrong_count'
},
lapseCount: {
type: DataTypes.INTEGER,
allowNull: false,
defaultValue: 0,
field: 'lapse_count'
}
}, {
sequelize,
modelName: 'VocabSrsItem',
tableName: 'vocab_srs_item',
schema: 'community',
timestamps: true,
underscored: true
});
export default VocabSrsItem;