-
Notifications
You must be signed in to change notification settings - Fork 0
/
models.go
81 lines (63 loc) · 1.69 KB
/
models.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
package api
type TeamPairingHistory map[string]TeamPairing
type TeamPairing struct {
Pairs []TeamPair `json:"pairs,omitempty"`
}
type TeamPair struct {
People []TeamPerson `json:"people,omitempty"`
Roles []TeamRole `json:"roles,omitempty"`
Tracks []TeamTrack `json:"tracks,omitempty"`
}
type TeamPerson struct {
ID string `json:"id,omitempty"`
DisplayName string `json:"displayName,omitempty"`
}
type TeamRole struct {
ID string `json:"id,omitempty"`
Name string `json:"name,omitempty"`
}
type TeamTrack struct {
ID string `json:"id,omitempty"`
Name string `json:"name,omitempty"`
}
type TeamLists struct {
Lists []TeamList `json:"lists,omitempty"`
}
type TeamList struct {
Title string `json:"title,omitempty"`
Order uint `json:"order,omitempty"`
Items []TeamListItem `json:"items,omitempty"`
}
type TeamListItem struct {
Text string `json:"text,omitempty"`
Order uint `json:"order,omitempty"`
Reactions map[string]TeamListItemReaction `json:"reactions,omitempty"`
}
type TeamListItemReaction struct {
Count uint `json:"count,omitempty"`
Timestamp uint `json:"timestamp,omitempty"`
}
func (pairing TeamPairing) ByRole(roleName string) []TeamPair {
var res []TeamPair
for _, pair := range pairing.Pairs {
for _, role := range pair.Roles {
if role.Name == roleName {
res = append(res, pair)
break
}
}
}
return res
}
func (pairing TeamPairing) ByTrack(trackName string) []TeamPair {
var res []TeamPair
for _, pair := range pairing.Pairs {
for _, track := range pair.Tracks {
if track.Name == trackName {
res = append(res, pair)
break
}
}
}
return res
}