fix: code review
This commit is contained in:
parent
07c399530b
commit
b7747104ec
|
@ -115,7 +115,7 @@ type StatusUpdateType* {.pure.}= enum
|
|||
type StatusUpdate* = object
|
||||
publicKey*: string
|
||||
statusType*: StatusUpdateType
|
||||
clock*: int64
|
||||
clock*: uint64
|
||||
text*: string
|
||||
|
||||
type Community* = object
|
||||
|
|
|
@ -204,12 +204,12 @@ proc toChat*(jsonChat: JsonNode): Chat =
|
|||
result.membershipUpdateEvents.add(jsonMember.toChatMembershipEvent)
|
||||
|
||||
proc toStatusUpdate*(jsonStatusUpdate: JsonNode): StatusUpdate =
|
||||
let statusTypeInt = jsonStatusUpdate{"status-type"}.getInt
|
||||
let statusTypeInt = jsonStatusUpdate{"statusType"}.getInt
|
||||
let statusType: StatusUpdateType = if statusTypeInt >= ord(low(StatusUpdateType)) or statusTypeInt <= ord(high(StatusUpdateType)): StatusUpdateType(statusTypeInt) else: StatusUpdateType.Unknown
|
||||
result = StatusUpdate(
|
||||
publicKey: jsonStatusUpdate{"public-key"}.getStr,
|
||||
publicKey: jsonStatusUpdate{"publicKey"}.getStr,
|
||||
statusType: statusType,
|
||||
clock: jsonStatusUpdate{"clock"}.getBiggestInt,
|
||||
clock: uint64(jsonStatusUpdate{"clock"}.getBiggestInt),
|
||||
text: jsonStatusUpdate{"text"}.getStr
|
||||
)
|
||||
|
||||
|
|
Loading…
Reference in New Issue