newsbot-api/internal/services/database.go

31 lines
1.2 KiB
Go
Raw Normal View History

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