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( res.json(
await hookService.tableSampleData({ await hookService.tableSampleData({
tableId: req.params.tableId, tableId: req.params.tableId,
operation: req.params.operation as 'insert' | 'update', operation: req.params.operation as HookType['operation'],
version: req.params.version as 'v1' | 'v2', version: req.params.version as HookType['version'],
}) })
); );
} }

5
packages/nocodb/src/lib/services/hook.svc.ts

@ -8,6 +8,7 @@ import {
populateSamplePayloadV2, populateSamplePayloadV2,
} from '../meta/helpers/populateSamplePayload'; } from '../meta/helpers/populateSamplePayload';
import type { HookReqType, HookTestReqType } from 'nocodb-sdk'; import type { HookReqType, HookTestReqType } from 'nocodb-sdk';
import { HookType } from 'nocodb-sdk';
function validateHookPayload( function validateHookPayload(
notificationJsonOrObject: string | Record<string, any> notificationJsonOrObject: string | Record<string, any>
@ -100,8 +101,8 @@ export async function hookTest(param: {
export async function tableSampleData(param: { export async function tableSampleData(param: {
tableId: string; tableId: string;
operation: 'insert' | 'update'; operation: HookType['operation'];
version: 'v1' | 'v2'; version: HookType['version'];
}) { }) {
const model = await Model.getByIdOrName({ id: param.tableId }); const model = await Model.getByIdOrName({ id: param.tableId });

Loading…
Cancel
Save