From b3327fec742b1fd93c6fd0bd0bfc3f4775bf58f8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kier=C3=A1n=20Meinhardt?= Date: Sat, 12 Oct 2024 11:19:06 +0200 Subject: fix matching of schema route --- backend/app/Main.hs | 10 +++++----- 1 file 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 -- cgit v1.2.3