diff options
author | Joris | 2017-03-24 09:21:04 +0000 |
---|---|---|
committer | Joris | 2017-03-24 09:21:04 +0000 |
commit | cfca18262c1ff48dcb683ddab7d03cf8e55573ff (patch) | |
tree | 8a438430cee7411259fc395d8f3898488e85d750 /src/server/Model/Income.hs | |
parent | 293eb8295162bf0a038f488237db9c9d1316c04d (diff) |
Features/categories
Diffstat (limited to 'src/server/Model/Income.hs')
-rw-r--r-- | src/server/Model/Income.hs | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/src/server/Model/Income.hs b/src/server/Model/Income.hs index b7dd11c..ff6accd 100644 --- a/src/server/Model/Income.hs +++ b/src/server/Model/Income.hs @@ -1,6 +1,5 @@ module Model.Income - ( getJsonIncome - , getIncomes + ( list , create , editOwn , deleteOwn @@ -17,14 +16,14 @@ import Database.Persist import Model.Database import qualified Model.Json.Income as Json +list :: Persist [Json.Income] +list = map getJsonIncome <$> selectList [IncomeDeletedAt ==. Nothing] [] + getJsonIncome :: Entity Income -> Json.Income getJsonIncome incomeEntity = Json.Income (entityKey incomeEntity) (incomeUserId income) (incomeDate income) (incomeAmount income) where income = entityVal incomeEntity -getIncomes :: Persist [Entity Income] -getIncomes = selectList [IncomeDeletedAt ==. Nothing] [] - create :: UserId -> Day -> Int -> Persist IncomeId create userId date amount = do now <- liftIO getCurrentTime |