48 lines
1.5 KiB
JavaScript
48 lines
1.5 KiB
JavaScript
const express = require('express');
|
|
const router = express.Router();
|
|
const contextController = require('../controllers/contextController');
|
|
const { authenticateToken } = require('../middleware/auth');
|
|
|
|
/**
|
|
* Context Routes - Workflow-based
|
|
* Status: 0 (Draft) -> 1 (Enriched) -> 2 (Prompt Ready) -> 3 (Generating) -> 4 (Image Ready) -> 5 (Approved)
|
|
*/
|
|
|
|
// 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);
|
|
|
|
// Bulk update all status 2 to status 3
|
|
router.post('/bulk/status-2-to-3', contextController.bulkUpdateStatus2To3);
|
|
|
|
// 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', contextController.getContextById);
|
|
|
|
// Update context (general - use with caution)
|
|
router.put('/:id', contextController.updateContext);
|
|
|
|
// Delete context
|
|
router.delete('/:id', contextController.deleteContext);
|
|
|
|
module.exports = router;
|