return single team for GetTeamByOidcIDAndName
continuous-integration/drone/pr Build is failing
Details
continuous-integration/drone/pr Build is failing
Details
This commit is contained in:
parent
85307ce666
commit
146fa2c70a
|
@ -20,7 +20,6 @@ import (
|
|||
"time"
|
||||
|
||||
"code.vikunja.io/api/pkg/db"
|
||||
"code.vikunja.io/api/pkg/log"
|
||||
|
||||
"code.vikunja.io/api/pkg/events"
|
||||
"code.vikunja.io/api/pkg/user"
|
||||
|
@ -151,15 +150,16 @@ 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) {
|
||||
exists, err := s.
|
||||
err = s.
|
||||
Table("teams").
|
||||
Where("oidc_id = ? AND name = ?", oidcID, teamName).
|
||||
Get(&team)
|
||||
log.Debugf("GetTeamByOidcIDAndName: %v, exists: %v", team.Name, exists)
|
||||
if exists && err == nil {
|
||||
return team, nil
|
||||
OrderBy("name ASC").
|
||||
Limit(1).
|
||||
Find(&team)
|
||||
if err != nil {
|
||||
return team, ErrOIDCTeamDoesNotExist{teamName, oidcID}
|
||||
}
|
||||
return team, ErrOIDCTeamDoesNotExist{teamName, oidcID}
|
||||
return team, err
|
||||
}
|
||||
|
||||
func FindAllOidcTeamIDsForUser(s *xorm.Session, userID int64) (ts []int64, err error) {
|
||||
|
|
Loading…
Reference in New Issue