Add Context APIs and refactor vocab models
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:
silverpro89
2026-02-02 10:05:46 +07:00
parent 81a7ab5b6c
commit 97dbbd4d12
15 changed files with 1018 additions and 248 deletions

25
routes/contextRoutes.js Normal file
View File

@@ -0,0 +1,25 @@
const express = require('express');
const router = express.Router();
const contextController = require('../controllers/contextController');
const { authenticateToken } = require('../middleware/auth');
/**
* Context Routes
*/
// Get all contexts
router.get('/', authenticateToken, contextController.getAllContexts);
// Get context by UUID
router.get('/:id', authenticateToken, contextController.getContextById);
// Create context
router.post('/', authenticateToken, contextController.createContext);
// Update context
router.put('/:id', authenticateToken, contextController.updateContext);
// Delete context
router.delete('/:id', authenticateToken, contextController.deleteContext);
module.exports = router;