diff --git a/models/jobs.model b/models/jobs.model index 06be9fbeb..49a21a6e1 100644 --- a/models/jobs.model +++ b/models/jobs.model @@ -16,3 +16,10 @@ CronLastExec time UTCTime -- When was the job executed instance InstanceId -- Which uni2work-instance did the work UniqueCronLastExec job + + +SentNotification + content Value + user UserId + time UTCTime + instance InstanceId \ No newline at end of file diff --git a/src/Jobs/Handler/SendNotification.hs b/src/Jobs/Handler/SendNotification.hs index ef98df834..d31833fbd 100644 --- a/src/Jobs/Handler/SendNotification.hs +++ b/src/Jobs/Handler/SendNotification.hs @@ -22,4 +22,10 @@ import Jobs.Handler.SendNotification.CourseRegistered dispatchJobSendNotification :: UserId -> Notification -> Handler () -dispatchJobSendNotification jRecipient jNotification = $(dispatchTH ''Notification) jNotification jRecipient +dispatchJobSendNotification jRecipient jNotification = do + $(dispatchTH ''Notification) jNotification jRecipient + + instanceID' <- getsYesod $ view instanceID + now <- liftIO getCurrentTime + + runDB . insert_ $ SentNotification (toJSON jNotification) jRecipient now instanceID'