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) => {
9
9
Headers : { pg : string }
10
10
Querystring : {
11
11
excluded_schemas ?: string
12
+ included_schemas ?: string
12
13
}
13
14
} > ( '/' , async ( request , reply ) => {
14
15
const connectionString = request . headers . pg
15
16
const excludedSchemas =
16
17
request . query . excluded_schemas ?. split ( ',' ) . map ( ( schema ) => schema . trim ( ) ) ?? [ ]
18
+ const includedSchemas =
19
+ request . query . included_schemas ?. split ( ',' ) . map ( ( schema ) => schema . trim ( ) ) ?? [ ]
17
20
18
21
const pgMeta : PostgresMeta = new PostgresMeta ( { ...DEFAULT_POOL_CONFIG , connectionString } )
19
22
const { data : schemas , error : schemasError } = await pgMeta . schemas . list ( )
@@ -46,7 +49,11 @@ export default async (fastify: FastifyInstance) => {
46
49
}
47
50
48
51
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
+ ) ,
50
57
tables,
51
58
functions,
52
59
types,
You can’t perform that action at this time.
0 commit comments