Loggest thy stuff
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

53 lines
1.0 KiB

package models
type ScopeEntry struct {
ID int `json:"id"`
Name string `json:"name"`
Abbreviation string `json:"abbreviation"`
}
type ScopeMember struct {
ID string `json:"id"`
Name string `json:"name"`
Owner bool `json:"owner"`
}
type Scope struct {
ScopeEntry
DisplayName string `json:"displayName"`
Members []ScopeMember `json:"members,omitempty"`
Projects []ProjectEntry `json:"projects,omitempty"`
Stats []Stat `json:"stats,omitempty"`
StatusLabels map[Status]string `json:"statusLabels,omitempty"` // Not stored as part of scope, but may be in the future.
}
func (s *Scope) Member(id string) *ScopeMember {
for _, user := range s.Members {
if user.ID == id {
return &user
}
}
return nil
}
func (s *Scope) HasMember(id string) bool {
for _, user := range s.Members {
if user.ID == id {
return true
}
}
return false
}
func (s *Scope) Stat(id int) *Stat {
for _, stat := range s.Stats {
if stat.ID == id {
return &stat
}
}
return nil
}