diff options
author | Joris | 2017-06-05 18:02:13 +0200 |
---|---|---|
committer | Joris | 2017-06-05 18:02:13 +0200 |
commit | 0b191f5c48edffc9da3e38c284e9640fd82e7cb1 (patch) | |
tree | c729e53822e7c41c1a854d82d25636e58ee65c9f /src/server/Model/Init.hs | |
parent | 5c110716cfda6e616a795edd12f2012b132dca9f (diff) |
Replace persistent by sqlite-simple
Diffstat (limited to 'src/server/Model/Init.hs')
-rw-r--r-- | src/server/Model/Init.hs | 38 |
1 files changed, 19 insertions, 19 deletions
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) |