team.go 436 B

1234567891011121314151617181920212223
  1. package org
  2. import (
  3. "gitote/gitote/pkg/context"
  4. "gitote/gitote/routes/api/v1/convert"
  5. api "gitlab.com/gitote/go-gitote-client"
  6. )
  7. func ListTeams(c *context.APIContext) {
  8. org := c.Org.Organization
  9. if err := org.GetTeams(); err != nil {
  10. c.Error(500, "GetTeams", err)
  11. return
  12. }
  13. apiTeams := make([]*api.Team, len(org.Teams))
  14. for i := range org.Teams {
  15. apiTeams[i] = convert.ToTeam(org.Teams[i])
  16. }
  17. c.JSON(200, apiTeams)
  18. }