Files
teletypegames/domain/domain.go
T
2025-12-07 11:32:45 +01:00

42 lines
1.2 KiB
Go
Executable File

package domain
import (
"teletype_softwares/lib/mysql_utils"
)
type Domain struct {
SoftwareRepository SoftwareRepository
ReleaseRepository ReleaseRepository
DownloadService DownloadService
SoftwareUpdaterService SoftwareUpdaterService
SoftwareService SoftwareService
}
func NewDomain() Domain {
DB := mysql_utils.Init()
MigrateGoDatabase(DB)
softwareRepository := &softwareRepository{db: DB}
releaseRepository := &releaseRepository{db: DB}
softwareService := &softwareService{softwareRepository: softwareRepository}
tic80Updater := &softwareUpdaterTIC80Service{
softwareRepository: softwareRepository,
releaseRepository: releaseRepository,
}
softwareUpdaterService := &softwareUpdaterService{tic80Updater: tic80Updater}
downloadServiceInstance := &downloadService{
softwareRepository: softwareRepository,
releaseRepository: releaseRepository,
}
return Domain{
SoftwareRepository: softwareRepository,
ReleaseRepository: releaseRepository,
DownloadService: downloadServiceInstance,
SoftwareUpdaterService: softwareUpdaterService,
SoftwareService: softwareService,
}
}