Skip to content

Commit

Permalink
Add app_data
Browse files Browse the repository at this point in the history
  • Loading branch information
lakhansamani committed Aug 14, 2023
1 parent e625ed9 commit 35e563a
Show file tree
Hide file tree
Showing 12 changed files with 1,511 additions and 88 deletions.
5 changes: 4 additions & 1 deletion server/db/models/user.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,14 @@ type User struct {
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"`
UpdatedAt int64 `json:"updated_at" bson:"updated_at" cql:"updated_at" dynamo:"updated_at"`
CreatedAt int64 `json:"created_at" bson:"created_at" cql:"created_at" dynamo:"created_at"`
AppData *string `json:"app_data" bson:"app_data" cql:"app_data" dynamo:"app_data"`
}

func (user *User) AsAPIUser() *model.User {
isEmailVerified := user.EmailVerifiedAt != nil
isPhoneVerified := user.PhoneNumberVerifiedAt != nil

appDataMap := make(map[string]interface{})
json.Unmarshal([]byte(refs.StringValue(user.AppData)), &appDataMap)
// id := user.ID
// if strings.Contains(id, Collections.User+"/") {
// id = strings.TrimPrefix(id, Collections.User+"/")
Expand All @@ -63,6 +65,7 @@ func (user *User) AsAPIUser() *model.User {
IsMultiFactorAuthEnabled: user.IsMultiFactorAuthEnabled,
CreatedAt: refs.NewInt64Ref(user.CreatedAt),
UpdatedAt: refs.NewInt64Ref(user.UpdatedAt),
AppData: appDataMap,
}
}

Expand Down
1 change: 0 additions & 1 deletion server/email/email.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,6 @@ func getEmailTemplate(event string, data map[string]interface{}) (*model.EmailTe
return nil, err
}
subjectString := buf.String()

return &model.EmailTemplate{
Template: templateString,
Subject: subjectString,
Expand Down
2 changes: 1 addition & 1 deletion server/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ require (
go.mongodb.org/mongo-driver v1.8.1
golang.org/x/crypto v0.4.0
golang.org/x/oauth2 v0.0.0-20210628180205-a41e5a781914
google.golang.org/appengine v1.6.7 // indirect
google.golang.org/appengine v1.6.7
google.golang.org/protobuf v1.28.1 // indirect
gopkg.in/alexcesaro/quotedprintable.v3 v3.0.0-20150716171945-2caba252f4dc // indirect
gopkg.in/mail.v2 v2.3.1
Expand Down
1,275 changes: 1,275 additions & 0 deletions server/go.sum

Large diffs are not rendered by default.

110 changes: 106 additions & 4 deletions server/graph/generated/generated.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 35e563a

Please sign in to comment.