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.
This commit is contained in:
zenfun
2026-01-04 01:26:55 +08:00
parent 7393bf6dc3
commit 63d43db39d

View File

@@ -233,6 +233,8 @@ func main() {
internalHandler := api.NewInternalHandler(db) internalHandler := api.NewInternalHandler(db)
featureHandler := api.NewFeatureHandler(rdb) featureHandler := api.NewFeatureHandler(rdb)
authHandler := api.NewAuthHandler(db, rdb, adminService, masterService) authHandler := api.NewAuthHandler(db, rdb, adminService, masterService)
ipBanService := service.NewIPBanService(db, rdb)
ipBanHandler := api.NewIPBanHandler(ipBanService)
modelRegistryService := service.NewModelRegistryService(db, rdb, service.ModelRegistryConfig{ modelRegistryService := service.NewModelRegistryService(db, rdb, service.ModelRegistryConfig{
Enabled: cfg.ModelRegistry.Enabled, Enabled: cfg.ModelRegistry.Enabled,
RefreshEvery: time.Duration(cfg.ModelRegistry.RefreshSeconds) * time.Second, RefreshEvery: time.Duration(cfg.ModelRegistry.RefreshSeconds) * time.Second,
@@ -391,6 +393,12 @@ func main() {
adminGroup.DELETE("/bindings/:id", handler.DeleteBinding) adminGroup.DELETE("/bindings/:id", handler.DeleteBinding)
adminGroup.POST("/bindings/batch", handler.BatchBindings) adminGroup.POST("/bindings/batch", handler.BatchBindings)
adminGroup.POST("/sync/snapshot", handler.SyncSnapshot) 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 // Master Routes