aboutsummaryrefslogtreecommitdiff
path: root/src/server/Job
diff options
context:
space:
mode:
Diffstat (limited to 'src/server/Job')
-rw-r--r--src/server/Job/MonthlyPayment.hs11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/server/Job/MonthlyPayment.hs b/src/server/Job/MonthlyPayment.hs
index 8c11ccf..ba24cca 100644
--- a/src/server/Job/MonthlyPayment.hs
+++ b/src/server/Job/MonthlyPayment.hs
@@ -4,7 +4,8 @@ module Job.MonthlyPayment
import Data.Time.Clock (UTCTime, getCurrentTime)
-import Model.Frequency
+import Common.Model (Frequency(..), Payment(..))
+
import qualified Model.Payment as Payment
import Utils.Time (timeToDay)
import qualified Model.Query as Query
@@ -14,6 +15,12 @@ monthlyPayment _ = do
monthlyPayments <- Query.run Payment.listMonthly
now <- getCurrentTime
actualDay <- timeToDay now
- let punctualPayments = map (\p -> p { Payment.frequency = Punctual, Payment.date = actualDay, Payment.createdAt = now }) monthlyPayments
+ let punctualPayments = map
+ (\p -> p
+ { _payment_frequency = Punctual
+ , _payment_date = actualDay
+ , _payment_createdAt = now
+ })
+ monthlyPayments
_ <- Query.run (Payment.createMany punctualPayments)
return now