refactor: table list to table map

This commit is contained in:
steve-chavez
2022-04-18 15:48:03 -05:00
committed by Steve Chavez
parent f995799e8f
commit cdcc175abf
4 changed files with 32 additions and 34 deletions
+3 -3
View File
@@ -34,20 +34,20 @@ import PostgREST.DbStructure.Proc (ProcDescription (..),
import PostgREST.DbStructure.Relationship (Cardinality (..),
PrimaryKey (..),
Relationship (..))
import PostgREST.DbStructure.Table (Column (..), Table (..))
import PostgREST.DbStructure.Table (Column (..), Table (..), TablesMap)
import PostgREST.Version (docsVersion, prettyVersion)
import PostgREST.ContentType
import Protolude hiding (Proxy, get)
encode :: AppConfig -> DbStructure -> [Table] -> M.HashMap k [ProcDescription] -> Maybe Text -> LBS.ByteString
encode :: AppConfig -> DbStructure -> TablesMap -> M.HashMap k [ProcDescription] -> Maybe Text -> LBS.ByteString
encode conf dbStructure tables procs schemaDescription =
JSON.encode $
postgrestSpec
(dbRelationships dbStructure)
(concat $ M.elems procs)
(openApiTableInfo dbStructure <$> tables)
(openApiTableInfo dbStructure <$> (snd <$> M.toList tables))
(proxyUri conf)
schemaDescription
(dbPrimaryKeys dbStructure)