summaryrefslogtreecommitdiff
path: root/Model.hs
diff options
context:
space:
mode:
Diffstat (limited to 'Model.hs')
-rw-r--r--Model.hs14
1 files changed, 8 insertions, 6 deletions
diff --git a/Model.hs b/Model.hs
index 0339c59..ac38890 100644
--- a/Model.hs
+++ b/Model.hs
@@ -18,12 +18,13 @@ share [mkPersist sqlSettings, mkMigrate "migrateAll"]
instance ToJSON (Entity Shop) where
toJSON (Entity sid s) = object
- [ "id" .= (String $ toPathPiece sid)
- , "ident" .= (String $ shopIdent s)
- , "vendor" .= (String $ toPathPiece $ shopVendor s)
- , "image" .= maybe Null (String . toPathPiece) (shopImage s)
- , "created" .= shopCreated s
- , "updated" .= shopUpdated s
+ [ "id" .= (String $ toPathPiece sid)
+ , "ident" .= (String $ shopIdent s)
+ , "vendor" .= (String $ toPathPiece $ shopVendor s)
+ , "image" .= maybe Null (String . toPathPiece) (shopImage s)
+ , "location" .= [ toJSON $ pntLon $ shopLocation s, toJSON $ pntLat $ shopLocation s ]
+ , "created" .= shopCreated s
+ , "updated" .= shopUpdated s
]
instance FromJSON Shop where
@@ -31,6 +32,7 @@ instance FromJSON Shop where
<$> o .: "ident"
<*> o .: "vendor"
<*> o .:? "image"
+ <*> o .: "location"
<*> o .: "created"
<*> o .: "updated"