From d254f698d37423cf4c1810c33c90fe182acdfa3e Mon Sep 17 00:00:00 2001 From: cyber-dream Date: Thu, 9 Mar 2023 17:01:26 +0300 Subject: [PATCH] new domain acrhitecture --- domain/domain.go | 48 +++++++++++++++++++++++++----------------------- 1 file changed, 25 insertions(+), 23 deletions(-) diff --git a/domain/domain.go b/domain/domain.go index af44118..f4a6f69 100644 --- a/domain/domain.go +++ b/domain/domain.go @@ -5,15 +5,17 @@ import ( ) type SkirdaDomain struct { - DomainId string `json:"domainId"` - SkirdaGames `json:"games"` + DomainId string `json:"domainId"` + //SkirdaGames `json:"games"` + Games []string `json:"games"` + Events []string `json:"events"` // skirdasession.SkirdaSessions } -func (domain SkirdaDomain) BuildDomain(newGames []SkirdaGame, newSessions []SkirdaSession) { - domain.AddGames(newGames) - // domain.AddSessions(newSessions) -} +//func (domain SkirdaDomain) BuildDomain(newGames []SkirdaGame, newSessions []SkirdaSession) { +// domain.AddGames(newGames) +// // domain.AddSessions(newSessions) +//} type Domains []SkirdaDomain @@ -21,24 +23,24 @@ func (domains Domains) Set(newDomains []SkirdaDomain) { domains = append([]SkirdaDomain{}, newDomains...) } -func (domains Domains) FindGameByID(gameId string) (SkirdaGame, error) { - for _, domain := range domains { - game, _ := domain.FindGameByID(gameId) - if game.GetSkirdaGameId() == gameId { - return game, nil - } - } +//func (domains Domains) FindGameByID(gameId string) (SkirdaGame, error) { +// for _, domain := range domains { +// game, _ := domain.FindGameByID(gameId) +// if game.GetSkirdaGameId() == gameId { +// return game, nil +// } +// } +// +// return nil, errors.New("") +//} - return nil, errors.New("") -} - -func (domains Domains) GetGames() SkirdaGames { - allGames := SkirdaGames{} - for _, domain := range domains { - allGames = append(allGames, domain.SkirdaGames...) - } - return allGames -} +//func (domains Domains) GetGames() SkirdaGames { +// allGames := SkirdaGames{} +// for _, domain := range domains { +// allGames = append(allGames, domain.SkirdaGames...) +// } +// return allGames +//} // func (domains Domains) GetSessions() SkirdaSessions { // plainSessions := SkirdaSessions{}