[haskell] Fixed models' serialization
This commit is contained in:
parent
15a7d5bef9
commit
b763823376
4 changed files with 23 additions and 23 deletions
|
@ -34,14 +34,14 @@ instance FromJSON Contract where
|
|||
<*> o .: "fulfilled"
|
||||
<*> o .: "terms"
|
||||
instance ToJSON Contract where
|
||||
toEncoding (Contract a i ty e d fa fu te) = pairs ( "accepted" .= a
|
||||
<> "id" .= i
|
||||
<> "type" .= ty
|
||||
<> "expiration" .= e
|
||||
<> "deadlineToAccept" .= d
|
||||
<> "factionSymbol" .= fa
|
||||
<> "fulfilled" .= fu
|
||||
<> "terms" .= te )
|
||||
toJSON (Contract a i ty e d fa fu te) = object [ "accepted" .= a
|
||||
, "id" .= i
|
||||
, "type" .= ty
|
||||
, "expiration" .= e
|
||||
, "deadlineToAccept" .= d
|
||||
, "factionSymbol" .= fa
|
||||
, "fulfilled" .= fu
|
||||
, "terms" .= te ]
|
||||
|
||||
data Delivery = Delivery { destinationSymbol :: T.Text
|
||||
, tradeSymbol :: T.Text
|
||||
|
|
|
@ -32,8 +32,8 @@ instance FromJSON RouteEndpoint where
|
|||
<*> o .: "x"
|
||||
<*> o .: "y"
|
||||
instance ToJSON RouteEndpoint where
|
||||
toEncoding (RouteEndpoint t s ss xx yy) = pairs ( "type" .= t
|
||||
<> "symbol" .= s
|
||||
<> "systemSymbol" .= ss
|
||||
<> "x" .= xx
|
||||
<> "y" .= yy )
|
||||
toJSON (RouteEndpoint t s ss xx yy) = object [ "type" .= t
|
||||
, "symbol" .= s
|
||||
, "systemSymbol" .= ss
|
||||
, "x" .= xx
|
||||
, "y" .= yy ]
|
||||
|
|
|
@ -29,9 +29,9 @@ instance FromJSON System where
|
|||
<*> o .: "y"
|
||||
<*> o .: "waypoints"
|
||||
instance ToJSON System where
|
||||
toEncoding (System ss s t xx yy w) = pairs ( "sectorSymbol" .= ss
|
||||
<> "symbol" .= s
|
||||
<> "type" .= t
|
||||
<> "x" .= xx
|
||||
<> "y" .= yy
|
||||
<> "waypoints" .= w )
|
||||
toJSON (System ss s t xx yy w) = object [ "sectorSymbol" .= ss
|
||||
, "symbol" .= s
|
||||
, "type" .= t
|
||||
, "x" .= xx
|
||||
, "y" .= yy
|
||||
, "waypoints" .= w ]
|
||||
|
|
|
@ -22,7 +22,7 @@ instance FromJSON Waypoint where
|
|||
<*> o .: "x"
|
||||
<*> o .: "y"
|
||||
instance ToJSON Waypoint where
|
||||
toEncoding (Waypoint s t xx yy) = pairs ( "symbol" .= s
|
||||
<> "type" .= t
|
||||
<> "x" .= xx
|
||||
<> "y" .= yy )
|
||||
toJSON (Waypoint s t xx yy) = object [ "symbol" .= s
|
||||
, "type" .= t
|
||||
, "x" .= xx
|
||||
, "y" .= yy ]
|
||||
|
|
Loading…
Add table
Reference in a new issue