1
0
Fork 0

[haskell] Fixed models' serialization

This commit is contained in:
Julien Dessaux 2023-07-19 22:04:46 +02:00
parent 15a7d5bef9
commit b763823376
Signed by: adyxax
GPG key ID: F92E51B86E07177E
4 changed files with 23 additions and 23 deletions

View file

@ -34,14 +34,14 @@ instance FromJSON Contract where
<*> o .: "fulfilled" <*> o .: "fulfilled"
<*> o .: "terms" <*> o .: "terms"
instance ToJSON Contract where instance ToJSON Contract where
toEncoding (Contract a i ty e d fa fu te) = pairs ( "accepted" .= a toJSON (Contract a i ty e d fa fu te) = object [ "accepted" .= a
<> "id" .= i , "id" .= i
<> "type" .= ty , "type" .= ty
<> "expiration" .= e , "expiration" .= e
<> "deadlineToAccept" .= d , "deadlineToAccept" .= d
<> "factionSymbol" .= fa , "factionSymbol" .= fa
<> "fulfilled" .= fu , "fulfilled" .= fu
<> "terms" .= te ) , "terms" .= te ]
data Delivery = Delivery { destinationSymbol :: T.Text data Delivery = Delivery { destinationSymbol :: T.Text
, tradeSymbol :: T.Text , tradeSymbol :: T.Text

View file

@ -32,8 +32,8 @@ instance FromJSON RouteEndpoint where
<*> o .: "x" <*> o .: "x"
<*> o .: "y" <*> o .: "y"
instance ToJSON RouteEndpoint where instance ToJSON RouteEndpoint where
toEncoding (RouteEndpoint t s ss xx yy) = pairs ( "type" .= t toJSON (RouteEndpoint t s ss xx yy) = object [ "type" .= t
<> "symbol" .= s , "symbol" .= s
<> "systemSymbol" .= ss , "systemSymbol" .= ss
<> "x" .= xx , "x" .= xx
<> "y" .= yy ) , "y" .= yy ]

View file

@ -29,9 +29,9 @@ instance FromJSON System where
<*> o .: "y" <*> o .: "y"
<*> o .: "waypoints" <*> o .: "waypoints"
instance ToJSON System where instance ToJSON System where
toEncoding (System ss s t xx yy w) = pairs ( "sectorSymbol" .= ss toJSON (System ss s t xx yy w) = object [ "sectorSymbol" .= ss
<> "symbol" .= s , "symbol" .= s
<> "type" .= t , "type" .= t
<> "x" .= xx , "x" .= xx
<> "y" .= yy , "y" .= yy
<> "waypoints" .= w ) , "waypoints" .= w ]

View file

@ -22,7 +22,7 @@ instance FromJSON Waypoint where
<*> o .: "x" <*> o .: "x"
<*> o .: "y" <*> o .: "y"
instance ToJSON Waypoint where instance ToJSON Waypoint where
toEncoding (Waypoint s t xx yy) = pairs ( "symbol" .= s toJSON (Waypoint s t xx yy) = object [ "symbol" .= s
<> "type" .= t , "type" .= t
<> "x" .= xx , "x" .= xx
<> "y" .= yy ) , "y" .= yy ]