Compare commits
7 commits
Author | SHA1 | Date | |
---|---|---|---|
4c2692fb31 | |||
028d8794b3 | |||
f0a888decf | |||
96409f3118 | |||
f2b7b60231 | |||
0d8649407f | |||
c688bc1b86 |
7 changed files with 54 additions and 29 deletions
2
.gitignore
vendored
2
.gitignore
vendored
|
@ -12,3 +12,5 @@ report.html
|
|||
*.save*
|
||||
.envrc
|
||||
.direnv/
|
||||
.hie/
|
||||
stan.html
|
||||
|
|
25
app/Main.hs
25
app/Main.hs
|
@ -11,27 +11,37 @@ module Main where
|
|||
import Prelude as P
|
||||
|
||||
import Crypto.JWT hiding (Context, header)
|
||||
import Crypto.JOSE.JWK hiding (Context)
|
||||
|
||||
import Control.Concurrent.STM.TVar
|
||||
import Control.Concurrent.STM (newTQueueIO)
|
||||
import Control.Concurrent (forkIO)
|
||||
|
||||
import Control.Lens hiding (Context)
|
||||
|
||||
import Control.Monad (void, unless)
|
||||
|
||||
import Control.Monad.Reader
|
||||
|
||||
import Servant
|
||||
import Servant.Server.Experimental.Auth
|
||||
import qualified Servant.OpenApi as OA
|
||||
import Servant.Swagger.UI
|
||||
import Servant.RawM
|
||||
|
||||
import qualified Data.Aeson as A
|
||||
import Servant.RawM.Server
|
||||
|
||||
import Data.Set as S (empty)
|
||||
|
||||
import qualified Data.ByteString.Lazy as B
|
||||
import Data.ByteString.Char8 as B8 hiding (putStrLn)
|
||||
|
||||
import qualified Data.Text as T
|
||||
import qualified Data.Text.Encoding as TE
|
||||
|
||||
import Data.String
|
||||
|
||||
import Data.Yaml
|
||||
|
||||
import Data.Version (showVersion)
|
||||
|
||||
import qualified Data.OpenApi as OA hiding (Server)
|
||||
|
||||
import Database.PostgreSQL.Simple
|
||||
|
@ -42,12 +52,6 @@ import Network.Wai
|
|||
import Network.Wai.Logger
|
||||
import Network.Wai.Handler.Warp
|
||||
|
||||
import Control.Monad.Reader
|
||||
|
||||
import Control.Concurrent.STM.TVar
|
||||
|
||||
import Control.Lens hiding (Context)
|
||||
|
||||
import Options.Applicative
|
||||
|
||||
import System.Clock (TimeSpec(..))
|
||||
|
@ -149,7 +153,6 @@ main = do
|
|||
, rsJWTSecret =
|
||||
fromOctets . B.fromStrict $ TE.encodeUtf8 jwt_secret
|
||||
}
|
||||
expirationSpec = TimeSpec 5 0 -- five seconds
|
||||
runSettings settings (app initState)
|
||||
where
|
||||
opts = info (options <**> helper)
|
||||
|
|
12
flake.lock
12
flake.lock
|
@ -5,11 +5,11 @@
|
|||
"systems": "systems"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1705309234,
|
||||
"narHash": "sha256-uNRRNRKmJyCRC/8y1RqBkqWBLM034y4qN7EprSdmgyA=",
|
||||
"lastModified": 1710146030,
|
||||
"narHash": "sha256-SZ5L6eA7HJ/nmkzGG7/ISclqe6oZdOZTNoesiInkXPQ=",
|
||||
"owner": "numtide",
|
||||
"repo": "flake-utils",
|
||||
"rev": "1ef2e671c3b0c19053962c07dbda38332dcebf26",
|
||||
"rev": "b1d9ab70662946ef0850d488da1c9019f3a9752a",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
|
@ -20,11 +20,11 @@
|
|||
},
|
||||
"nixpkgs": {
|
||||
"locked": {
|
||||
"lastModified": 1709116111,
|
||||
"narHash": "sha256-V7BbC39cGDOzJsCsmg+hCdBu1Tuhqs7kLcPxw86STh4=",
|
||||
"lastModified": 1725059563,
|
||||
"narHash": "sha256-laJvLHrSU5M9zWlejH7H67HdpLhcUI6uPDa4rX7eUuE=",
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "b84d9f029fa675d5ef312f032f322889149daa82",
|
||||
"rev": "0abfc619bcb605299a0f3f01c1887bb65db61a6b",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
|
|
|
@ -72,10 +72,22 @@ library
|
|||
|
||||
-- Modules included in this library but not exported.
|
||||
-- other-modules:
|
||||
default-extensions:
|
||||
StrictData
|
||||
other-extensions:
|
||||
DataKinds TypeOperators FlexibleInstances MultiParamTypeClasses
|
||||
RankNTypes ScopedTypeVariables FlexibleContexts OverloadedStrings
|
||||
Arrows CPP LambdaCase DeriveGeneric TypeFamilies
|
||||
DataKinds
|
||||
TypeOperators
|
||||
FlexibleInstances
|
||||
MultiParamTypeClasses
|
||||
RankNTypes
|
||||
ScopedTypeVariables
|
||||
FlexibleContexts
|
||||
OverloadedStrings
|
||||
Arrows
|
||||
CPP
|
||||
LambdaCase
|
||||
DeriveGeneric
|
||||
TypeFamilies
|
||||
TypeSynonymInstances
|
||||
|
||||
build-depends:
|
||||
|
@ -93,7 +105,6 @@ library
|
|||
, servant
|
||||
, servant-server
|
||||
, servant-openapi3
|
||||
, servant-rawm >= 0.3.0.0
|
||||
, servant-rawm-server
|
||||
, opaleye
|
||||
, aeson
|
||||
|
@ -111,12 +122,14 @@ library
|
|||
, haskell-gettext
|
||||
, mime-mail
|
||||
, directory
|
||||
, jose
|
||||
, jose >= 0.10
|
||||
, monad-time
|
||||
|
||||
hs-source-dirs: src
|
||||
default-language: Haskell2010
|
||||
ghc-options: -Wall
|
||||
-fwrite-ide-info
|
||||
-hiedir=.hie
|
||||
|
||||
executable mateamt
|
||||
main-is: Main.hs
|
||||
|
@ -127,6 +140,8 @@ executable mateamt
|
|||
AppTypes.Configuration
|
||||
Janitor
|
||||
Paths_mateamt
|
||||
default-extensions:
|
||||
StrictData
|
||||
other-extensions:
|
||||
DataKinds TypeOperators FlexibleInstances MultiParamTypeClasses
|
||||
RankNTypes ScopedTypeVariables FlexibleContexts OverloadedStrings
|
||||
|
@ -151,7 +166,7 @@ executable mateamt
|
|||
, network
|
||||
, servant
|
||||
, servant-server
|
||||
, servant-rawm
|
||||
, servant-rawm-server
|
||||
, servant-openapi3
|
||||
, servant-swagger-ui
|
||||
, servant-swagger-ui-core
|
||||
|
@ -170,6 +185,8 @@ executable mateamt
|
|||
hs-source-dirs: app
|
||||
default-language: Haskell2010
|
||||
ghc-options: -Wall
|
||||
-fwrite-ide-info
|
||||
-hiedir=.hie
|
||||
|
||||
-- test-suite mateamt-test
|
||||
-- default-language: Haskell2010
|
||||
|
|
11
src/API.hs
11
src/API.hs
|
@ -13,8 +13,7 @@ import Servant.Server
|
|||
|
||||
import Data.Proxy
|
||||
|
||||
import Servant.RawM
|
||||
import Servant.RawM.Server ()
|
||||
import Servant.RawM.Server
|
||||
|
||||
-- internal imports
|
||||
|
||||
|
@ -124,7 +123,7 @@ journalShowLink :: Maybe Int -> Maybe Int -> Link
|
|||
journalPostCheck :: Link
|
||||
|
||||
avatarGetLink :: Int -> Link
|
||||
avaterInsertLink :: Link
|
||||
avatarInsertLink :: Link
|
||||
avatarUpdateLink :: Int -> Link
|
||||
avatarListLink :: Link
|
||||
|
||||
|
@ -137,7 +136,7 @@ roleAssociationSubmitLink :: Link
|
|||
roleAssociationDeleteLink :: Link
|
||||
|
||||
settingsGetLink :: Link
|
||||
settingsUpdateLnk :: Link
|
||||
settingsUpdateLink :: Link
|
||||
|
||||
metaGetLink :: Link
|
||||
|
||||
|
@ -168,7 +167,7 @@ metaGetLink :: Link
|
|||
journalPostCheck :<|>
|
||||
|
||||
avatarGetLink :<|>
|
||||
avaterInsertLink :<|>
|
||||
avatarInsertLink :<|>
|
||||
avatarUpdateLink :<|>
|
||||
avatarListLink :<|>
|
||||
|
||||
|
@ -181,7 +180,7 @@ metaGetLink :: Link
|
|||
roleAssociationDeleteLink :<|>
|
||||
|
||||
settingsGetLink :<|>
|
||||
settingsUpdateLnk :<|>
|
||||
settingsUpdateLink :<|>
|
||||
|
||||
metaGetLink
|
||||
) = allLinks (Proxy :: Proxy MateAPI)
|
||||
|
|
|
@ -11,8 +11,10 @@ metaGet :: MateHandler MetaInformation
|
|||
metaGet = do
|
||||
symbol <- asks rsCurrencySymbol
|
||||
version <- asks rsSoftwareVersion
|
||||
decimals <- asks rsCurrencyFraction
|
||||
return (MetaInformation
|
||||
{ metaInfoVersion = version
|
||||
, metaInfoCurrency = symbol
|
||||
, metaInfoDecimals = fromIntegral decimals
|
||||
}
|
||||
)
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
{-# LANGUAGE OverloadedStrings #-}
|
||||
module Control.Settings where
|
||||
|
||||
import Control.Monad (void, unless)
|
||||
|
||||
import Control.Monad.Reader
|
||||
|
||||
import Servant
|
||||
|
|
Loading…
Reference in a new issue