feat: fix filter boolean #24

Merged
firmanr merged 1 commits from feat/report into development 2024-07-08 23:09:44 +00:00
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';
export default <ReportConfigEntity>{
@ -36,5 +42,26 @@ export default <ReportConfigEntity>{
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 defaultWhereConditions = defaultWhereOptions;
const tableWhereConditions = [...whereCondition, ...whereParts].filter(
Boolean,
);
const defaultWhereConditions = defaultWhereOptions.filter(Boolean);
if (tableWhereConditions.length > 0) {
return `WHERE (${