From 0b191f5c48edffc9da3e38c284e9640fd82e7cb1 Mon Sep 17 00:00:00 2001 From: Joris Date: Mon, 5 Jun 2017 18:02:13 +0200 Subject: Replace persistent by sqlite-simple --- src/server/Model/Init.hs | 38 +++++++++++++++++++------------------- 1 file changed, 19 insertions(+), 19 deletions(-) (limited to 'src/server/Model/Init.hs') diff --git a/src/server/Model/Init.hs b/src/server/Model/Init.hs index 7610b25..7a9ccea 100644 --- a/src/server/Model/Init.hs +++ b/src/server/Model/Init.hs @@ -4,27 +4,27 @@ module Model.Init ( getInit ) where -import Control.Monad.IO.Class (liftIO) - -import Database.Persist - -import Model.Database - import Model.Json.Init (Init) -import qualified Model.Payment as Payment -import qualified Model.User as User -import qualified Model.Income as Income +import Model.Query (Query) +import Model.User (User) import qualified Model.Category as Category -import qualified Model.PaymentCategory as PaymentCategory - +import qualified Model.Income as Income +import qualified Model.Json.Category as Json +import qualified Model.Json.Income as Json import qualified Model.Json.Init as Init +import qualified Model.Json.Payment as Json +import qualified Model.Json.PaymentCategory as Json +import qualified Model.Json.User as Json +import qualified Model.Payment as Payment +import qualified Model.PaymentCategory as PaymentCategory +import qualified Model.User as User -getInit :: Entity User -> Persist Init +getInit :: User -> Query Init getInit user = - liftIO . runDb $ Init.Init <$> - (map User.getJson <$> User.list) <*> - (return . entityKey $ user) <*> - Payment.list <*> - Income.list <*> - Category.list <*> - PaymentCategory.list + Init.Init <$> + (map Json.fromUser <$> User.list) <*> + (return . User.id $ user) <*> + (map Json.fromPayment <$> Payment.list) <*> + (map Json.fromIncome <$> Income.list) <*> + (map Json.fromCategory <$> Category.list) <*> + (map Json.fromPaymentCategory <$> PaymentCategory.list) -- cgit v1.2.3