shape the response after inserting
This commit is contained in:
@@ -2,6 +2,7 @@ module Main where
|
||||
|
||||
|
||||
import PostgREST.App
|
||||
-- import PostgREST.QueryBuilder
|
||||
import PostgREST.Config (AppConfig (..),
|
||||
minimumPgVersion,
|
||||
prettyVersion,
|
||||
@@ -26,7 +27,7 @@ import Network.Wai.Middleware.RequestLogger (logStdout)
|
||||
import System.IO (BufferMode (..),
|
||||
hSetBuffering, stderr,
|
||||
stdin, stdout)
|
||||
|
||||
-- import Data.Maybe (mapMaybe)
|
||||
|
||||
isServerVersionSupported :: H.Session P.Postgres IO Bool
|
||||
isServerVersionSupported = do
|
||||
@@ -86,8 +87,10 @@ main = do
|
||||
keys <- allPrimaryKeys
|
||||
return (tabs, rels, cols, keys)
|
||||
|
||||
|
||||
dbstructure <- either hasqlError
|
||||
(\(tabs, rels, cols, keys) ->
|
||||
|
||||
return DbStructure {
|
||||
tables=tabs
|
||||
, columns=cols
|
||||
@@ -96,6 +99,11 @@ main = do
|
||||
}
|
||||
) metadata
|
||||
|
||||
-- let allRels = relations dbstructure
|
||||
-- fakeRels = mapMaybe (toSourceRelation "projects") allRels
|
||||
--
|
||||
-- print $ findRelation (fakeRels ++ allRels) "test" "pg_source" "clients"
|
||||
|
||||
runSettings appSettings $ middle $ \ req respond -> do
|
||||
body <- strictRequestBody req
|
||||
resOrError <- liftIO $ H.session pool $ H.tx txSettings $
|
||||
|
||||
Reference in New Issue
Block a user