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|]