From cc61e20d4b7c1e67286942208aab4f71e8e3529f Mon Sep 17 00:00:00 2001 From: Wing-Kam Wong Date: Tue, 14 Mar 2023 16:37:17 +0800 Subject: [PATCH] refactor(nocodb): remove unused hookFilter --- .../src/lib/controllers/hookFilter.ctl.ts | 94 ------------------- packages/nocodb/src/lib/meta/api/index.ts | 2 - 2 files changed, 96 deletions(-) delete mode 100644 packages/nocodb/src/lib/controllers/hookFilter.ctl.ts diff --git a/packages/nocodb/src/lib/controllers/hookFilter.ctl.ts b/packages/nocodb/src/lib/controllers/hookFilter.ctl.ts deleted file mode 100644 index 6794d684ae..0000000000 --- a/packages/nocodb/src/lib/controllers/hookFilter.ctl.ts +++ /dev/null @@ -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, 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; diff --git a/packages/nocodb/src/lib/meta/api/index.ts b/packages/nocodb/src/lib/meta/api/index.ts index 4bca9f34dc..7e8f413898 100644 --- a/packages/nocodb/src/lib/meta/api/index.ts +++ b/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 cacheController from '../../controllers/cache.ctl'; import apiTokenController from '../../controllers/apiToken.ctl'; -import hookFilterController from '../../controllers/hookFilter.ctl'; import testController from '../../controllers/test.ctl'; import { bulkDataAliasController, @@ -100,7 +99,6 @@ export default function (router: Router, server) { router.use(metaDiffController); router.use(cacheController); router.use(apiTokenController); - router.use(hookFilterController); router.use(swaggerController); router.use(syncSourceController); router.use(kanbanViewController);