Compare commits

...

2 Commits

Author SHA1 Message Date
d0a5e5fb0b move domains in back repo 2023-03-25 01:23:15 +03:00
928edc1efe change name of userId field 2023-03-25 01:22:27 +03:00
2 changed files with 13 additions and 34 deletions

View File

@ -1,32 +1,11 @@
package domain package domain
import ( // type Domains []SkirdaDomain
"errors"
)
type SkirdaDomain struct { // func (domains Domains) Set(newDomains []SkirdaDomain) {
DomainId string `json:"domainId"` // domains = append([]SkirdaDomain{}, newDomains...)
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) { //func (domains Domains) FindGameByID(gameId string) (SkirdaGame, error) {
// for _, domain := range domains { // for _, domain := range domains {
// game, _ := domain.FindGameByID(gameId) // game, _ := domain.FindGameByID(gameId)
@ -54,11 +33,11 @@ func (domains Domains) Set(newDomains []SkirdaDomain) {
// return plainSessions // return plainSessions
// } // }
func (domains Domains) FindDomain(domainId string) (SkirdaDomain, error) { // func (domains Domains) FindDomain(domainId string) (SkirdaDomain, error) {
for _, domain := range domains { // for _, domain := range domains {
if domain.DomainId == domainId { // if domain.DomainId == domainId {
return domain, nil // return domain, nil
} // }
} // }
return SkirdaDomain{}, errors.New("not any domain founded") // return SkirdaDomain{}, errors.New("not any domain founded")
} // }

View File

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