mend
This commit is contained in:
parent
c3fe47f50d
commit
660f80f871
@ -354,7 +354,7 @@ getPrintDownloadR cupj = do
|
|||||||
getPrintAcknowR, postPrintAcknowR :: Day -> Handler Html
|
getPrintAcknowR, postPrintAcknowR :: Day -> Handler Html
|
||||||
getPrintAcknowR = postPrintAcknowR
|
getPrintAcknowR = postPrintAcknowR
|
||||||
postPrintAcknowR ackDay = do
|
postPrintAcknowR ackDay = do
|
||||||
-- TODO: besser mit cryptoids arbeiten und an den Post Request hängen?!
|
-- TODO: besser mit cryptoids als hiddenfield in Form hineinhängen arbeiten und an den Post Request hängen?!
|
||||||
((ackRes, ackWgt), ackEnctype) <- runFormPost (identifyForm FIDPrintAcknowledge buttonForm :: Form ButtonConfirm)
|
((ackRes, ackWgt), ackEnctype) <- runFormPost (identifyForm FIDPrintAcknowledge buttonForm :: Form ButtonConfirm)
|
||||||
let ackForm = wrapForm ackWgt def
|
let ackForm = wrapForm ackWgt def
|
||||||
{ formAction = Just $ SomeRoute $ PrintAcknowR ackDay
|
{ formAction = Just $ SomeRoute $ PrintAcknowR ackDay
|
||||||
|
|||||||
@ -3,6 +3,7 @@ module Handler.Utils.Avs
|
|||||||
--, checkLicences
|
--, checkLicences
|
||||||
getLicence, getLicenceDB
|
getLicence, getLicenceDB
|
||||||
, setLicence, setLicenceAvs, setLicencesAvs
|
, setLicence, setLicenceAvs, setLicencesAvs
|
||||||
|
, checkLicences
|
||||||
) where
|
) where
|
||||||
|
|
||||||
import Import
|
import Import
|
||||||
@ -68,14 +69,18 @@ setLicenceAvs apid lic = do
|
|||||||
let req = Set.singleton $ AvsPersonLicence apid lic
|
let req = Set.singleton $ AvsPersonLicence apid lic
|
||||||
setLicencesAvs req
|
setLicencesAvs req
|
||||||
|
|
||||||
setLicencesAvs :: Set AvsPersonLicence -> DB ()
|
-- setLicencesAvs :: Set AvsPersonLicence -> DB ()
|
||||||
|
setLicencesAvs :: (MonadHandler m, MonadThrow m, HandlerSite m ~ UniWorX) =>
|
||||||
|
Set AvsPersonLicence -> m ()
|
||||||
setLicencesAvs pls = do
|
setLicencesAvs pls = do
|
||||||
AvsQuery{..} <- maybeThrowM AvsInterfaceUnavailable $ getsYesod $ view _appAvsQuery
|
AvsQuery{..} <- maybeThrowM AvsInterfaceUnavailable $ getsYesod $ view _appAvsQuery
|
||||||
AvsResponseSetLicences responses <- throwLeftM $ avsQuerySetLicences $ AvsQuerySetLicences pls
|
AvsResponseSetLicences responses <- throwLeftM $ avsQuerySetLicences $ AvsQuerySetLicences pls
|
||||||
forM_ responses $ \AvsLicenceResponse{} ->
|
forM_ responses $ \AvsLicenceResponse{..} ->
|
||||||
error "CONTINUE HERE" -- TODO STUB
|
unless (sloppyBool avsResponseSuccess) $
|
||||||
|
-- TODO: create an Admin Problems overview page
|
||||||
|
$logErrorS "AVS" $ "Set licence failed for " <> tshow avsResponsePersonID <> " due to " <> cropText avsResponseMessage
|
||||||
|
|
||||||
|
|
||||||
{-
|
|
||||||
-- | Retrieve all currently valid driving licences and check against our database
|
-- | Retrieve all currently valid driving licences and check against our database
|
||||||
-- Only react to changes as compared to last seen status in avs.model
|
-- Only react to changes as compared to last seen status in avs.model
|
||||||
-- TODO: turn into a job, once the interface is actually available
|
-- TODO: turn into a job, once the interface is actually available
|
||||||
@ -86,12 +91,35 @@ checkLicences = do
|
|||||||
--TODO this must be chunked into separate jobs/tasks
|
--TODO this must be chunked into separate jobs/tasks
|
||||||
--forM licences $ \AvsPersonLicence{..} -> do
|
--forM licences $ \AvsPersonLicence{..} -> do
|
||||||
error "CONTINUE HERE" -- TODO STUB
|
error "CONTINUE HERE" -- TODO STUB
|
||||||
-}
|
|
||||||
|
|
||||||
{-
|
{-
|
||||||
upsertAvsUser :: AvsStatusPerson ->
|
upsertAvsUser :: AvsStatusPerson ->
|
||||||
|
|
||||||
or
|
or
|
||||||
|
|
||||||
|
-}
|
||||||
|
|
||||||
|
{-
|
||||||
upsertAvsUser :: AvsPersonId ->
|
upsertAvsUser :: AvsPersonId ->
|
||||||
-}
|
upsertAvsUser api = do
|
||||||
|
mbuid <- getBy $ UniqueUserAvsId api
|
||||||
|
case mbuid
|
||||||
|
Nothing -> do -- unknown user
|
||||||
|
|
||||||
|
(Just uid) -> do -- known user
|
||||||
|
-}
|
||||||
|
|
||||||
|
{-
|
||||||
|
-- lookupAvsUser :: AvsPersonId ->
|
||||||
|
lookupAvsUser api = do
|
||||||
|
AvsQuery{..} <- maybeThrowM AvsInterfaceUnavailable $ getsYesod $ view _appAvsQuery
|
||||||
|
-- avsQueryPerson does not support querying an AvsPersonId, hence we need a preliminary avsQueryStatus to get all AvsCardNo
|
||||||
|
AvsResponseStatus statuses <- throwLeftM $ avsQueryStatus $ AvsQueryStatus $ Set.singleton api
|
||||||
|
_avsperson <- forM statuses $ \AvsStatusPerson{avsStatusPersonCardStatus} ->
|
||||||
|
forM avsStatusPersonCardStatus $ \AvsDataPersonCard{avsDataCardNo} ->
|
||||||
|
AvsResponsePerson ps <- throwLeftM $ avsQueryPerson $ AvsQueryPerson def{avsPersonQueryCardNo = avsDataCardNo}
|
||||||
|
return $ mergeByPersonId ps
|
||||||
|
|
||||||
|
-}
|
||||||
|
|
||||||
|
|||||||
@ -135,7 +135,7 @@ nullaryPathPiece ''ButtonConfirm $ camelToPathPiece' 1
|
|||||||
|
|
||||||
embedRenderMessage ''UniWorX ''ButtonConfirm id
|
embedRenderMessage ''UniWorX ''ButtonConfirm id
|
||||||
instance Button UniWorX ButtonConfirm where
|
instance Button UniWorX ButtonConfirm where
|
||||||
btnClasses BtnConfirm = [BCIsButton, BCDanger]
|
btnClasses BtnConfirm = [BCIsButton, BCPrimary]
|
||||||
|
|
||||||
--confirmButton :: (Button (HandlerSite m) ButtonConfirm, MonadHandler m) => AForm m ()
|
--confirmButton :: (Button (HandlerSite m) ButtonConfirm, MonadHandler m) => AForm m ()
|
||||||
--confirmButton = combinedButtonFieldF_ (Proxy @ButtonConfirm) ""
|
--confirmButton = combinedButtonFieldF_ (Proxy @ButtonConfirm) ""
|
||||||
|
|||||||
@ -20,11 +20,6 @@ import qualified Data.Text as Text
|
|||||||
import qualified Data.CaseInsensitive as CI
|
import qualified Data.CaseInsensitive as CI
|
||||||
import Text.Hamlet
|
import Text.Hamlet
|
||||||
|
|
||||||
-- import qualified Database.Esqueleto.Experimental as E
|
|
||||||
-- import qualified Database.Esqueleto.Utils as E
|
|
||||||
|
|
||||||
|
|
||||||
-- TODO: refactor! Do not call error in Jobs, as this results in locked jobs. Abort graceful!
|
|
||||||
|
|
||||||
dispatchNotificationQualificationExpiry :: QualificationId -> Day -> UserId -> Handler ()
|
dispatchNotificationQualificationExpiry :: QualificationId -> Day -> UserId -> Handler ()
|
||||||
dispatchNotificationQualificationExpiry nQualification _nExpiry jRecipient = userMailT jRecipient $ do
|
dispatchNotificationQualificationExpiry nQualification _nExpiry jRecipient = userMailT jRecipient $ do
|
||||||
|
|||||||
@ -949,9 +949,6 @@ actRight :: Applicative f => Either a b -> (b -> f (Either a c)) -> f (Either a
|
|||||||
actRight (Left x) _ = pure $ Left x
|
actRight (Left x) _ = pure $ Left x
|
||||||
actRight (Right y) f = f y
|
actRight (Right y) f = f y
|
||||||
|
|
||||||
--leftExceptT :: Monad m => m (Either e a) -> ExceptT e m a
|
|
||||||
--leftExceptT -- TODO
|
|
||||||
|
|
||||||
---------------
|
---------------
|
||||||
-- Exception --
|
-- Exception --
|
||||||
---------------
|
---------------
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user