mateamt/src/Control/Journal.hs

31 lines
650 B
Haskell
Raw Normal View History

2019-08-10 08:37:45 +00:00
{-# LANGUAGE OverloadedStrings #-}
module Control.Journal where
import Servant
2019-10-14 20:50:42 +00:00
import Control.Monad.Reader (asks)
2019-08-10 08:37:45 +00:00
-- internal imports
import Types
import Model.Journal
journalShow
2019-09-15 12:59:22 +00:00
:: Maybe (Int, AuthMethod)
2019-08-10 08:37:45 +00:00
-> Maybe Int
-> Maybe Int
-> MateHandler [JournalEntry]
2019-11-02 21:53:49 +00:00
journalShow (Just (_, method)) mlimit moffset = do
if method `elem` [PrimaryPass, ChallengeResponse]
then do
conn <- asks rsConnection
selectJournalEntries mlimit moffset conn
else
throwError $ err401
{ errBody = "Wrong Authentication present"
}
2019-08-10 08:37:45 +00:00
journalShow Nothing _ _ =
2019-09-11 11:54:18 +00:00
throwError $ err401
2019-08-10 08:37:45 +00:00
{ errBody = "No Authentication present"
}