update context API
All checks were successful
Deploy to Production / deploy (push) Successful in 19s

This commit is contained in:
silverpro89
2026-02-06 11:28:06 +07:00
parent 97dbbd4d12
commit aaba22b40c
12 changed files with 1375 additions and 49 deletions

View File

@@ -4,22 +4,41 @@ const contextController = require('../controllers/contextController');
const { authenticateToken } = require('../middleware/auth');
/**
* Context Routes
* Context Routes - Workflow-based
* Status: 0 (Draft) -> 1 (Enriched) -> 2 (Prompt Ready) -> 3 (Generating) -> 4 (Image Ready) -> 5 (Approved)
*/
// Get all contexts
router.get('/', authenticateToken, contextController.getAllContexts);
// Create new context (Title, Desc, Grade) - Status 0
router.post('/', contextController.createContext);
// Get contexts by status
router.get('/status/:status', contextController.getContextsByStatus);
// Status 0 -> 1: Update knowledge
router.post('/:id/enrich', contextController.enrichContext);
// Status 1 -> 2: Update context and img_prompt
router.post('/:id/prepare-prompt', contextController.preparePrompt);
// Status 2 -> 3 or 1: Update status
router.post('/:id/update-status', contextController.updateStatusFromPromptReady);
// Status 3 -> 4: Add images
router.post('/:id/add-images', contextController.addImages);
// Status 4 -> 5: Approve
router.post('/:id/approve', contextController.approveContext);
// Get all contexts (with optional filters)
router.get('/', contextController.getAllContexts);
// Get context by UUID
router.get('/:id', authenticateToken, contextController.getContextById);
router.get('/:id', contextController.getContextById);
// Create context
router.post('/', authenticateToken, contextController.createContext);
// Update context
router.put('/:id', authenticateToken, contextController.updateContext);
// Update context (general - use with caution)
router.put('/:id', contextController.updateContext);
// Delete context
router.delete('/:id', authenticateToken, contextController.deleteContext);
router.delete('/:id', contextController.deleteContext);
module.exports = router;