Browse Source

fix: grouped filter api correction

re #2669

Signed-off-by: Pranav C <pranavxc@gmail.com>
pull/2670/head
Pranav C 2 years ago
parent
commit
ab59d1e4dd
  1. 1
      packages/nocodb/src/lib/meta/api/filterApis.ts
  2. 15
      packages/nocodb/src/lib/models/Filter.ts

1
packages/nocodb/src/lib/meta/api/filterApis.ts

@ -49,7 +49,6 @@ export async function filterChildrenRead(
) { ) {
try { try {
const filter = await Filter.parentFilterList({ const filter = await Filter.parentFilterList({
viewId: req.params.viewId,
parentId: req.params.filterParentId, parentId: req.params.filterParentId,
}); });

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

@ -443,33 +443,24 @@ export default class Filter {
static async parentFilterList( static async parentFilterList(
{ {
viewId,
parentId, parentId,
}: { }: {
viewId: any;
parentId: any; parentId: any;
}, },
ncMeta = Noco.ncMeta ncMeta = Noco.ncMeta
) { ) {
let filterObjs = await NocoCache.getList(CacheScope.FILTER_EXP, [ let filterObjs = await NocoCache.getList(CacheScope.FILTER_EXP, [parentId]);
viewId,
parentId,
]);
if (!filterObjs.length) { if (!filterObjs.length) {
filterObjs = await ncMeta.metaList2(null, null, MetaTable.FILTER_EXP, { filterObjs = await ncMeta.metaList2(null, null, MetaTable.FILTER_EXP, {
condition: { condition: {
fk_parent_id: parentId, fk_parent_id: parentId,
fk_view_id: viewId, // fk_view_id: viewId,
}, },
orderBy: { orderBy: {
order: 'asc', order: 'asc',
}, },
}); });
await NocoCache.setList( await NocoCache.setList(CacheScope.FILTER_EXP, [parentId], filterObjs);
CacheScope.FILTER_EXP,
[viewId, parentId],
filterObjs
);
} }
return filterObjs?.map((f) => new Filter(f)); return filterObjs?.map((f) => new Filter(f));
} }

Loading…
Cancel
Save