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