feat: log sent notifications for analysis

See #535
This commit is contained in:
Gregor Kleen 2019-11-18 11:05:10 +01:00
parent ab3e2baef7
commit c5ef6bb5a5
2 changed files with 14 additions and 1 deletions

View File

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

View File

@ -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'