diff --git a/packages/nocodb/src/lib/models/Hook.ts b/packages/nocodb/src/lib/models/Hook.ts index e24bd9a460..02c4a393a1 100644 --- a/packages/nocodb/src/lib/models/Hook.ts +++ b/packages/nocodb/src/lib/models/Hook.ts @@ -19,8 +19,8 @@ export default class Hook implements HookType { description?: string; env?: string; type?: string; - event?: 'after' | 'before'; - operation?: 'insert' | 'delete' | 'update'; + event?: HookType['event']; + operation?: HookType['operation']; async?: BoolType; payload?: string; url?: string; @@ -79,8 +79,8 @@ export default class Hook implements HookType { static async list( param: { fk_model_id: string; - event?: 'after' | 'before'; - operation?: 'insert' | 'delete' | 'update'; + event?: HookType['event']; + operation?: HookType['operation']; }, ncMeta = Noco.ncMeta ) { @@ -136,17 +136,6 @@ export default class Hook implements HookType { 'base_id', ]); - if (insertObj.event) { - insertObj.event = insertObj.event.toLowerCase() as 'after' | 'before'; - } - - if (insertObj.operation) { - insertObj.operation = insertObj.operation.toLowerCase() as - | 'insert' - | 'delete' - | 'update'; - } - if (insertObj.notification && typeof insertObj.notification === 'object') { insertObj.notification = JSON.stringify(insertObj.notification); } @@ -200,17 +189,6 @@ export default class Hook implements HookType { 'active', ]); - if (updateObj.event) { - updateObj.event = updateObj.event.toLowerCase() as 'after' | 'before'; - } - - if (updateObj.operation) { - updateObj.operation = updateObj.operation.toLowerCase() as - | 'insert' - | 'delete' - | 'update'; - } - if (updateObj.notification && typeof updateObj.notification === 'object') { updateObj.notification = JSON.stringify(updateObj.notification); } diff --git a/packages/nocodb/src/lib/models/HookLog.ts b/packages/nocodb/src/lib/models/HookLog.ts index 2b1292907c..12d0ed8b0d 100644 --- a/packages/nocodb/src/lib/models/HookLog.ts +++ b/packages/nocodb/src/lib/models/HookLog.ts @@ -10,8 +10,8 @@ export default class HookLog implements HookLogType { project_id?: string; fk_hook_id?: string; type?: string; - event?: 'after' | 'before'; - operation?: 'insert' | 'update' | 'delete'; + event?: HookLogType['event']; + operation?: HookLogType['operation']; test_call?: boolean; payload?: string; conditions?: string; @@ -30,8 +30,8 @@ export default class HookLog implements HookLogType { static async list( param: { fk_hook_id: string; - event?: 'after' | 'before'; - operation?: 'insert' | 'delete' | 'update'; + event?: HookLogType['event']; + operation?: HookLogType['operation']; }, { limit = 25,