Skip to content

Commit 1681530

Browse files
adelowotechknowlogick
authored andcommitted
make sure units of a team are returned (#6379) (#6381)
1 parent 3934d9c commit 1681530

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

models/org_team.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,11 @@ type Team struct {
3333
Units []*TeamUnit `xorm:"-"`
3434
}
3535

36+
// GetUnits return a list of available units for a team
37+
func (t *Team) GetUnits() error {
38+
return t.getUnits(x)
39+
}
40+
3641
func (t *Team) getUnits(e Engine) (err error) {
3742
if t.Units != nil {
3843
return nil

routers/api/v1/org/team.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,11 @@ func ListTeams(ctx *context.APIContext) {
3838

3939
apiTeams := make([]*api.Team, len(org.Teams))
4040
for i := range org.Teams {
41+
if err := org.Teams[i].GetUnits(); err != nil {
42+
ctx.Error(500, "GetUnits", err)
43+
return
44+
}
45+
4146
apiTeams[i] = convert.ToTeam(org.Teams[i])
4247
}
4348
ctx.JSON(200, apiTeams)

0 commit comments

Comments
 (0)