fix: User grant id key (#731)

* fix: log id and error message

* fix: user grant by id correct search field
This commit is contained in:
Silvan
2020-09-11 14:51:50 +02:00
committed by GitHub
parent 4926509de0
commit c37d55b069
4 changed files with 12 additions and 10 deletions

View File

@@ -1,16 +1,15 @@
package view
import (
global_model "github.com/caos/zitadel/internal/model"
"time"
"github.com/jinzhu/gorm"
"github.com/lib/pq"
"github.com/caos/zitadel/internal/errors"
global_model "github.com/caos/zitadel/internal/model"
token_model "github.com/caos/zitadel/internal/token/model"
"github.com/caos/zitadel/internal/token/repository/view/model"
"github.com/caos/zitadel/internal/view/repository"
"github.com/jinzhu/gorm"
"github.com/lib/pq"
)
func TokenByID(db *gorm.DB, table, tokenID string) (*model.Token, error) {
@@ -18,7 +17,7 @@ func TokenByID(db *gorm.DB, table, tokenID string) (*model.Token, error) {
query := repository.PrepareGetByKey(table, model.TokenSearchKey(token_model.TokenSearchKeyTokenID), tokenID)
err := query(db, token)
if errors.IsNotFound(err) {
return nil, errors.ThrowNotFound(nil, "VIEW-Nqwf1", "Errors.Token.NotFound")
return nil, errors.ThrowNotFound(nil, "VIEW-6ub3p", "Errors.Token.NotFound")
}
return token, err
}