39 lines
886 B
Haskell
39 lines
886 B
Haskell
{-# LANGUAGE TypeSynonymInstances #-}
|
|
{-# LANGUAGE FlexibleInstances #-}
|
|
module Types.Reader where
|
|
|
|
import qualified Data.Text as T
|
|
|
|
import Servant (Handler)
|
|
|
|
import Control.Concurrent.STM (TQueue)
|
|
import Control.Monad.IO.Class (liftIO)
|
|
import Control.Monad.Reader (ReaderT)
|
|
import Control.Monad.Time
|
|
|
|
import Crypto.JOSE.JWK
|
|
|
|
import Database.PostgreSQL.Simple (Connection)
|
|
|
|
import Network.Mail.Mime (Mail)
|
|
|
|
-- internal imports
|
|
|
|
import Types.Auth (TicketStore)
|
|
|
|
data ReadState = ReadState
|
|
{ rsConnection :: Connection
|
|
, rsTicketStore :: TicketStore
|
|
, rsCurrencySymbol :: T.Text
|
|
, rsCurrencyFraction :: Word
|
|
, rsSoftwareVersion :: T.Text
|
|
, rsSendmailPath :: FilePath
|
|
, rsMailQueue :: TQueue Mail
|
|
, rsJWTSecret :: JWK
|
|
}
|
|
|
|
type MateHandler = ReaderT ReadState Handler
|
|
|
|
instance MonadTime MateHandler where
|
|
currentTime = liftIO currentTime
|