Find(&teams)
}
+func getUserRepoTeams(e Engine, orgID, userID, repoID int64) (teams []*Team, err error) {
+ return teams, e.
+ Join("INNER", "team_user", "team_user.team_id = team.id").
+ Join("INNER", "team_repo", "team_repo.team_id = team.id").
+ Where("team.org_id = ?", orgID).
+ And("team_user.uid=?", userID).
+ And("team_repo.repo_id=?", repoID).
+ Find(&teams)
+}
+
// GetUserTeams returns all teams that user belongs to in given organization.
func GetUserTeams(orgID, userID int64) ([]*Team, error) {
return getUserTeams(x, orgID, userID)
return nil
}
- teams, err := getUserTeams(e, repo.OwnerID, userID)
+ teams, err := getUserRepoTeams(e, repo.OwnerID, userID, repo.ID)
if err != nil {
return err
}