aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLibravatar Kierán Meinhardt <kmein@posteo.de>2024-10-12 11:19:06 +0200
committerLibravatar Kierán Meinhardt <kmein@posteo.de>2024-10-12 11:19:06 +0200
commitb3327fec742b1fd93c6fd0bd0bfc3f4775bf58f8 (patch)
treef3bfee3c1b377b88ba33b4f63d16a06cd8845d48
parentfff2da6ecfcaea1514e8924d5ca75c583358292e (diff)
fix matching of schema route
-rw-r--r--backend/app/Main.hs10
1 files changed, 5 insertions, 5 deletions
diff --git a/backend/app/Main.hs b/backend/app/Main.hs
index ca1b748..47dc41a 100644
--- a/backend/app/Main.hs
+++ b/backend/app/Main.hs
@@ -278,6 +278,11 @@ restApi root ref repoT app req respond =
respond . W.responseLBS W.status200 [] . J.encode
=<< Q.withStore root ref do
Q.query (fromString (printf "SELECT %s FROM %s" c c))
+ ("GET", ["collection", B.toString -> c, "schema"]) -> do
+ repo <- atomically (readTMVar repoT)
+ let [collection] = filter ((== c) . (.path)) (last repo.commits).collections
+ respond . W.responseLBS W.status200 [] $
+ J.encode (fromAutoTypes c collection.schema)
("GET", ["collection", B.toString -> c, B.toString -> i]) -> do
respond . W.responseLBS W.status200 [] . J.encode
=<< Q.withStore root ref do
@@ -297,10 +302,5 @@ restApi root ref repoT app req respond =
respond . W.responseLBS W.status200 [] . J.encode
=<< Q.withStore root ref do
Q.query (fromString (printf "DELETE FROM %s WHERE %s.$fileName == \"%s\"" c c i))
- ("GET", ["collection", B.toString -> c, "schema"]) -> do
- repo <- atomically (readTMVar repoT)
- let [collection] = filter ((== c) . (.path)) (last repo.commits).collections
- respond . W.responseLBS W.status200 [] $
- J.encode (fromAutoTypes c collection.schema)
(method, path) -> fail $ "Method " ++ show method ++ " on route " ++ show path ++ " not supported."
_ -> app req respond