Browse Source

refactor: filter and sort api corrections

Signed-off-by: Pranav C <pranavxc@gmail.com>
pull/1668/head
Pranav C 3 years ago
parent
commit
02811aefad
  1. 2
      packages/nocodb/src/lib/noco-models/Filter.ts
  2. 8
      packages/nocodb/src/lib/noco/meta/helpers/extractProjectIdAndAuthenticate.ts

2
packages/nocodb/src/lib/noco-models/Filter.ts

@ -388,7 +388,7 @@ export default class Filter {
await deleteRecursively(filter);
}
private static async get(id: string, ncMeta = Noco.ncMeta) {
public static async get(id: string, ncMeta = Noco.ncMeta) {
let filterObj =
id &&
(await NocoCache.get(

8
packages/nocodb/src/lib/noco/meta/helpers/extractProjectIdAndAuthenticate.ts

@ -9,6 +9,8 @@ import FormViewColumn from '../../../noco-models/FormViewColumn';
import GalleryViewColumn from '../../../noco-models/GalleryViewColumn';
import Project from '../../../noco-models/Project';
import Column from '../../../noco-models/Column';
import Filter from '../../../noco-models/Filter';
import Sort from '../../../noco-models/Sort';
export default async (req, res, next) => {
try {
@ -70,6 +72,12 @@ export default async (req, res, next) => {
} else if (params.columnId) {
const column = await Column.get({ colId: params.columnId });
req.ncProjectId = column?.project_id;
} else if (params.filterId) {
const filter = await Filter.get(params.filterId);
req.ncProjectId = filter?.project_id;
} else if (params.sortId) {
const sort = await Sort.get(params.sortId);
req.ncProjectId = sort?.project_id;
}
const user = await new Promise((resolve, _reject) => {

Loading…
Cancel
Save