Remove UsecaseDependancies service locator pattern
All checks were successful
continuous-integration/drone/push Build is passing
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:
parent
570d3d16dd
commit
c9552fa9b2
27 changed files with 174 additions and 240 deletions
|
|
@ -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{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue