feat(rack-planner): implement port-to-port connections (patch cables) with dynamic SVG visualization layer

This commit is contained in:
2026-03-22 14:55:33 -05:00
parent 444d694a06
commit becb55d57c
13 changed files with 449 additions and 28 deletions

View File

@@ -0,0 +1,37 @@
import { Router } from 'express';
import * as connService from '../services/connectionService';
const router = Router();
// POST /api/connections
router.post('/', async (req, res, next) => {
try {
const { fromPortId, toPortId, color, label } = req.body;
const conn = await connService.createConnection({ fromPortId, toPortId, color, label });
res.status(201).json(conn);
} catch (err) {
next(err);
}
});
// DELETE /api/connections/:id
router.delete('/:id', async (req, res, next) => {
try {
await connService.deleteConnection(req.params.id);
res.json({ success: true });
} catch (err) {
next(err);
}
});
// DELETE /api/connections/ports/:p1/:p2 (remove link between two specific ports)
router.delete('/ports/:p1/:p2', async (req, res, next) => {
try {
await connService.deleteByPorts(req.params.p1, req.params.p2);
res.json({ success: true });
} catch (err) {
next(err);
}
});
export default router;