package dependencies import ( "github.com/eko/gocache/cache" "go.uber.org/zap" "serverctl/pkg/application/applications" "serverctl/pkg/application/projects" "serverctl/pkg/application/users" "serverctl/pkg/db" "serverctl/pkg/db/postgres" ) type Dependencies struct { Logger *zap.Logger Cache *cache.MetricCache Database *db.Client UsersRepository users.Repository UsersService *users.Service ProjectsRepository projects.Repository ProjectsService *projects.Service ApplicationsRepository applications.Repository ApplicationsService *applications.Service } func New() *Dependencies { logger := setupLogger() cacheM := setupCache(logger) containerClient := setupDocker(logger) setupCron(logger, cacheM, containerClient) database := db.NewClient(logger) usersRepository := postgres.NewUsersRepository(database) usersService := users.NewService(logger, usersRepository, cacheM) projectsRepository := postgres.NewProjectsRepository(database) projectsService := projects.NewService(logger, projectsRepository, cacheM) applicationsRepository := postgres.NewApplicationRepository(logger, database) applicationsService := applications.NewService(logger, applicationsRepository) return &Dependencies{ Logger: logger, Cache: cacheM, Database: database, UsersRepository: usersRepository, UsersService: usersService, ProjectsRepository: projectsRepository, ProjectsService: projectsService, ApplicationsRepository: applicationsRepository, ApplicationsService: applicationsService, } }