From 63d43db39dd8f7e2f10b6157232f881ae87dcb74 Mon Sep 17 00:00:00 2001 From: zenfun Date: Sun, 4 Jan 2026 01:26:55 +0800 Subject: [PATCH] feat(server): register IP ban routes in admin group Initialize the IP ban service and handler, and wire up the CRUD endpoints to the admin router group. --- cmd/server/main.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/cmd/server/main.go b/cmd/server/main.go index c759c49..58e9ed9 100644 --- a/cmd/server/main.go +++ b/cmd/server/main.go @@ -233,6 +233,8 @@ func main() { internalHandler := api.NewInternalHandler(db) featureHandler := api.NewFeatureHandler(rdb) authHandler := api.NewAuthHandler(db, rdb, adminService, masterService) + ipBanService := service.NewIPBanService(db, rdb) + ipBanHandler := api.NewIPBanHandler(ipBanService) modelRegistryService := service.NewModelRegistryService(db, rdb, service.ModelRegistryConfig{ Enabled: cfg.ModelRegistry.Enabled, RefreshEvery: time.Duration(cfg.ModelRegistry.RefreshSeconds) * time.Second, @@ -391,6 +393,12 @@ func main() { adminGroup.DELETE("/bindings/:id", handler.DeleteBinding) adminGroup.POST("/bindings/batch", handler.BatchBindings) adminGroup.POST("/sync/snapshot", handler.SyncSnapshot) + // IP Ban routes + adminGroup.POST("/ip-bans", ipBanHandler.Create) + adminGroup.GET("/ip-bans", ipBanHandler.List) + adminGroup.GET("/ip-bans/:id", ipBanHandler.Get) + adminGroup.PUT("/ip-bans/:id", ipBanHandler.Update) + adminGroup.DELETE("/ip-bans/:id", ipBanHandler.Delete) } // Master Routes