Extend PostgreSQL implementation and unit tests on MongoDB storage
This commit is contained in:
@@ -10,9 +10,10 @@ import (
|
||||
)
|
||||
|
||||
func (a Account) ToStorageType() storage.Account {
|
||||
var localauth storage.LocalAuth
|
||||
var localauth *storage.LocalAuth
|
||||
if a.Authentication != nil && a.Authentication.Local != nil {
|
||||
localauth = a.Authentication.Local.ToStorageType()
|
||||
la := a.Authentication.Local.ToStorageType()
|
||||
localauth = &la
|
||||
}
|
||||
account := storage.Account{
|
||||
ID: a.Id,
|
||||
@@ -42,12 +43,12 @@ func (lc LocalAuth) ToStorageType() storage.LocalAuth {
|
||||
Username: lc.Username,
|
||||
Password: lc.Password,
|
||||
Email: lc.Email,
|
||||
EmailValidation: storage.Validation{
|
||||
EmailValidation: &storage.Validation{
|
||||
Validated: lc.EmailValidation.Validated,
|
||||
ValidationCode: lc.EmailValidation.ValidationCode,
|
||||
},
|
||||
PhoneNumber: lc.PhoneNumber,
|
||||
PhoneNumberValidation: storage.Validation{
|
||||
PhoneNumberValidation: &storage.Validation{
|
||||
Validated: lc.PhoneNumberValidation.Validated,
|
||||
ValidationCode: lc.PhoneNumberValidation.ValidationCode,
|
||||
},
|
||||
@@ -55,7 +56,10 @@ func (lc LocalAuth) ToStorageType() storage.LocalAuth {
|
||||
}
|
||||
|
||||
func AccountFromStorageType(account *storage.Account) (*Account, error) {
|
||||
lc := LocalAuthFromStorageType(account.Authentication.Local)
|
||||
var lc *LocalAuth
|
||||
if account.Authentication.Local != nil {
|
||||
lc = LocalAuthFromStorageType(*account.Authentication.Local)
|
||||
}
|
||||
|
||||
d, err := sanitizeData(account.Data)
|
||||
if err != nil {
|
||||
|
||||
Reference in New Issue
Block a user