new domain acrhitecture

This commit is contained in:
cyber-dream 2023-03-09 17:01:26 +03:00
parent 9e0033149d
commit d254f698d3

View File

@ -6,14 +6,16 @@ import (
type SkirdaDomain struct { type SkirdaDomain struct {
DomainId string `json:"domainId"` DomainId string `json:"domainId"`
SkirdaGames `json:"games"` //SkirdaGames `json:"games"`
Games []string `json:"games"`
Events []string `json:"events"`
// skirdasession.SkirdaSessions // skirdasession.SkirdaSessions
} }
func (domain SkirdaDomain) BuildDomain(newGames []SkirdaGame, newSessions []SkirdaSession) { //func (domain SkirdaDomain) BuildDomain(newGames []SkirdaGame, newSessions []SkirdaSession) {
domain.AddGames(newGames) // domain.AddGames(newGames)
// domain.AddSessions(newSessions) // // domain.AddSessions(newSessions)
} //}
type Domains []SkirdaDomain type Domains []SkirdaDomain
@ -21,24 +23,24 @@ func (domains Domains) Set(newDomains []SkirdaDomain) {
domains = append([]SkirdaDomain{}, newDomains...) domains = append([]SkirdaDomain{}, newDomains...)
} }
func (domains Domains) FindGameByID(gameId string) (SkirdaGame, error) { //func (domains Domains) FindGameByID(gameId string) (SkirdaGame, error) {
for _, domain := range domains { // for _, domain := range domains {
game, _ := domain.FindGameByID(gameId) // game, _ := domain.FindGameByID(gameId)
if game.GetSkirdaGameId() == gameId { // if game.GetSkirdaGameId() == gameId {
return game, nil // return game, nil
} // }
} // }
//
// return nil, errors.New("")
//}
return nil, errors.New("") //func (domains Domains) GetGames() SkirdaGames {
} // allGames := SkirdaGames{}
// for _, domain := range domains {
func (domains Domains) GetGames() SkirdaGames { // allGames = append(allGames, domain.SkirdaGames...)
allGames := SkirdaGames{} // }
for _, domain := range domains { // return allGames
allGames = append(allGames, domain.SkirdaGames...) //}
}
return allGames
}
// func (domains Domains) GetSessions() SkirdaSessions { // func (domains Domains) GetSessions() SkirdaSessions {
// plainSessions := SkirdaSessions{} // plainSessions := SkirdaSessions{}