Optimize profile fetching and caching

This commit is contained in:
Zed
2023-01-20 04:54:19 +01:00
parent d38b63f5a9
commit ff61d97a1d
7 changed files with 31 additions and 24 deletions

View File

@@ -1,9 +1,14 @@
import options
import jsony
import user, ../types/[graphuser, graphlistmembers]
from ../../types import User, Result, Query, QueryKind
proc parseGraphUser*(json: string): User =
let raw = json.fromJson(GraphUser)
if raw.data.user.result.reason.get("") == "Suspended":
return User(suspended: true)
result = toUser raw.data.user.result.legacy
result.id = raw.data.user.result.restId

View File

@@ -1,3 +1,4 @@
import options
import user
type
@@ -10,3 +11,4 @@ type
UserResult = object
legacy*: RawUser
restId*: string
reason*: Option[string]