feat: fix filter boolean

pull/24/head
Firman Ramdhani 2024-07-08 20:51:31 +07:00
parent d149a15530
commit 66a5245e61
2 changed files with 33 additions and 4 deletions

View File

@ -1,4 +1,10 @@
import { DATA_FORMAT, DATA_TYPE, REPORT_GROUP } from '../../../constant'; import {
DATA_FORMAT,
DATA_TYPE,
FILTER_FIELD_TYPE,
FILTER_TYPE,
REPORT_GROUP,
} from '../../../constant';
import { ReportConfigEntity } from '../../../entities/report-config.entity'; import { ReportConfigEntity } from '../../../entities/report-config.entity';
export default <ReportConfigEntity>{ export default <ReportConfigEntity>{
@ -36,5 +42,26 @@ export default <ReportConfigEntity>{
format: DATA_FORMAT.TEXT, format: DATA_FORMAT.TEXT,
}, },
], ],
filter_configs: [], filter_configs: [
{
filed_label: 'Name',
filter_column: 'main__name',
field_type: FILTER_FIELD_TYPE.select,
filter_type: FILTER_TYPE.TEXT_IN_MEMBER,
select_data_source_url: '/v1/season-types',
select_custom_options: [],
select_label_key: 'name',
select_value_key: 'name',
},
{
filed_label: 'Status',
filter_column: 'main__status',
field_type: FILTER_FIELD_TYPE.input_text,
filter_type: FILTER_TYPE.TEXT_EQUAL,
// select_data_source_url: '/v1/season-types',
// select_custom_options: [],
// select_label_key: 'code',
// select_value_key: 'code',
},
],
}; };

View File

@ -360,8 +360,10 @@ export class ReportQueryBuilder {
}); });
} }
const tableWhereConditions = [...whereCondition, ...whereParts]; const tableWhereConditions = [...whereCondition, ...whereParts].filter(
const defaultWhereConditions = defaultWhereOptions; Boolean,
);
const defaultWhereConditions = defaultWhereOptions.filter(Boolean);
if (tableWhereConditions.length > 0) { if (tableWhereConditions.length > 0) {
return `WHERE (${ return `WHERE (${