aboutsummaryrefslogtreecommitdiff
path: root/src/server/Model
diff options
context:
space:
mode:
authorJoris2016-03-20 22:38:44 +0100
committerJoris2016-03-21 20:43:55 +0100
commit1c7d6ea6e3bcd3c672cb5eb3cf22ffc88cabb257 (patch)
tree4ff8aeb6aa0f159548f8f506374276c1a2c97f7d /src/server/Model
parent47104f0b3965cd1dfba0f466afdb5e8983dc7bec (diff)
use config-manager instead of ConfigFile
Diffstat (limited to 'src/server/Model')
-rw-r--r--src/server/Model/Json/Conf.hs (renamed from src/server/Model/Json/Config.hs)10
-rw-r--r--src/server/Model/Message.hs7
-rw-r--r--src/server/Model/Payment.hs1
-rw-r--r--src/server/Model/SignIn.hs6
4 files changed, 13 insertions, 11 deletions
diff --git a/src/server/Model/Json/Config.hs b/src/server/Model/Json/Conf.hs
index 422ecee..a66fb55 100644
--- a/src/server/Model/Json/Config.hs
+++ b/src/server/Model/Json/Conf.hs
@@ -1,7 +1,7 @@
{-# LANGUAGE DeriveGeneric #-}
-module Model.Json.Config
- ( Config(..)
+module Model.Json.Conf
+ ( Conf(..)
) where
import GHC.Generics
@@ -9,9 +9,9 @@ import GHC.Generics
import Data.Aeson
import Data.Text
-data Config = Config
+data Conf = Conf
{ currency :: Text
} deriving (Show, Generic)
-instance FromJSON Config
-instance ToJSON Config
+instance FromJSON Conf
+instance ToJSON Conf
diff --git a/src/server/Model/Message.hs b/src/server/Model/Message.hs
index a65e01c..0e83e5b 100644
--- a/src/server/Model/Message.hs
+++ b/src/server/Model/Message.hs
@@ -18,10 +18,13 @@ getMessage :: Key -> Text
getMessage = getParamMessage []
getParamMessage :: [Text] -> Key -> Text
-getParamMessage values key = replaceParts values (getNonFormattedMessage lang key)
+getParamMessage values paramKey = replaceParts values (getNonFormattedMessage lang paramKey)
getTranslations :: [Translation]
getTranslations = (map getTranslation [minBound..])
getTranslation :: Key -> Translation
-getTranslation key = Translation (T.pack . show $ key) (getParts $ getNonFormattedMessage lang key)
+getTranslation translationKey =
+ Translation
+ (T.pack . show $ translationKey)
+ (getParts $ getNonFormattedMessage lang translationKey)
diff --git a/src/server/Model/Payment.hs b/src/server/Model/Payment.hs
index 404b143..9b32fea 100644
--- a/src/server/Model/Payment.hs
+++ b/src/server/Model/Payment.hs
@@ -10,7 +10,6 @@ module Model.Payment
) where
import Data.Text (Text)
-import qualified Data.Text as T
import Data.Time.Clock (getCurrentTime)
import Data.Either (lefts)
diff --git a/src/server/Model/SignIn.hs b/src/server/Model/SignIn.hs
index 117b8b5..06aba5a 100644
--- a/src/server/Model/SignIn.hs
+++ b/src/server/Model/SignIn.hs
@@ -1,6 +1,6 @@
module Model.SignIn
( createSignInToken
- , getSignInToken
+ , getSignIn
, signInTokenToUsed
, isLastValidToken
) where
@@ -22,8 +22,8 @@ createSignInToken email = do
_ <- insert $ SignIn token now email False
return token
-getSignInToken :: Text -> Persist (Maybe (Entity SignIn))
-getSignInToken token =
+getSignIn :: Text -> Persist (Maybe (Entity SignIn))
+getSignIn token =
selectFirst [SignInToken ==. token] []
signInTokenToUsed :: SignInId -> Persist ()