Remove UsecaseDependancies service locator pattern
All checks were successful
continuous-integration/drone/push Build is passing

Replace the UsecaseDependancies interface with plain Dependencies structs
defined locally in each route package. DeclareRoutes acts as the sole
composition root where use cases are resolved; sub-route functions and
controllers receive only the specific interfaces they need.
This commit is contained in:
nemunaire 2026-02-14 09:46:33 +07:00
commit c9552fa9b2
27 changed files with 174 additions and 240 deletions

View file

@ -53,10 +53,21 @@ func NewAdmin(app *App) *Admin {
router := gin.New()
router.Use(gin.Logger(), gin.Recovery())
// Prepare usecases
// Prepare usecases (admin uses unrestricted provider access)
app.usecases.providerAdmin = providerUC.NewService(app.store)
admin.DeclareRoutes(app.cfg, router, app.store, app)
admin.DeclareRoutes(app.cfg, router, app.store, admin.Dependencies{
AuthUser: app.usecases.authUser,
Domain: app.usecases.domain,
Provider: app.usecases.providerAdmin,
RemoteZoneImporter: app.usecases.orchestrator.RemoteZoneImporter,
Service: app.usecases.service,
User: app.usecases.user,
Zone: app.usecases.zone,
ZoneCorrectionApplier: app.usecases.orchestrator.ZoneCorrectionApplier,
ZoneImporter: app.usecases.orchestrator.ZoneImporter,
ZoneService: app.usecases.zoneService,
})
web.DeclareRoutes(app.cfg, router)
return &Admin{