new domain acrhitecture

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

View File

@ -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{}