Replace ts-ignore with 400 if needed (#9621)

This commit is contained in:
melohagan 2023-02-09 11:46:41 +00:00 committed by GitHub
parent c2bd51a736
commit e33aaff312
1 changed files with 4 additions and 2 deletions

View File

@ -181,7 +181,7 @@ export async function validate(ctx: BBContext) {
}
export async function exportRows(ctx: BBContext) {
const { datasourceId } = breakExternalTableId(ctx.params.tableId)
const { datasourceId, tableName } = breakExternalTableId(ctx.params.tableId)
const format = ctx.query.format
const { columns } = ctx.request.body
const datasource = await sdk.datasources.get(datasourceId!)
@ -217,7 +217,9 @@ export async function exportRows(ctx: BBContext) {
rows = result.rows
}
// @ts-ignore
if (!tableName) {
ctx.throw(400, "Could not find table name.")
}
let schema = datasource.entities[tableName].schema
let exportRows = cleanExportRows(rows, schema, format, columns)