diff options
author | Joris | 2020-01-20 19:47:23 +0100 |
---|---|---|
committer | Joris | 2020-01-20 22:11:19 +0100 |
commit | 47c2a4d6b68c54eed5f7b45671b1ccaf8c0db200 (patch) | |
tree | f5c1c4281bb26810bdd0fea3d6582d3eafa227cf /server/src/Persistence | |
parent | d20d7ceec2a14f79ebb06555a71d424aeaa90e54 (diff) |
Show payment stats
Diffstat (limited to 'server/src/Persistence')
-rw-r--r-- | server/src/Persistence/Payment.hs | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/server/src/Persistence/Payment.hs b/server/src/Persistence/Payment.hs index b3eb141..573d57f 100644 --- a/server/src/Persistence/Payment.hs +++ b/server/src/Persistence/Payment.hs @@ -2,6 +2,7 @@ module Persistence.Payment ( count , find , getRange + , listAllPunctual , listActivePage , listModifiedPunctualSince , listActiveMonthlyOrderedByName @@ -140,6 +141,24 @@ getRange = ] ) +listAllPunctual :: Query [Payment] +listAllPunctual = + Query (\conn -> + map (\(Row p) -> p) <$> + SQLite.queryNamed + conn + (SQLite.Query $ T.intercalate " " + [ "SELECT" + , fields + , "FROM payment" + , "WHERE deleted_at IS NULL AND frequency = :frequency" + , "ORDER BY date" + ]) + [ ":frequency" := FrequencyField Punctual + ] + ) + + listActivePage :: Frequency -> Int -> Int -> Text -> Query [Payment] listActivePage frequency page perPage search = Query (\conn -> |