newsbot-api/internal/services/database.go

30 lines
1.0 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"
)
2024-04-28 10:02:57 -07:00
type RepositoryService struct {
AlertDiscord repository.AlertDiscordRepo
Articles repository.ArticlesRepo
DiscordWebHooks repository.DiscordWebHookRepo
RefreshTokens repository.RefreshToken
Sources repository.Sources
Users repository.Users
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: repository.NewRefreshTokenRepository(conn),
Sources: repository.NewSourceRepository(conn),
Users: repository.NewUserRepository(conn),
UserSourceSubscriptions: repository.NewUserSourceRepository(conn),
}
}