newsbot-api/internal/services/database.go

31 lines
1.2 KiB
Go

package services
import (
"database/sql"
"git.jamestombleson.com/jtom38/newsbot-api/internal/repository"
repositoryservices "git.jamestombleson.com/jtom38/newsbot-api/internal/repositoryServices"
)
type RepositoryService struct {
AlertDiscord repository.AlertDiscordRepo
Articles repository.ArticlesRepo
DiscordWebHooks repository.DiscordWebHookRepo
RefreshTokens repositoryservices.RefreshToken
Sources repository.Sources
Users repositoryservices.UserServices
UserSourceSubscriptions repository.UserSourceRepo
}
func NewRepositoryService(conn *sql.DB) RepositoryService {
return RepositoryService{
AlertDiscord: repository.NewAlertDiscordRepository(conn),
Articles: repository.NewArticleRepository(conn),
DiscordWebHooks: repository.NewDiscordWebHookRepository(conn),
RefreshTokens: repositoryservices.NewRefreshTokenService(conn),
Sources: repository.NewSourceRepository(conn),
Users: repositoryservices.NewUserService(conn),
UserSourceSubscriptions: repository.NewUserSourceRepository(conn),
}
}