File tree Expand file tree Collapse file tree 1 file changed +8
-1
lines changed
src/server/routes/generators Expand file tree Collapse file tree 1 file changed +8
-1
lines changed Original file line number Diff line number Diff line change @@ -9,11 +9,14 @@ export default async (fastify: FastifyInstance) => {
99 Headers : { pg : string }
1010 Querystring : {
1111 excluded_schemas ?: string
12+ included_schemas ?: string
1213 }
1314 } > ( '/' , async ( request , reply ) => {
1415 const connectionString = request . headers . pg
1516 const excludedSchemas =
1617 request . query . excluded_schemas ?. split ( ',' ) . map ( ( schema ) => schema . trim ( ) ) ?? [ ]
18+ const includedSchemas =
19+ request . query . included_schemas ?. split ( ',' ) . map ( ( schema ) => schema . trim ( ) ) ?? [ ]
1720
1821 const pgMeta : PostgresMeta = new PostgresMeta ( { ...DEFAULT_POOL_CONFIG , connectionString } )
1922 const { data : schemas , error : schemasError } = await pgMeta . schemas . list ( )
@@ -46,7 +49,11 @@ export default async (fastify: FastifyInstance) => {
4649 }
4750
4851 return applyTypescriptTemplate ( {
49- schemas : schemas . filter ( ( { name } ) => ! excludedSchemas . includes ( name ) ) ,
52+ schemas : schemas . filter (
53+ ( { name } ) =>
54+ ! excludedSchemas . includes ( name ) &&
55+ ( includedSchemas . length === 0 || includedSchemas . includes ( name ) )
56+ ) ,
5057 tables,
5158 functions,
5259 types,
You can’t perform that action at this time.
0 commit comments