diff options
Diffstat (limited to 'backend/app')
-rw-r--r-- | backend/app/Main.hs | 10 |
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 |