if(!from||!to)thrownewAppError('One or both ports not found',404,'NOT_FOUND');
if(from.id===to.id)thrownewAppError('Cannot connect a port to itself',400,'BAD_REQUEST');
// Check if ports are already occupied?
// (In real life, a port can only have one cable, but we might allow one source and one target per port if we want to be flexible, but better to prevent simple loops)
// Create connection (if it already exists, use upsert or just throw error; @@unique already handles it)