Compare commits

..

No commits in common. "d0a5e5fb0b425b373d3ac191539b4f1f75821601" and "a86bb964e51ebfc103cd16b721475a590baad6d8" have entirely different histories.

2 changed files with 34 additions and 13 deletions

View File

@ -1,10 +1,31 @@
package domain
// type Domains []SkirdaDomain
import (
"errors"
)
// func (domains Domains) Set(newDomains []SkirdaDomain) {
// domains = append([]SkirdaDomain{}, newDomains...)
// }
type SkirdaDomain struct {
DomainId string `json:"domainId"`
Users []SkirdaDomainUser `json:"users"`
Games []string `json:"games"`
Events []string `json:"events"`
}
type SkirdaDomainUser struct {
SkirdaUserId string `json:"skirdauserid"`
RolesId []string `json:"rolesid"`
}
//func (domain SkirdaDomain) BuildDomain(newGames []SkirdaGame, newSessions []SkirdaSession) {
// domain.AddGames(newGames)
// // domain.AddSessions(newSessions)
//}
type Domains []SkirdaDomain
func (domains Domains) Set(newDomains []SkirdaDomain) {
domains = append([]SkirdaDomain{}, newDomains...)
}
//func (domains Domains) FindGameByID(gameId string) (SkirdaGame, error) {
// for _, domain := range domains {
@ -33,11 +54,11 @@ package domain
// return plainSessions
// }
// func (domains Domains) FindDomain(domainId string) (SkirdaDomain, error) {
// for _, domain := range domains {
// if domain.DomainId == domainId {
// return domain, nil
// }
// }
// return SkirdaDomain{}, errors.New("not any domain founded")
// }
func (domains Domains) FindDomain(domainId string) (SkirdaDomain, error) {
for _, domain := range domains {
if domain.DomainId == domainId {
return domain, nil
}
}
return SkirdaDomain{}, errors.New("not any domain founded")
}

View File

@ -40,7 +40,7 @@ type ValidateResp struct {
}
type SkirdaUserResp struct {
SkirdaUserId string `json:"skirdauser_id"`
SkirdaUserId string `json:"skirdauserid"`
Username string `json:"username"`
Token string `json:"token"`
}