Skip to content

Commit 09cfad9

Browse files
authored
Merge pull request #382 from authorizerdev/feat-add-field-for-app-data
Add app_data
2 parents e625ed9 + 35e563a commit 09cfad9

File tree

12 files changed

+1511
-88
lines changed

12 files changed

+1511
-88
lines changed

server/db/models/user.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,12 +33,14 @@ type User struct {
3333
IsMultiFactorAuthEnabled *bool `json:"is_multi_factor_auth_enabled" bson:"is_multi_factor_auth_enabled" cql:"is_multi_factor_auth_enabled" dynamo:"is_multi_factor_auth_enabled"`
3434
UpdatedAt int64 `json:"updated_at" bson:"updated_at" cql:"updated_at" dynamo:"updated_at"`
3535
CreatedAt int64 `json:"created_at" bson:"created_at" cql:"created_at" dynamo:"created_at"`
36+
AppData *string `json:"app_data" bson:"app_data" cql:"app_data" dynamo:"app_data"`
3637
}
3738

3839
func (user *User) AsAPIUser() *model.User {
3940
isEmailVerified := user.EmailVerifiedAt != nil
4041
isPhoneVerified := user.PhoneNumberVerifiedAt != nil
41-
42+
appDataMap := make(map[string]interface{})
43+
json.Unmarshal([]byte(refs.StringValue(user.AppData)), &appDataMap)
4244
// id := user.ID
4345
// if strings.Contains(id, Collections.User+"/") {
4446
// id = strings.TrimPrefix(id, Collections.User+"/")
@@ -63,6 +65,7 @@ func (user *User) AsAPIUser() *model.User {
6365
IsMultiFactorAuthEnabled: user.IsMultiFactorAuthEnabled,
6466
CreatedAt: refs.NewInt64Ref(user.CreatedAt),
6567
UpdatedAt: refs.NewInt64Ref(user.UpdatedAt),
68+
AppData: appDataMap,
6669
}
6770
}
6871

server/email/email.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,6 @@ func getEmailTemplate(event string, data map[string]interface{}) (*model.EmailTe
7272
return nil, err
7373
}
7474
subjectString := buf.String()
75-
7675
return &model.EmailTemplate{
7776
Template: templateString,
7877
Subject: subjectString,

server/go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ require (
3030
go.mongodb.org/mongo-driver v1.8.1
3131
golang.org/x/crypto v0.4.0
3232
golang.org/x/oauth2 v0.0.0-20210628180205-a41e5a781914
33-
google.golang.org/appengine v1.6.7 // indirect
33+
google.golang.org/appengine v1.6.7
3434
google.golang.org/protobuf v1.28.1 // indirect
3535
gopkg.in/alexcesaro/quotedprintable.v3 v3.0.0-20150716171945-2caba252f4dc // indirect
3636
gopkg.in/mail.v2 v2.3.1

server/go.sum

Lines changed: 1275 additions & 0 deletions
Large diffs are not rendered by default.

server/graph/generated/generated.go

Lines changed: 106 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)