Browse Source

refactor(nocodb): use extractProps on filter update

pull/4969/head
Wing-Kam Wong 2 years ago
parent
commit
f9e8f442c0
  1. 18
      packages/nocodb/src/lib/models/Filter.ts

18
packages/nocodb/src/lib/models/Filter.ts

@ -12,6 +12,7 @@ import View from './View';
import { FilterType, UITypes } from 'nocodb-sdk'; import { FilterType, UITypes } from 'nocodb-sdk';
import NocoCache from '../cache/NocoCache'; import NocoCache from '../cache/NocoCache';
import { NcError } from '../meta/helpers/catchError'; import { NcError } from '../meta/helpers/catchError';
import { extractProps } from '../meta/helpers/extractProps';
export default class Filter { export default class Filter {
id: string; id: string;
@ -218,15 +219,14 @@ export default class Filter {
} }
static async update(id, filter: Partial<Filter>, ncMeta = Noco.ncMeta) { static async update(id, filter: Partial<Filter>, ncMeta = Noco.ncMeta) {
const updateObj = { const updateObj = extractProps(filter, [
fk_column_id: filter.fk_column_id, 'fk_column_id',
comparison_op: filter.comparison_op, 'comparison_op',
value: filter.value, 'value',
fk_parent_id: filter.fk_parent_id, 'fk_parent_id',
'is_group',
is_group: filter.is_group, 'logical_op',
logical_op: filter.logical_op, ]);
};
// get existing cache // get existing cache
const key = `${CacheScope.FILTER_EXP}:${id}`; const key = `${CacheScope.FILTER_EXP}:${id}`;
let o = await NocoCache.get(key, CacheGetType.TYPE_OBJECT); let o = await NocoCache.get(key, CacheGetType.TYPE_OBJECT);

Loading…
Cancel
Save