summaryrefslogtreecommitdiff
path: root/server/Server.hs
diff options
context:
space:
mode:
authorstuebinm2022-02-16 16:57:49 +0100
committerstuebinm2022-03-19 19:26:32 +0100
commitff8eeb131db9e9a0d9d3cef60ddcaa83692fb62c (patch)
tree8cbb1bad563bd545929b083447e9a11d1a60648d /server/Server.hs
parent410151c85b1e6c7629934e0ef0bc199d92da64e9 (diff)
server: add mapservice GET endpoint
Diffstat (limited to '')
-rw-r--r--server/Server.hs16
1 files changed, 11 insertions, 5 deletions
diff --git a/server/Server.hs b/server/Server.hs
index 77eebbc..bcb96a0 100644
--- a/server/Server.hs
+++ b/server/Server.hs
@@ -37,8 +37,7 @@ import qualified Data.Aeson as A
import qualified Data.ByteString.Base64.URL as Base64
import Data.Functor.Contravariant (contramap)
import qualified Data.Map as M
-import Lens.Micro.Platform (at, ix, makeLenses, traverseOf,
- traversed)
+import Lens.Micro.Platform (at, ix, makeLenses, traverseOf)
import LintConfig (LintConfig')
import Servant (FromHttpApiData)
import Toml (TomlCodec, prettyTomlDecodeErrors,
@@ -47,8 +46,10 @@ import qualified Toml as T
-- | a reference in a remote git repository
data RemoteRef = RemoteRef
- { repourl :: Text
- , reporef :: Text
+ { repourl :: Text
+ , reporef :: Text
+ , reponame :: Text
+ -- ^ the "world name" for the hub / world:// links
} deriving (Generic, FromJSON, ToJSON, Eq, Ord, Show)
type family ConfigRes (b :: Bool) a where
@@ -78,6 +79,8 @@ data Org (loaded :: Bool) = Org
, orgLintconfig :: ConfigRes loaded LintConfig'
, orgEntrypoint :: FilePath
, orgRepos :: [RemoteRef]
+ , orgUrl :: Text
+ , orgWebdir :: Text
} deriving Generic
-- | Orgs are compared via their slugs only
@@ -116,6 +119,7 @@ remoteCodec :: TomlCodec RemoteRef
remoteCodec = RemoteRef
<$> T.text "url" .= repourl
<*> T.text "ref" .= reporef
+ <*> T.text "name" .= reponame
orgCodec :: TomlCodec (Org False)
orgCodec = Org
@@ -123,6 +127,8 @@ orgCodec = Org
<*> T.string "lintconfig" .= orgLintconfig
<*> T.string "entrypoint" .= orgEntrypoint
<*> T.list remoteCodec "repo" .= orgRepos
+ <*> T.text "url" .= orgUrl
+ <*> T.text "webdir" .= orgWebdir
configCodec :: TomlCodec (Config False)
@@ -135,7 +141,7 @@ configCodec = Config
-- | a job status (of a specific uuid)
data JobStatus =
- Pending | Linted DirResult | Failed Text
+ Pending | Linted DirResult Text | Failed Text
deriving (Generic, ToJSON)
-- | the server's global state; might eventually end up with more