mirror of
https://github.com/twofas/2fas-server.git
synced 2024-12-04 16:20:13 +01:00
review fixes
This commit is contained in:
parent
a268382982
commit
3a9f707239
@ -56,10 +56,11 @@ func (r *WebServiceMysqlRepository) FindById(id uuid.UUID) (*domain.WebService,
|
||||
|
||||
result := r.db.First(&webService, "id = ?", id.String())
|
||||
|
||||
if errors.Is(result.Error, gorm.ErrRecordNotFound) {
|
||||
return nil, WebServiceCouldNotBeFound{WebServiceId: id.String()}
|
||||
} else if result.Error != nil {
|
||||
return nil, db.WrapError(result.Error)
|
||||
if err := result.Error; err != nil {
|
||||
if errors.Is(err, gorm.ErrRecordNotFound) {
|
||||
return nil, WebServiceCouldNotBeFound{WebServiceId: id.String()}
|
||||
}
|
||||
return nil, db.WrapError(err)
|
||||
}
|
||||
|
||||
return webService, nil
|
||||
@ -70,9 +71,10 @@ func (r *WebServiceMysqlRepository) FindByName(name string) (*domain.WebService,
|
||||
|
||||
result := r.db.First(&webService, "name = ?", name)
|
||||
|
||||
if err := result.Error; errors.Is(err, gorm.ErrRecordNotFound) {
|
||||
return nil, errors.New("web service could not be found")
|
||||
} else if err != nil {
|
||||
if err := result.Error; err != nil {
|
||||
if errors.Is(err, gorm.ErrRecordNotFound) {
|
||||
return nil, errors.New("web service could not be found")
|
||||
}
|
||||
return nil, db.WrapError(err)
|
||||
}
|
||||
|
||||
|
@ -1,8 +1,9 @@
|
||||
package queries
|
||||
|
||||
import (
|
||||
"errors"
|
||||
|
||||
"github.com/doug-martin/goqu/v9"
|
||||
"github.com/pkg/errors"
|
||||
"gorm.io/datatypes"
|
||||
"gorm.io/gorm"
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user