fix profile name key assignment

This commit is contained in:
Iuri Matias 2020-06-18 13:28:41 -04:00
parent 73ef443da5
commit 95beeae131
1 changed files with 28 additions and 27 deletions

View File

@ -9,33 +9,34 @@ type Profile* = ref object
systemTags*: seq[string]
proc toProfileModel*(account: Account): Profile =
result = Profile(
id: "",
username: account.name,
identicon: account.photoPath,
alias: account.name,
ensName: "",
ensVerified: false,
ensVerifiedAt: 0,
ensVerificationRetries: 0,
systemTags: @[]
)
result = Profile(
id: "",
username: account.name,
identicon: account.photoPath,
alias: account.name,
ensName: "",
ensVerified: false,
ensVerifiedAt: 0,
ensVerificationRetries: 0,
systemTags: @[]
)
proc toProfileModel*(profile: JsonNode): Profile =
var systemTags: seq[string] = @[]
if profile["systemTags"].kind != JNull:
systemTags = profile["systemTags"].to(seq[string])
var systemTags: seq[string] = @[]
if profile["systemTags"].kind != JNull:
systemTags = profile["systemTags"].to(seq[string])
result = Profile(
id: profile["id"].str,
username: profile["alias"].str,
identicon: profile["identicon"].str,
address: profile["id"].str,
alias: profile["alias"].str,
# ensName: profile["name"].str, // doesn't seems to exist
ensName: "",
ensVerified: profile["ensVerified"].getBool,
ensVerifiedAt: profile["ensVerifiedAt"].getInt,
ensVerificationRetries: profile["ensVerificationRetries"].getInt,
systemTags: systemTags
)
result = Profile(
id: profile["id"].str,
username: profile["alias"].str,
identicon: profile["identicon"].str,
address: profile["id"].str,
alias: profile["alias"].str,
ensName: "",
ensVerified: profile["ensVerified"].getBool,
ensVerifiedAt: profile["ensVerifiedAt"].getInt,
ensVerificationRetries: profile["ensVerificationRetries"].getInt,
systemTags: systemTags
)
if profile.hasKey("name"):
result.ensName = profile["name"].str