return pointer to team

This commit is contained in:
viehlieb 2023-05-09 13:34:44 +02:00
parent de5ef2147d
commit 5c033c52fc
1 changed files with 5 additions and 4 deletions

View File

@ -131,17 +131,18 @@ func GetTeamByID(s *xorm.Session, id int64) (team *Team, err error) {
// GetTeamByOidcIDAndName gets teams where oidc_id and name match parameters
// For oidc team creation oidcID and Name need to be set
func GetTeamByOidcIDAndName(s *xorm.Session, oidcID string, teamName string) (team Team, err error) {
func GetTeamByOidcIDAndName(s *xorm.Session, oidcID string, teamName string) (*Team, error) {
team := &Team{}
has, err := s.
Table("teams").
Where("oidc_id = ? AND name = ?", oidcID, teamName).
Asc("id").
Limit(1).
Get(&team)
Get(team)
if !has || err != nil {
return team, ErrOIDCTeamDoesNotExist{teamName, oidcID}
return nil, ErrOIDCTeamDoesNotExist{teamName, oidcID}
}
return team, err
return team, nil
}
func FindAllOidcTeamIDsForUser(s *xorm.Session, userID int64) (ts []int64, err error) {