blob: 7610b25d5ece4aaed84ec27d378a54a6142a80be (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
|
{-# LANGUAGE OverloadedStrings #-}
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 qualified Model.Category as Category
import qualified Model.PaymentCategory as PaymentCategory
import qualified Model.Json.Init as Init
getInit :: Entity User -> Persist Init
getInit user =
liftIO . runDb $ Init.Init <$>
(map User.getJson <$> User.list) <*>
(return . entityKey $ user) <*>
Payment.list <*>
Income.list <*>
Category.list <*>
PaymentCategory.list
|