diff options
Diffstat (limited to 'src/server/Model/Income.hs')
-rw-r--r-- | src/server/Model/Income.hs | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/src/server/Model/Income.hs b/src/server/Model/Income.hs index f389661..b7dd11c 100644 --- a/src/server/Model/Income.hs +++ b/src/server/Model/Income.hs @@ -4,9 +4,10 @@ module Model.Income , create , editOwn , deleteOwn + , modifiedDuring ) where -import Data.Time.Clock (getCurrentTime) +import Data.Time.Clock (UTCTime, getCurrentTime) import Data.Time.Calendar (Day) import Control.Monad.IO.Class (liftIO) @@ -62,3 +63,12 @@ deleteOwn user incomeId = do return False Nothing -> return False + +modifiedDuring :: UTCTime -> UTCTime -> Persist [Income] +modifiedDuring start end = + map entityVal <$> selectList + ( [IncomeCreatedAt >=. start, IncomeCreatedAt <. end] + ||. [IncomeEditedAt >=. Just start, IncomeEditedAt <. Just end] + ||. [IncomeDeletedAt >=. Just start, IncomeDeletedAt <. Just end] + ) + [] |