diff options
Diffstat (limited to 'src/server/Json.hs')
-rw-r--r-- | src/server/Json.hs | 15 |
1 files changed, 5 insertions, 10 deletions
diff --git a/src/server/Json.hs b/src/server/Json.hs index 408742a..cc6327a 100644 --- a/src/server/Json.hs +++ b/src/server/Json.hs @@ -6,19 +6,14 @@ module Json , jsonId ) where -import Web.Scotty - +import Data.Int (Int64) +import Data.Text (Text) import qualified Data.Aeson.Types as Json import qualified Data.HashMap.Strict as M -import Data.Text (Text) - -import Database.Persist -import Database.Persist.Sqlite - -import Model.Database +import Web.Scotty jsonObject :: [(Text, Json.Value)] -> ActionM () jsonObject = json . Json.Object . M.fromList -jsonId :: (ToBackendKey SqlBackend a) => Key a -> ActionM () -jsonId key = json . Json.Object . M.fromList $ [("id", Json.Number . fromIntegral . keyToInt64 $ key)] +jsonId :: Int64 -> ActionM () +jsonId key = json . Json.Object . M.fromList $ [("id", Json.Number . fromIntegral $ key)] |