Browse Source

refactor(nocodb): remove unused hookFilter

pull/5269/head
Wing-Kam Wong 2 years ago
parent
commit
cc61e20d4b
  1. 94
      packages/nocodb/src/lib/controllers/hookFilter.ctl.ts
  2. 2
      packages/nocodb/src/lib/meta/api/index.ts

94
packages/nocodb/src/lib/controllers/hookFilter.ctl.ts

@ -1,94 +0,0 @@
import { Router } from 'express';
import { T } from 'nc-help';
import ncMetaAclMw from '../meta/helpers/ncMetaAclMw';
import { metaApiMetrics } from '../meta/helpers/apiMetrics';
import { hookFilterService } from '../services';
import { PagedResponseImpl } from '../meta/helpers/PagedResponse';
import type { Request, Response } from 'express';
export async function filterGet(req: Request, res: Response) {
const filter = await hookFilterService.filterGet({
hookId: req.params.hookId,
});
res.json(filter);
}
export async function filterList(req: Request, res: Response) {
res.json(
new PagedResponseImpl(
await hookFilterService.filterList({
hookId: req.params.hookId,
})
)
);
}
export async function filterChildrenRead(req: Request, res: Response) {
const filter = await hookFilterService.filterChildrenRead({
hookId: req.params.hookId,
filterParentId: req.params.filterParentId,
});
res.json(filter);
}
export async function filterCreate(req: Request<any, any>, res) {
const filter = await hookFilterService.filterCreate({
filter: req.body,
hookId: req.params.hookId,
});
res.json(filter);
}
export async function filterUpdate(req, res) {
const filter = await hookFilterService.filterUpdate({
filterId: req.params.filterId,
filter: req.body,
hookId: req.params.hookId,
});
res.json(filter);
}
export async function filterDelete(req: Request, res: Response) {
const filter = await hookFilterService.filterDelete({
filterId: req.params.filterId,
});
T.emit('evt', { evt_type: 'hookFilter:deleted' });
res.json(filter);
}
const router = Router({ mergeParams: true });
router.get(
'/hooks/:hookId/filters/',
metaApiMetrics,
ncMetaAclMw(filterList, 'filterList')
);
router.post(
'/hooks/:hookId/filters/',
metaApiMetrics,
ncMetaAclMw(filterCreate, 'filterCreate')
);
router.get(
'/hooks/:hookId/filters/:filterId',
metaApiMetrics,
ncMetaAclMw(filterGet, 'filterGet')
);
router.patch(
'/hooks/:hookId/filters/:filterId',
metaApiMetrics,
ncMetaAclMw(filterUpdate, 'filterUpdate')
);
router.delete(
'/hooks/:hookId/filters/:filterId',
metaApiMetrics,
ncMetaAclMw(filterDelete, 'filterDelete')
);
router.get(
'/hooks/:hookId/filters/:filterParentId/children',
metaApiMetrics,
ncMetaAclMw(filterChildrenRead, 'filterChildrenRead')
);
export default router;

2
packages/nocodb/src/lib/meta/api/index.ts

@ -33,7 +33,6 @@ import modelVisibilityController from '../../controllers/modelVisibility.ctl';
import metaDiffController from '../../controllers/metaDiff.ctl'; import metaDiffController from '../../controllers/metaDiff.ctl';
import cacheController from '../../controllers/cache.ctl'; import cacheController from '../../controllers/cache.ctl';
import apiTokenController from '../../controllers/apiToken.ctl'; import apiTokenController from '../../controllers/apiToken.ctl';
import hookFilterController from '../../controllers/hookFilter.ctl';
import testController from '../../controllers/test.ctl'; import testController from '../../controllers/test.ctl';
import { import {
bulkDataAliasController, bulkDataAliasController,
@ -100,7 +99,6 @@ export default function (router: Router, server) {
router.use(metaDiffController); router.use(metaDiffController);
router.use(cacheController); router.use(cacheController);
router.use(apiTokenController); router.use(apiTokenController);
router.use(hookFilterController);
router.use(swaggerController); router.use(swaggerController);
router.use(syncSourceController); router.use(syncSourceController);
router.use(kanbanViewController); router.use(kanbanViewController);

Loading…
Cancel
Save