initial commit
This commit is contained in:
Executable
+41
@@ -0,0 +1,41 @@
|
||||
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,
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user