Files
rack-planner/server/routes/ports.ts
jason 231de3d005 Initial scaffold: full-stack RackMapper application
Complete project scaffold with working auth, REST API, Prisma/SQLite
schema, Docker config, and React frontend for both Rack Planner and
Service Mapper modules. Both server and client pass TypeScript strict
mode with zero errors. Initial migration applied.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-21 21:48:56 -05:00

22 lines
719 B
TypeScript

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);
}
});