refactor(backend): standardize errors and simplify configuration and test setup
This commit is contained in:
1 parent
1535c19b8c
commit
138666a7bb
92 files changed
+3994
-210
No files matched your search
@@ -14,8 +14,9 @@ import (
|
||||
v1 "lincodex/backend/internal/adapter/primary/http/v1"
|
||||
"lincodex/backend/internal/adapter/secondary/postgres"
|
||||
metrics "lincodex/backend/internal/adapter/secondary/prometheus"
|
||||
redisadapter "lincodex/backend/internal/adapter/secondary/redis"
|
||||
"lincodex/backend/internal/adapter/secondary/seaweedfs"
|
||||
"lincodex/backend/internal/port/inbound"
|
||||
"lincodex/backend/internal/port/outbound"
|
||||
"lincodex/backend/internal/usecase/health"
|
||||
)
|
||||
|
||||
@@ -23,10 +24,11 @@ func initialize(ctx context.Context, config config.Config, logger *slog.Logger)
|
||||
wire.Build(
|
||||
wire.NewSet(
|
||||
postgres.NewHealthChecker,
|
||||
wire.Bind(new(outbound.ReadinessChecker), new(*postgres.HealthChecker)),
|
||||
redisadapter.NewCache,
|
||||
seaweedfs.NewStorage,
|
||||
wire.Bind(new(inbound.Readiness), new(*health.Readiness)),
|
||||
wire.Bind(new(httpmiddleware.RequestMetrics), new(*metrics.Metrics)),
|
||||
health.NewReadiness,
|
||||
newReadiness,
|
||||
metrics.New,
|
||||
newHealthHandler,
|
||||
httpadapter.NewRouter,
|
||||
@@ -39,3 +41,7 @@ func initialize(ctx context.Context, config config.Config, logger *slog.Logger)
|
||||
func newHealthHandler(readiness inbound.Readiness, config config.Config) *v1.HealthHandler {
|
||||
return v1.NewHealthHandler(readiness, config.ReadinessTimeout)
|
||||
}
|
||||
|
||||
func newReadiness(postgres *postgres.HealthChecker, cache *redisadapter.Cache, storage *seaweedfs.Storage) *health.Readiness {
|
||||
return health.NewReadiness(postgres, cache, storage)
|
||||
}
|
||||
Reference in new issue
Block a user