1
0
Fork 0
mirror of synced 2024-08-14 01:21:41 +12:00

Fix select statement when no resource

This commit is contained in:
adrinr 2023-02-07 12:29:58 +00:00
parent 3d917bfe22
commit 2cdc2f3fec

View file

@ -90,10 +90,15 @@ function parseFilters(filters: SearchFilters | undefined): SearchFilters {
function generateSelectStatement(
json: QueryJson,
knex: Knex
): (string | Knex.Raw)[] {
): (string | Knex.Raw)[] | "*" {
const { resource, meta } = json
if (!resource) {
return "*"
}
const schema = meta?.table?.schema
return resource!.fields.map(field => {
return resource.fields.map(field => {
const fieldNames = field.split(/\./g)
const tableName = fieldNames[0]
const columnName = fieldNames[1]