make it work

This commit is contained in:
nek0 2022-07-24 23:11:47 +02:00
parent 8d47a990e7
commit e7e1305b6a
5 changed files with 24 additions and 3 deletions

View file

@ -57,10 +57,8 @@ import AppTypes
import Types import Types
import Control import Control
import Janitor import Janitor
-- import Middleware
import Paths_mateamt (version) import Paths_mateamt (version)
import Control.Monad.Except (runExceptT)
main :: IO () main :: IO ()
main = do main = do
@ -218,6 +216,9 @@ thisApi =
roleAssociationSubmit :<|> roleAssociationSubmit :<|>
roleAssociationDelete :<|> roleAssociationDelete :<|>
getSettings :<|>
Control.updateSettings :<|>
metaGet metaGet
mateSwagger :: OA.OpenApi mateSwagger :: OA.OpenApi

View file

@ -65,6 +65,7 @@ library
Control.Journal Control.Journal
Control.Meta Control.Meta
Control.Avatar Control.Avatar
Control.Settings
Classes.DatabaseRepresentation Classes.DatabaseRepresentation
Classes.ToDatabase Classes.ToDatabase
Classes.FromDatabase Classes.FromDatabase

View file

@ -138,6 +138,9 @@ roleAssociationListLink :: Link
roleAssociationSubmitLink :: Link roleAssociationSubmitLink :: Link
roleAssociationDeleteLink :: Link roleAssociationDeleteLink :: Link
settingsGetLink :: Link
settingsUpdateLnk :: Link
metaGetLink :: Link metaGetLink :: Link
( authGetLink :<|> ( authGetLink :<|>
@ -180,5 +183,8 @@ metaGetLink :: Link
roleAssociationSubmitLink :<|> roleAssociationSubmitLink :<|>
roleAssociationDeleteLink :<|> roleAssociationDeleteLink :<|>
settingsGetLink :<|>
settingsUpdateLnk :<|>
metaGetLink metaGetLink
) = allLinks (Proxy :: Proxy MateAPI) ) = allLinks (Proxy :: Proxy MateAPI)

View file

@ -10,3 +10,4 @@ import Control.Product as C
import Control.Avatar as C import Control.Avatar as C
import Control.Role as C import Control.Role as C
import Control.Meta as C import Control.Meta as C
import Control.Settings as C

View file

@ -1,7 +1,13 @@
{-# LANGUAGE TypeFamilies #-} {-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE DeriveGeneric #-}
module Types.Settings where module Types.Settings where
import Data.Aeson
import qualified Data.Text as T import qualified Data.Text as T
import Data.OpenApi (ToSchema)
import GHC.Generics
-- internal imports -- internal imports
@ -11,7 +17,7 @@ data Settings = Settings
{ settingsBlockRegistration :: Bool { settingsBlockRegistration :: Bool
, settingsImprintText :: Maybe T.Text , settingsImprintText :: Maybe T.Text
} }
deriving (Show) deriving (Show, Generic)
instance DatabaseRepresentation Settings where instance DatabaseRepresentation Settings where
@ -24,3 +30,9 @@ instance ToDatabase Settings where
instance FromDatabase Settings where instance FromDatabase Settings where
fromDatabase (reg, imprint) = Settings reg imprint fromDatabase (reg, imprint) = Settings reg imprint
instance FromJSON Settings
instance ToJSON Settings
instance ToSchema Settings