mirror of
https://github.com/go-gitea/gitea
synced 2024-12-25 18:14:28 +00:00
parent
3934d9cd2f
commit
16815306ad
@ -33,6 +33,11 @@ type Team struct {
|
|||||||
Units []*TeamUnit `xorm:"-"`
|
Units []*TeamUnit `xorm:"-"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// GetUnits return a list of available units for a team
|
||||||
|
func (t *Team) GetUnits() error {
|
||||||
|
return t.getUnits(x)
|
||||||
|
}
|
||||||
|
|
||||||
func (t *Team) getUnits(e Engine) (err error) {
|
func (t *Team) getUnits(e Engine) (err error) {
|
||||||
if t.Units != nil {
|
if t.Units != nil {
|
||||||
return nil
|
return nil
|
||||||
|
@ -38,6 +38,11 @@ func ListTeams(ctx *context.APIContext) {
|
|||||||
|
|
||||||
apiTeams := make([]*api.Team, len(org.Teams))
|
apiTeams := make([]*api.Team, len(org.Teams))
|
||||||
for i := range org.Teams {
|
for i := range org.Teams {
|
||||||
|
if err := org.Teams[i].GetUnits(); err != nil {
|
||||||
|
ctx.Error(500, "GetUnits", err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
apiTeams[i] = convert.ToTeam(org.Teams[i])
|
apiTeams[i] = convert.ToTeam(org.Teams[i])
|
||||||
}
|
}
|
||||||
ctx.JSON(200, apiTeams)
|
ctx.JSON(200, apiTeams)
|
||||||
|
Loading…
Reference in New Issue
Block a user