Add services initialization and dependencies

This commit is contained in:
Luis Eduardo Jeréz Girón
2024-07-20 18:46:50 -06:00
parent ad613fbe4e
commit f508c5a251
+22 -2
View File
@@ -2,17 +2,37 @@ package service
import (
"github.com/eduardolat/pgbackweb/internal/database/dbgen"
"github.com/eduardolat/pgbackweb/internal/service/auth"
"github.com/eduardolat/pgbackweb/internal/service/backups"
"github.com/eduardolat/pgbackweb/internal/service/databases"
"github.com/eduardolat/pgbackweb/internal/service/destinations"
"github.com/eduardolat/pgbackweb/internal/service/executions"
"github.com/eduardolat/pgbackweb/internal/service/users"
)
type Service struct {
UsersService *users.Service
AuthService *auth.Service
BackupsService *backups.Service
DatabasesService *databases.Service
DestinationsService *destinations.Service
ExecutionsService *executions.Service
UsersService *users.Service
}
func New(dbgen *dbgen.Queries) *Service {
authService := auth.New(dbgen)
backupsService := backups.New(dbgen)
databasesService := databases.New(dbgen)
destinationsService := destinations.New(dbgen)
executionsService := executions.New(dbgen)
usersService := users.New(dbgen)
return &Service{
UsersService: usersService,
AuthService: authService,
BackupsService: backupsService,
DatabasesService: databasesService,
DestinationsService: destinationsService,
ExecutionsService: executionsService,
UsersService: usersService,
}
}