import { Router, Request, Response, NextFunction } from 'express'; import * as portService from '../services/portService'; import { ok } from '../types/index'; import type { VlanMode } from '../lib/constants'; export const portsRouter = Router(); portsRouter.put('/:id', async (req: Request, res: Response, next: NextFunction) => { try { const { label, mode, nativeVlan, notes, vlans } = req.body as { label?: string; mode?: VlanMode; nativeVlan?: number | null; notes?: string; vlans?: Array<{ vlanId: string; tagged: boolean }>; }; res.json(ok(await portService.updatePort(req.params.id, { label, mode, nativeVlan, notes, vlans }))); } catch (e) { next(e); } });