update team_list.go

add `GetUserGroupTeams` function
This commit is contained in:
☙◦ The Tablet ❀ GamerGirlandCo ◦❧
2026-04-02 20:00:46 -04:00
parent 4690164a3f
commit a8da652180
+12
View File
@@ -126,6 +126,18 @@ func GetUserRepoTeams(ctx context.Context, orgID, userID, repoID int64) (teams T
Find(&teams)
}
// GetUserGroupTeams returns teams in a group that a user has access to
func GetUserGroupTeams(ctx context.Context, groupID, userID int64) (teams TeamList, err error) {
err = db.GetEngine(ctx).
Where("`group_team`.group_id = ?", groupID).
Join("INNER", "group_team", "`group_team`.team_id = `team`.id").
Join("INNER", "team_user", "`team_user`.team_id = `team`.id").
And("`team_user`.uid = ?", userID).
Asc("`team`.name").
Find(&teams)
return
}
func GetTeamsByOrgIDs(ctx context.Context, orgIDs []int64) (TeamList, error) {
teams := make([]*Team, 0, 10)
return teams, db.GetEngine(ctx).Where(builder.In("org_id", orgIDs)).Find(&teams)