Add app_data

This commit is contained in:
Lakhan Samani
2023-08-14 12:01:37 +05:30
parent e625ed9633
commit 35e563ab3b
12 changed files with 1511 additions and 88 deletions

View File

@@ -2,6 +2,7 @@ package resolvers
import (
"context"
"encoding/json"
"errors"
"fmt"
"strings"
@@ -95,6 +96,17 @@ func UpdateUserResolver(ctx context.Context, params model.UpdateUserInput) (*mod
user.Picture = params.Picture
}
if params.AppData != nil {
appDataString := ""
appDataBytes, err := json.Marshal(params.AppData)
if err != nil {
log.Debug("failed to marshall source app_data: ", err)
return nil, errors.New("malformed app_data")
}
appDataString = string(appDataBytes)
user.AppData = &appDataString
}
if params.IsMultiFactorAuthEnabled != nil && refs.BoolValue(user.IsMultiFactorAuthEnabled) != refs.BoolValue(params.IsMultiFactorAuthEnabled) {
user.IsMultiFactorAuthEnabled = params.IsMultiFactorAuthEnabled
if refs.BoolValue(params.IsMultiFactorAuthEnabled) {