Browse Source

fix(nocodb): hook version & operation types

pull/5349/head
Wing-Kam Wong 2 years ago
parent
commit
73bfc0108a
  1. 4
      packages/nocodb/src/lib/controllers/hook.ctl.ts
  2. 5
      packages/nocodb/src/lib/services/hook.svc.ts

4
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'],
})
);
}

5
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<string, any>
@ -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 });

Loading…
Cancel
Save