feat: add A2-B1 course expansion features including listening activities and conversation sessions
- Updated VocabCourseView.vue to display CEFR level for courses. - Enhanced VocabLessonView.vue with new sections for listening activities and conversation labs, including audio controls and transcript toggling. - Created migration to add new columns to vocab_course and new tables for conversation sessions and listening activities. - Implemented models for vocab_conversation_session and vocab_listening_activity. - Developed scripts to create new A2 and B1 bridge courses with structured lesson plans. - Documented the A2-B1 expansion plan detailing course structure, learning goals, and assessment criteria.
This commit is contained in:
@@ -128,6 +128,8 @@ import VocabGrammarExerciseType from './community/vocab_grammar_exercise_type.js
|
||||
import VocabGrammarExercise from './community/vocab_grammar_exercise.js';
|
||||
import VocabGrammarExerciseProgress from './community/vocab_grammar_exercise_progress.js';
|
||||
import VocabSrsItem from './community/vocab_srs_item.js';
|
||||
import VocabConversationSession from './community/vocab_conversation_session.js';
|
||||
import VocabListeningActivity from './community/vocab_listening_activity.js';
|
||||
import CalendarEvent from './community/calendar_event.js';
|
||||
import Campaign from './match3/campaign.js';
|
||||
import Match3Level from './match3/level.js';
|
||||
@@ -1188,6 +1190,13 @@ export default function setupAssociations() {
|
||||
VocabCourse.hasMany(VocabSrsItem, { foreignKey: 'courseId', as: 'srsItems' });
|
||||
VocabSrsItem.belongsTo(VocabCourseLesson, { foreignKey: 'lessonId', as: 'lesson' });
|
||||
VocabCourseLesson.hasMany(VocabSrsItem, { foreignKey: 'lessonId', as: 'srsItems' });
|
||||
|
||||
VocabConversationSession.belongsTo(User, { foreignKey: 'userId', as: 'user' });
|
||||
User.hasMany(VocabConversationSession, { foreignKey: 'userId', as: 'vocabConversationSessions' });
|
||||
VocabConversationSession.belongsTo(VocabCourseLesson, { foreignKey: 'lessonId', as: 'lesson' });
|
||||
VocabCourseLesson.hasMany(VocabConversationSession, { foreignKey: 'lessonId', as: 'conversationSessions' });
|
||||
VocabListeningActivity.belongsTo(VocabCourseLesson, { foreignKey: 'lessonId', as: 'lesson' });
|
||||
VocabCourseLesson.hasMany(VocabListeningActivity, { foreignKey: 'lessonId', as: 'listeningActivities' });
|
||||
|
||||
// Calendar associations
|
||||
CalendarEvent.belongsTo(User, { foreignKey: 'userId', as: 'user' });
|
||||
|
||||
25
backend/models/community/vocab_conversation_session.js
Normal file
25
backend/models/community/vocab_conversation_session.js
Normal file
@@ -0,0 +1,25 @@
|
||||
import { Model, DataTypes } from 'sequelize';
|
||||
import { sequelize } from '../../utils/sequelize.js';
|
||||
|
||||
class VocabConversationSession extends Model {}
|
||||
|
||||
VocabConversationSession.init({
|
||||
id: { type: DataTypes.INTEGER, primaryKey: true, autoIncrement: true },
|
||||
userId: { type: DataTypes.INTEGER, allowNull: false, field: 'user_id' },
|
||||
lessonId: { type: DataTypes.INTEGER, allowNull: false, field: 'lesson_id' },
|
||||
scenario: { type: DataTypes.JSONB, allowNull: false, defaultValue: {} },
|
||||
turns: { type: DataTypes.JSONB, allowNull: false, defaultValue: [] },
|
||||
summary: { type: DataTypes.JSONB, allowNull: true },
|
||||
status: { type: DataTypes.TEXT, allowNull: false, defaultValue: 'active' },
|
||||
createdAt: { type: DataTypes.DATE, allowNull: false, defaultValue: DataTypes.NOW, field: 'created_at' },
|
||||
updatedAt: { type: DataTypes.DATE, allowNull: false, defaultValue: DataTypes.NOW, field: 'updated_at' }
|
||||
}, {
|
||||
sequelize,
|
||||
modelName: 'VocabConversationSession',
|
||||
tableName: 'vocab_conversation_session',
|
||||
schema: 'community',
|
||||
timestamps: true,
|
||||
underscored: true
|
||||
});
|
||||
|
||||
export default VocabConversationSession;
|
||||
@@ -39,6 +39,22 @@ VocabCourse.init({
|
||||
defaultValue: 1,
|
||||
field: 'difficulty_level'
|
||||
},
|
||||
cefrLevel: {
|
||||
type: DataTypes.TEXT,
|
||||
allowNull: true,
|
||||
field: 'cefr_level'
|
||||
},
|
||||
courseKind: {
|
||||
type: DataTypes.TEXT,
|
||||
allowNull: false,
|
||||
defaultValue: 'core',
|
||||
field: 'course_kind'
|
||||
},
|
||||
prerequisiteCourseId: {
|
||||
type: DataTypes.INTEGER,
|
||||
allowNull: true,
|
||||
field: 'prerequisite_course_id'
|
||||
},
|
||||
isPublic: {
|
||||
type: DataTypes.BOOLEAN,
|
||||
allowNull: false,
|
||||
|
||||
25
backend/models/community/vocab_listening_activity.js
Normal file
25
backend/models/community/vocab_listening_activity.js
Normal file
@@ -0,0 +1,25 @@
|
||||
import { Model, DataTypes } from 'sequelize';
|
||||
import { sequelize } from '../../utils/sequelize.js';
|
||||
|
||||
class VocabListeningActivity extends Model {}
|
||||
|
||||
VocabListeningActivity.init({
|
||||
id: { type: DataTypes.INTEGER, primaryKey: true, autoIncrement: true },
|
||||
lessonId: { type: DataTypes.INTEGER, allowNull: false, field: 'lesson_id' },
|
||||
audioUrl: { type: DataTypes.TEXT, allowNull: false, field: 'audio_url' },
|
||||
transcript: { type: DataTypes.TEXT, allowNull: false },
|
||||
translation: { type: DataTypes.TEXT, allowNull: true },
|
||||
speakerProfile: { type: DataTypes.JSONB, allowNull: false, defaultValue: {} , field: 'speaker_profile' },
|
||||
speed: { type: DataTypes.TEXT, allowNull: false, defaultValue: 'natural' },
|
||||
questions: { type: DataTypes.JSONB, allowNull: false, defaultValue: [] },
|
||||
createdAt: { type: DataTypes.DATE, allowNull: false, defaultValue: DataTypes.NOW, field: 'created_at' }
|
||||
}, {
|
||||
sequelize,
|
||||
modelName: 'VocabListeningActivity',
|
||||
tableName: 'vocab_listening_activity',
|
||||
schema: 'community',
|
||||
timestamps: false,
|
||||
underscored: true
|
||||
});
|
||||
|
||||
export default VocabListeningActivity;
|
||||
@@ -158,6 +158,8 @@ import VocabGrammarExerciseType from './community/vocab_grammar_exercise_type.js
|
||||
import VocabGrammarExercise from './community/vocab_grammar_exercise.js';
|
||||
import VocabGrammarExerciseProgress from './community/vocab_grammar_exercise_progress.js';
|
||||
import VocabSrsItem from './community/vocab_srs_item.js';
|
||||
import VocabConversationSession from './community/vocab_conversation_session.js';
|
||||
import VocabListeningActivity from './community/vocab_listening_activity.js';
|
||||
import CalendarEvent from './community/calendar_event.js';
|
||||
|
||||
const models = {
|
||||
@@ -322,6 +324,8 @@ const models = {
|
||||
VocabGrammarExercise,
|
||||
VocabGrammarExerciseProgress,
|
||||
VocabSrsItem,
|
||||
VocabConversationSession,
|
||||
VocabListeningActivity,
|
||||
|
||||
// Calendar
|
||||
CalendarEvent,
|
||||
|
||||
Reference in New Issue
Block a user