aboutsummaryrefslogtreecommitdiffstats
path: root/backend/app
diff options
context:
space:
mode:
authorLibravatar Alexander Foremny <aforemny@posteo.de>2024-06-06 22:52:33 +0200
committerLibravatar Alexander Foremny <aforemny@posteo.de>2024-06-06 22:52:33 +0200
commit3add980b73b1ac75d1ad1dde85f6c782439914be (patch)
tree3d167665b588d3488511e25828a6435c98ec8f9a /backend/app
parentb1a4822d5954fe02b82f2c525403c74b3920befe (diff)
list collections
Diffstat (limited to 'backend/app')
-rw-r--r--backend/app/Main.hs9
1 files changed, 8 insertions, 1 deletions
diff --git a/backend/app/Main.hs b/backend/app/Main.hs
index df5dee8..59eab03 100644
--- a/backend/app/Main.hs
+++ b/backend/app/Main.hs
@@ -221,6 +221,11 @@ main = do
respond $
W.responseLBS W.status200 [] $
J.encode (last repo.commits).schemaVersion
+ Right ListCollections -> do
+ repo <- atomically (readTMVar repoT)
+ respond $
+ W.responseLBS W.status200 [] $
+ J.encode (map (.path) (last repo.commits).collections)
(traceShowId -> !_) ->
respond $ W.responseLBS W.status200 [] "not implemented"
@@ -228,13 +233,15 @@ data Route
= SchemaJson String
| Query
| SchemaVersion
+ | ListCollections
deriving (Show)
routeP :: P.Parser Route
routeP =
( P.choice
- [ SchemaJson <$> (P.string "/" *> P.manyTill P.anyChar (P.string ".schema.json")),
+ [ pure ListCollections <* P.string "/collections",
pure SchemaVersion <* P.string "/schemaVersion",
+ SchemaJson <$> (P.string "/" *> P.manyTill P.anyChar (P.string ".schema.json")),
pure Query <* P.string "/"
]
)