Add Context APIs and refactor vocab models
All checks were successful
Deploy to Production / deploy (push) Successful in 25s
All checks were successful
Deploy to Production / deploy (push) Successful in 25s
Introduce Context and ContextGuide features: add Sequelize models (models/Context.js, models/ContextGuide.js), controllers (controllers/contextController.js, controllers/contextGuideController.js) and authenticated route handlers (routes/contextRoutes.js, routes/contextGuideRoutes.js). Wire the new routes into app.js and export the models from models/index.js. Refactor vocabulary: remove VocabForm, VocabMapping and VocabRelation models and relationships, update models/Vocab.js schema and indexes, and add migrate-vocab.js to drop/recreate the vocab table for the new schema. Also add a lesson editor UI (public/lesson-editor.html) and a small cleanup in models/Lesson.js.
This commit is contained in:
51
models/ContextGuide.js
Normal file
51
models/ContextGuide.js
Normal file
@@ -0,0 +1,51 @@
|
||||
const { DataTypes } = require('sequelize');
|
||||
const { sequelize } = require('../config/database');
|
||||
|
||||
const ContextGuide = sequelize.define('ContextGuide', {
|
||||
uuid: {
|
||||
type: DataTypes.UUID,
|
||||
defaultValue: DataTypes.UUIDV4,
|
||||
primaryKey: true,
|
||||
comment: 'Unique identifier for context guide'
|
||||
},
|
||||
title: {
|
||||
type: DataTypes.STRING(255),
|
||||
allowNull: false,
|
||||
comment: 'Guide title'
|
||||
},
|
||||
name: {
|
||||
type: DataTypes.STRING(255),
|
||||
allowNull: false,
|
||||
comment: 'Target field name for AI processing'
|
||||
},
|
||||
data: {
|
||||
type: DataTypes.JSON,
|
||||
allowNull: false,
|
||||
comment: 'Guide data (text or json)'
|
||||
},
|
||||
created_at: {
|
||||
type: DataTypes.DATE,
|
||||
defaultValue: DataTypes.NOW
|
||||
},
|
||||
updated_at: {
|
||||
type: DataTypes.DATE,
|
||||
defaultValue: DataTypes.NOW
|
||||
}
|
||||
}, {
|
||||
tableName: 'context_guide',
|
||||
timestamps: true,
|
||||
createdAt: 'created_at',
|
||||
updatedAt: 'updated_at',
|
||||
indexes: [
|
||||
{
|
||||
name: 'idx_context_guide_title',
|
||||
fields: ['title']
|
||||
},
|
||||
{
|
||||
name: 'idx_context_guide_name',
|
||||
fields: ['name']
|
||||
}
|
||||
]
|
||||
});
|
||||
|
||||
module.exports = ContextGuide;
|
||||
Reference in New Issue
Block a user