14 lines
419 B
Haskell
14 lines
419 B
Haskell
module Jobs.Handler.PruneInvitations
|
|
( dispatchJobPruneInvitations
|
|
) where
|
|
|
|
import Import
|
|
|
|
import Database.Persist.Sql (deleteWhereCount)
|
|
|
|
dispatchJobPruneInvitations :: JobHandler UniWorX
|
|
dispatchJobPruneInvitations = JobHandlerAtomic . hoist lift $ do
|
|
now <- liftIO getCurrentTime
|
|
n <- deleteWhereCount [ InvitationExpiresAt <. Just now ]
|
|
$logInfoS "PruneInvitations" [st|Deleted #{n} expired invitations|]
|