2026-08-15 16:22:25 -07:00
|
|
|
package directory
|
|
|
|
|
|
|
|
|
|
type Person struct {
|
|
|
|
|
Email string `json:"email"`
|
|
|
|
|
FullName string `json:"fullName"`
|
|
|
|
|
LegalName string `json:"legalName,omitempty"`
|
|
|
|
|
PreferredName string `json:"preferredName,omitempty"`
|
|
|
|
|
IsStaff bool `json:"isStaff"`
|
|
|
|
|
IsParent bool `json:"isParent"`
|
|
|
|
|
IsStudent bool `json:"isStudent"`
|
2026-08-15 23:07:09 -07:00
|
|
|
IsNew bool `json:"isNew,omitempty"`
|
2026-08-15 16:22:25 -07:00
|
|
|
Pronouns string `json:"pronouns,omitempty"`
|
|
|
|
|
Facts string `json:"facts,omitempty"`
|
|
|
|
|
PronunciationURL string `json:"pronunciationUrl,omitempty"`
|
|
|
|
|
PhotoURL string `json:"photoUrl,omitempty"`
|
|
|
|
|
Grade string `json:"grade,omitempty"`
|
|
|
|
|
Classroom string `json:"classroom,omitempty"`
|
2026-08-16 13:21:25 -07:00
|
|
|
Crew string `json:"crew,omitempty"`
|
2026-08-15 16:22:25 -07:00
|
|
|
Phone string `json:"phone,omitempty"`
|
|
|
|
|
FamilyKey string `json:"familyKey,omitempty"`
|
|
|
|
|
ParentContactEmails []string `json:"parentContactEmails,omitempty"`
|
|
|
|
|
JobTitle string `json:"jobTitle,omitempty"`
|
|
|
|
|
Department string `json:"department,omitempty"`
|
|
|
|
|
GradeBand string `json:"gradeBand,omitempty"`
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
type Family struct {
|
|
|
|
|
Key string `json:"key"`
|
|
|
|
|
Name string `json:"name,omitempty"`
|
|
|
|
|
Address string `json:"address,omitempty"`
|
2026-08-16 10:13:05 -07:00
|
|
|
Phone string `json:"phone,omitempty"`
|
2026-08-15 23:21:03 -07:00
|
|
|
Lat float64 `json:"lat,omitempty"`
|
|
|
|
|
Lng float64 `json:"lng,omitempty"`
|
2026-08-15 16:22:25 -07:00
|
|
|
PhotoURL string `json:"photoUrl,omitempty"`
|
|
|
|
|
PhotoCaption string `json:"photoCaption,omitempty"`
|
|
|
|
|
PronunciationURL string `json:"pronunciationUrl,omitempty"`
|
|
|
|
|
AdultEmails []string `json:"adultEmails,omitempty"`
|
|
|
|
|
KidEmails []string `json:"kidEmails,omitempty"`
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
type Classroom struct {
|
2026-08-16 13:21:25 -07:00
|
|
|
Name string `json:"name"`
|
|
|
|
|
ImageURL string `json:"imageUrl,omitempty"`
|
|
|
|
|
HasCrews bool `json:"hasCrews"`
|
2026-08-15 16:22:25 -07:00
|
|
|
}
|
|
|
|
|
|
2026-08-16 13:21:25 -07:00
|
|
|
type Crew struct {
|
2026-08-15 16:22:25 -07:00
|
|
|
Classroom string `json:"classroom"`
|
|
|
|
|
Name string `json:"name,omitempty"`
|
|
|
|
|
Teachers []string `json:"teachers,omitempty"`
|
|
|
|
|
GradeBand string `json:"gradeBand,omitempty"`
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
type Grade struct {
|
|
|
|
|
Name string `json:"name"`
|
|
|
|
|
NextName string `json:"nextName,omitempty"`
|
|
|
|
|
Band string `json:"band,omitempty"`
|
|
|
|
|
NextBand string `json:"nextBand,omitempty"`
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
type Model struct {
|
|
|
|
|
People []Person `json:"people"`
|
|
|
|
|
Families map[string]Family `json:"families"`
|
|
|
|
|
Classrooms []Classroom `json:"classrooms"`
|
2026-08-16 13:21:25 -07:00
|
|
|
Crews []Crew `json:"crews"`
|
2026-08-15 16:22:25 -07:00
|
|
|
Grades []Grade `json:"grades"`
|
|
|
|
|
RoomParents map[string][]string `json:"roomParents"`
|
|
|
|
|
Departments []string `json:"departments"`
|
2026-08-16 13:21:25 -07:00
|
|
|
byEmail map[string]int
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func (m *Model) Person(email string) *Person {
|
|
|
|
|
i, ok := m.byEmail[email]
|
|
|
|
|
if !ok {
|
|
|
|
|
return nil
|
|
|
|
|
}
|
|
|
|
|
return &m.People[i]
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func (m *Model) Member(email string) bool {
|
|
|
|
|
return m.Person(email) != nil
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func (m *Model) DisplayName(email string) string {
|
|
|
|
|
if p := m.Person(email); p != nil {
|
|
|
|
|
return p.FullName
|
|
|
|
|
}
|
|
|
|
|
return email
|
2026-08-15 16:22:25 -07:00
|
|
|
}
|