diff options
author | Joris | 2019-11-03 11:28:42 +0100 |
---|---|---|
committer | Joris | 2019-11-03 11:28:42 +0100 |
commit | 9dbb4e6f7c2f0edc1126626e2ff498144c6b9947 (patch) | |
tree | da352e0861a2786a3a57dab2397ec7d678b5919b /server/src/Persistence | |
parent | a267f0bb4566389342c3244d3c082dc2453f4615 (diff) |
Show income header
Diffstat (limited to 'server/src/Persistence')
-rw-r--r-- | server/src/Persistence/Income.hs | 23 |
1 files changed, 13 insertions, 10 deletions
diff --git a/server/src/Persistence/Income.hs b/server/src/Persistence/Income.hs index de55a18..4ae3228 100644 --- a/server/src/Persistence/Income.hs +++ b/server/src/Persistence/Income.hs @@ -1,7 +1,7 @@ module Persistence.Income ( count , list - , listv2 + , listAll , create , edit , delete @@ -43,15 +43,8 @@ count = SQLite.query_ conn "SELECT COUNT(*) FROM income WHERE deleted_at IS NULL" ) -list :: Query [Income] -list = - Query (\conn -> - map (\(Row i) -> i) <$> - SQLite.query_ conn "SELECT * FROM income WHERE deleted_at IS NULL" - ) - -listv2 :: Int -> Int -> Query [Income] -listv2 page perPage = +list :: Int -> Int -> Query [Income] +list page perPage = Query (\conn -> map (\(Row i) -> i) <$> SQLite.query @@ -60,6 +53,16 @@ listv2 page perPage = (perPage, (page - 1) * perPage) ) +listAll :: Query [Income] +listAll = + Query (\conn -> + map (\(Row i) -> i) <$> + SQLite.query_ conn "SELECT * FROM income WHERE deleted_at IS NULL" + ) + +-- firstIncomeByUser +-- SELECT user_id, MIN(date) FROM income WHERE deleted_at IS NULL GROUP BY user_id; + create :: UserId -> Day -> Int -> Query Income create userId date amount = Query (\conn -> do |