11import { FastifyInstance } from 'fastify'
22import { PostgresMeta } from '../../lib'
3+ import { DEFAULT_POOL_CONFIG } from '../constants'
34
45export default async ( fastify : FastifyInstance ) => {
56 fastify . get < {
@@ -11,7 +12,7 @@ export default async (fastify: FastifyInstance) => {
1112 const connectionString = request . headers . pg
1213 const includeSystemSchemas = request . query . include_system_schemas === 'true'
1314
14- const pgMeta = new PostgresMeta ( { connectionString , max : 1 } )
15+ const pgMeta = new PostgresMeta ( { ... DEFAULT_POOL_CONFIG , connectionString } )
1516 const { data, error } = await pgMeta . columns . list ( {
1617 includeSystemSchemas,
1718 } )
@@ -33,7 +34,7 @@ export default async (fastify: FastifyInstance) => {
3334 } > ( '/:id(\\d+\\.\\d+)' , async ( request , reply ) => {
3435 const connectionString = request . headers . pg
3536
36- const pgMeta = new PostgresMeta ( { connectionString , max : 1 } )
37+ const pgMeta = new PostgresMeta ( { ... DEFAULT_POOL_CONFIG , connectionString } )
3738 const { data, error } = await pgMeta . columns . retrieve ( { id : request . params . id } )
3839 await pgMeta . end ( )
3940 if ( error ) {
@@ -52,7 +53,7 @@ export default async (fastify: FastifyInstance) => {
5253 } > ( '/' , async ( request , reply ) => {
5354 const connectionString = request . headers . pg
5455
55- const pgMeta = new PostgresMeta ( { connectionString , max : 1 } )
56+ const pgMeta = new PostgresMeta ( { ... DEFAULT_POOL_CONFIG , connectionString } )
5657 const { data, error } = await pgMeta . columns . create ( request . body )
5758 await pgMeta . end ( )
5859 if ( error ) {
@@ -74,7 +75,7 @@ export default async (fastify: FastifyInstance) => {
7475 } > ( '/:id(\\d+\\.\\d+)' , async ( request , reply ) => {
7576 const connectionString = request . headers . pg
7677
77- const pgMeta = new PostgresMeta ( { connectionString , max : 1 } )
78+ const pgMeta = new PostgresMeta ( { ... DEFAULT_POOL_CONFIG , connectionString } )
7879 const { data, error } = await pgMeta . columns . update ( request . params . id , request . body )
7980 await pgMeta . end ( )
8081 if ( error ) {
@@ -98,7 +99,7 @@ export default async (fastify: FastifyInstance) => {
9899 } > ( '/:id(\\d+\\.\\d+)' , async ( request , reply ) => {
99100 const connectionString = request . headers . pg
100101
101- const pgMeta = new PostgresMeta ( { connectionString , max : 1 } )
102+ const pgMeta = new PostgresMeta ( { ... DEFAULT_POOL_CONFIG , connectionString } )
102103 const { data, error } = await pgMeta . columns . remove ( request . params . id )
103104 await pgMeta . end ( )
104105 if ( error ) {
0 commit comments