package main import ( "go.lab260.ru/fielderr" "go.uber.org/zap" "gitea.privcloud.tech/vlad_marlo/mtusi2026lab5/internal/admission" "gitea.privcloud.tech/vlad_marlo/mtusi2026lab5/internal/config" fiberctrl "gitea.privcloud.tech/vlad_marlo/mtusi2026lab5/internal/controller/http/fiber" "gitea.privcloud.tech/vlad_marlo/mtusi2026lab5/internal/media" "gitea.privcloud.tech/vlad_marlo/mtusi2026lab5/internal/objectstore" "gitea.privcloud.tech/vlad_marlo/mtusi2026lab5/internal/service" "gitea.privcloud.tech/vlad_marlo/mtusi2026lab5/internal/store/postgres" "gitea.privcloud.tech/vlad_marlo/mtusi2026lab5/internal/valkey" ) // newObjects binds the S3 adapter at the composition root. func newObjects(cfg *config.ObjectStore) (*objectstore.Client, error) { return objectstore.New(cfg) } // newMedia injects infrastructure through the media service's consumer interfaces. func newMedia(database *postgres.Store, objects *objectstore.Client, chats service.Service) (*media.Service, error) { return media.New(database, objects, chats) } // newHTTPController connects the independently tested transport and attachment service. func newHTTPController(log *zap.Logger, cfg *config.Controller, svc service.Service, registry *fielderr.Registry, limiter admission.Distributed, auth service.Authentication, readiness fiberctrl.Readiness, attachments *media.Service) (*fiberctrl.Controller, error) { ctrl, err := fiberctrl.New(log, cfg, svc, registry, limiter, auth, readiness) if err != nil { return nil, err } return ctrl.WithAttachments(attachments), nil } // newMediaReadiness includes private originals in the mandatory synchronous dependency path. func newMediaReadiness(database *postgres.Store, cache *valkey.Client, objects *objectstore.Client) *dependencyReadiness { return &dependencyReadiness{database: database, cache: cache, objects: objects} }