instead of select * inspect schema to get selectable columns
This commit is contained in:
@@ -43,7 +43,7 @@ import PostgREST.Plan (ActionPlan (..), CrudPlan (..),
|
||||
DbActionPlan (..), InfoPlan (..),
|
||||
InspectPlan (..))
|
||||
import PostgREST.Query (MainQuery (..))
|
||||
import PostgREST.Query.OpenApi (TableAccess (..), TablesAccess)
|
||||
import PostgREST.Query.OpenApi (TablesAccess, decodeTablesAccess)
|
||||
import PostgREST.SchemaCache (SchemaCache (..))
|
||||
import PostgREST.SchemaCache.Identifiers (QualifiedIdentifier (..))
|
||||
import PostgREST.SchemaCache.Routine (Routine (..), RoutineMap)
|
||||
@@ -193,18 +193,6 @@ actionResult MainQuery{mqOpenAPI=(tblsQ, funcsQ, schQ)} (MayUseDb plan@InspectPl
|
||||
decodeSchemaDesc :: HD.Result (Maybe Text)
|
||||
decodeSchemaDesc = join <$> HD.rowMaybe (nullableColumn HD.text)
|
||||
|
||||
decodeTablesAccess :: HD.Result TablesAccess
|
||||
decodeTablesAccess =
|
||||
let
|
||||
row = (,) <$> (QualifiedIdentifier <$> column HD.text <*> column HD.text)
|
||||
<*> (TableAccess
|
||||
<$> arrayColumn HD.text
|
||||
<*> arrayColumn HD.text
|
||||
<*> arrayColumn HD.text
|
||||
<*> column HD.bool)
|
||||
in
|
||||
HM.fromList <$> HD.rowList row
|
||||
|
||||
-- Makes sure the querystring pk matches the payload pk
|
||||
-- e.g. PUT /items?id=eq.1 { "id" : 1, .. } is accepted,
|
||||
-- PUT /items?id=eq.14 { "id" : 2, .. } is rejected.
|
||||
|
||||
Reference in New Issue
Block a user