feat(course-events): implement opt handler

This commit is contained in:
Sarah Vaupel 2020-11-05 18:09:17 +01:00
parent d0fe60b951
commit 868a4afcc6
3 changed files with 18 additions and 1 deletions

View File

@ -140,6 +140,8 @@ ScheduleOptActions: Terminübersicht
ScheduleOptOut: Opt-Out
ScheduleOptIn: Opt-In
ScheduleOptSuccess: Terminübersichts-Ausnahme gespeichert
ScheduleReset: Standard
ScheduleTableHeadTime: Zeit

View File

@ -141,6 +141,8 @@ ScheduleOptActions: Schedule
ScheduleOptOut: Opt out
ScheduleOptIn: Opt in
ScheduleOptSuccess: Schedule exception successfully saved
ScheduleReset: Default
ScheduleTableHeadTime: Time

View File

@ -7,4 +7,17 @@ import Import
getCEvScheduleOptR, postCEvScheduleOptR :: TermId -> SchoolId -> CourseShorthand -> CryptoUUIDCourseEvent -> Bool -> Handler Html
getCEvScheduleOptR = postCEvScheduleOptR
postCEvScheduleOptR _tid _ssh _csh _ceid _opt = error "postCEvScheduleOptR: work in progress"
postCEvScheduleOptR tid ssh csh ceId opt = do
uid <- requireAuthId
eId <- decrypt ceId
runDB $ void $ upsert (CourseEventScheduleOpt
{ courseEventScheduleOptCourseEvent = eId
, courseEventScheduleOptUser = uid
, courseEventScheduleOptOpt = opt
})
[ CourseEventScheduleOptOpt =. opt
]
addMessageI Success MsgScheduleOptSuccess
redirect $ CourseR tid ssh csh CShowR