mirror of
https://github.com/emo2007/block-accounting.git
synced 2024-11-10 04:36:26 +00:00
52 lines
1.7 KiB
Go
52 lines
1.7 KiB
Go
package factory
|
|
|
|
import (
|
|
"log/slog"
|
|
|
|
"github.com/emochka2007/block-accounting/internal/pkg/config"
|
|
"github.com/emochka2007/block-accounting/internal/usecase/interactors/jwt"
|
|
"github.com/emochka2007/block-accounting/internal/usecase/interactors/organizations"
|
|
"github.com/emochka2007/block-accounting/internal/usecase/interactors/transactions"
|
|
"github.com/emochka2007/block-accounting/internal/usecase/interactors/users"
|
|
"github.com/emochka2007/block-accounting/internal/usecase/repository/auth"
|
|
"github.com/emochka2007/block-accounting/internal/usecase/repository/cache"
|
|
orepo "github.com/emochka2007/block-accounting/internal/usecase/repository/organizations"
|
|
txRepo "github.com/emochka2007/block-accounting/internal/usecase/repository/transactions"
|
|
urepo "github.com/emochka2007/block-accounting/internal/usecase/repository/users"
|
|
)
|
|
|
|
func provideUsersInteractor(
|
|
log *slog.Logger,
|
|
usersRepo urepo.Repository,
|
|
) users.UsersInteractor {
|
|
return users.NewUsersInteractor(log.WithGroup("users-interactor"), usersRepo)
|
|
}
|
|
|
|
func provideJWTInteractor(
|
|
c config.Config,
|
|
usersInteractor users.UsersInteractor,
|
|
authRepository auth.Repository,
|
|
) jwt.JWTInteractor {
|
|
return jwt.NewJWT(c.Common.JWTSecret, usersInteractor, authRepository)
|
|
}
|
|
|
|
func provideOrganizationsInteractor(
|
|
log *slog.Logger,
|
|
orgRepo orepo.Repository,
|
|
cache cache.Cache,
|
|
) organizations.OrganizationsInteractor {
|
|
return organizations.NewOrganizationsInteractor(log, orgRepo, cache)
|
|
}
|
|
|
|
func provideTxInteractor(
|
|
log *slog.Logger,
|
|
txRepo txRepo.Repository,
|
|
orgInteractor organizations.OrganizationsInteractor,
|
|
) transactions.TransactionsInteractor {
|
|
return transactions.NewTransactionsInteractor(
|
|
log.WithGroup("transaction-interactor"),
|
|
txRepo,
|
|
orgInteractor,
|
|
)
|
|
}
|