Add resolver to update profile

Resolves #12 #11
This commit is contained in:
Lakhan Samani
2021-07-18 09:25:20 +05:30
parent 83b3149c0b
commit 7d17032fc2
14 changed files with 460 additions and 246 deletions

View File

@@ -6,6 +6,7 @@ import (
"github.com/yauthdev/yauth/server/db"
"github.com/yauthdev/yauth/server/graph/model"
"github.com/yauthdev/yauth/server/session"
"github.com/yauthdev/yauth/server/utils"
)
@@ -26,6 +27,12 @@ func Profile(ctx context.Context) (*model.User, error) {
return res, err
}
sessionToken := session.GetToken(claim.ID)
if sessionToken == "" {
return res, fmt.Errorf(`unauthorized`)
}
user, err := db.Mgr.GetUserByEmail(claim.Email)
if err != nil {
return res, err