fix limit GetTeamByOidcIDAndName to get a single team
This commit is contained in:
parent
a5b6937809
commit
9007ec4a0a
|
@ -150,13 +150,13 @@ func GetTeamsByName(s *xorm.Session, name string) (teams []*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) {
|
||||
err = s.
|
||||
has, err := s.
|
||||
Table("teams").
|
||||
Where("oidc_id = ? AND name = ?", oidcID, teamName).
|
||||
OrderBy("name ASC").
|
||||
Asc("id").
|
||||
Limit(1).
|
||||
Find(&team)
|
||||
if err != nil {
|
||||
Get(&team)
|
||||
if !has || err != nil {
|
||||
return team, ErrOIDCTeamDoesNotExist{teamName, oidcID}
|
||||
}
|
||||
return team, err
|
||||
|
|
Loading…
Reference in New Issue