From 73bfc0108a019ece0e6491b7a52b6c1277840591 Mon Sep 17 00:00:00 2001 From: Wing-Kam Wong Date: Wed, 29 Mar 2023 13:48:23 +0800 Subject: [PATCH] fix(nocodb): hook version & operation types --- packages/nocodb/src/lib/controllers/hook.ctl.ts | 4 ++-- packages/nocodb/src/lib/services/hook.svc.ts | 5 +++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/packages/nocodb/src/lib/controllers/hook.ctl.ts b/packages/nocodb/src/lib/controllers/hook.ctl.ts index 5bb0ca979e..bf909e2ffc 100644 --- a/packages/nocodb/src/lib/controllers/hook.ctl.ts +++ b/packages/nocodb/src/lib/controllers/hook.ctl.ts @@ -57,8 +57,8 @@ export async function tableSampleData(req: Request, res: Response) { res.json( await hookService.tableSampleData({ tableId: req.params.tableId, - operation: req.params.operation as 'insert' | 'update', - version: req.params.version as 'v1' | 'v2', + operation: req.params.operation as HookType['operation'], + version: req.params.version as HookType['version'], }) ); } diff --git a/packages/nocodb/src/lib/services/hook.svc.ts b/packages/nocodb/src/lib/services/hook.svc.ts index 78f70084ac..a3122cff5a 100644 --- a/packages/nocodb/src/lib/services/hook.svc.ts +++ b/packages/nocodb/src/lib/services/hook.svc.ts @@ -8,6 +8,7 @@ import { populateSamplePayloadV2, } from '../meta/helpers/populateSamplePayload'; import type { HookReqType, HookTestReqType } from 'nocodb-sdk'; +import { HookType } from 'nocodb-sdk'; function validateHookPayload( notificationJsonOrObject: string | Record @@ -100,8 +101,8 @@ export async function hookTest(param: { export async function tableSampleData(param: { tableId: string; - operation: 'insert' | 'update'; - version: 'v1' | 'v2'; + operation: HookType['operation']; + version: HookType['version']; }) { const model = await Model.getByIdOrName({ id: param.tableId });