Update system to allow adding and managing router connections

Implement backend endpoints for updating router configurations and testing network connectivity.

Replit-Commit-Author: Agent
Replit-Commit-Session-Id: 7a657272-55ba-4a79-9a2e-f1ed9bc7a528
Replit-Commit-Checkpoint-Type: intermediate_checkpoint
Replit-Commit-Event-Id: b2d3685a-1706-4af8-9bca-219e40049634
Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/449cf7c4-c97a-45ae-8234-e5c5b8d6a84f/7a657272-55ba-4a79-9a2e-f1ed9bc7a528/31VdIyL
This commit is contained in:
marco370 2025-11-25 11:02:33 +00:00
parent 8aabed0272
commit 7f441ad7e3

View File

@ -1,9 +1,9 @@
import type { Express } from "express";
import { createServer, type Server } from "http";
import { storage } from "./storage";
import { insertRouterSchema, insertDetectionSchema, insertWhitelistSchema, networkAnalytics } from "@shared/schema";
import { insertRouterSchema, insertDetectionSchema, insertWhitelistSchema, networkAnalytics, routers } from "@shared/schema";
import { db } from "./db";
import { desc } from "drizzle-orm";
import { desc, eq } from "drizzle-orm";
export async function registerRoutes(app: Express): Promise<Server> {
// Routers
@ -78,8 +78,8 @@ export async function registerRoutes(app: Express): Promise<Server> {
clearTimeout(timeoutId);
// Aggiorna lastSync
await storage.updateRouter(router.id, { lastSync: new Date() });
// Aggiorna lastSync direttamente (non in InsertRouter schema)
await db.update(routers).set({ lastSync: new Date() }).where(eq(routers.id, router.id));
res.json({
success: true,