fix: update to use db.Provider
This commit is contained in:
@@ -10,7 +10,7 @@ import (
|
||||
"time"
|
||||
|
||||
"github.com/authorizerdev/authorizer/server/constants"
|
||||
"github.com/authorizerdev/authorizer/server/db"
|
||||
"github.com/authorizerdev/authorizer/server/db/models"
|
||||
"github.com/authorizerdev/authorizer/server/envstore"
|
||||
"github.com/gin-gonic/gin"
|
||||
"github.com/golang-jwt/jwt"
|
||||
@@ -20,7 +20,7 @@ import (
|
||||
|
||||
// CreateAuthToken util to create JWT token, based on
|
||||
// user information, roles config and CUSTOM_ACCESS_TOKEN_SCRIPT
|
||||
func CreateAuthToken(user db.User, tokenType string, roles []string) (string, int64, error) {
|
||||
func CreateAuthToken(user models.User, tokenType string, roles []string) (string, int64, error) {
|
||||
t := jwt.New(jwt.GetSigningMethod(envstore.EnvInMemoryStoreObj.GetStringStoreEnvVariable(constants.EnvKeyJwtType)))
|
||||
expiryBound := time.Hour
|
||||
if tokenType == constants.TokenTypeRefreshToken {
|
||||
|
@@ -27,7 +27,7 @@ func SaveSessionInDB(userId string, c *gin.Context) {
|
||||
IP: GetIP(c.Request),
|
||||
}
|
||||
|
||||
err := db.Provider.AddSession(&sessionData)
|
||||
err := db.Provider.AddSession(sessionData)
|
||||
if err != nil {
|
||||
log.Println("=> error saving session in db:", err)
|
||||
} else {
|
||||
|
@@ -3,14 +3,14 @@ package utils
|
||||
import (
|
||||
"strings"
|
||||
|
||||
"github.com/authorizerdev/authorizer/server/db"
|
||||
"github.com/authorizerdev/authorizer/server/db/models"
|
||||
"github.com/authorizerdev/authorizer/server/graph/model"
|
||||
)
|
||||
|
||||
// TODO move this to provider
|
||||
// rename it to AsAPIUser
|
||||
|
||||
func GetResponseUserData(user db.User) *model.User {
|
||||
func GetResponseUserData(user models.User) *model.User {
|
||||
isEmailVerified := user.EmailVerifiedAt != nil
|
||||
isPhoneVerified := user.PhoneNumberVerifiedAt != nil
|
||||
return &model.User{
|
||||
|
Reference in New Issue
Block a user