File tree 1 file changed +7
-5
lines changed 1 file changed +7
-5
lines changed Original file line number Diff line number Diff line change @@ -84,13 +84,15 @@ export default async (fastify: FastifyInstance) => {
84
84
} ,
85
85
async ( request , reply ) => {
86
86
const connectionString = request . headers . pg
87
-
88
- const pgMeta = new PostgresMeta ( { ...DEFAULT_POOL_CONFIG , connectionString } )
89
- if ( ! Array . isArray ( request . body ) ) {
90
- request . body = [ request . body ]
87
+ let batchCreateArg : PostgresColumnCreate [ ]
88
+ if ( Array . isArray ( request . body ) ) {
89
+ batchCreateArg = request . body
90
+ } else {
91
+ batchCreateArg = [ request . body ]
91
92
}
92
93
93
- const { data, error } = await pgMeta . columns . batchCreate ( request . body )
94
+ const pgMeta = new PostgresMeta ( { ...DEFAULT_POOL_CONFIG , connectionString } )
95
+ const { data, error } = await pgMeta . columns . batchCreate ( batchCreateArg )
94
96
await pgMeta . end ( )
95
97
if ( error ) {
96
98
request . log . error ( { error, request : extractRequestForLogging ( request ) } )
You can’t perform that action at this time.
0 commit comments