Introduce webhook v2 (#17456)

Migrate webhook to v2 entity
This commit is contained in:
Charles Bochet
2026-01-27 16:32:33 +01:00
committed by GitHub
parent 27e5b9797b
commit bc7791871f
83 changed files with 1574 additions and 975 deletions
@@ -1,8 +1,8 @@
import { type WebhookFormValues } from '@/settings/developers/validation-schemas/webhookFormSchema';
import {
createWebhookCreateInput,
createWebhookUpdateInput,
} from '@/settings/developers/utils/createWebhookInput';
import { type WebhookFormValues } from '@/settings/developers/validation-schemas/webhookFormSchema';
describe('createWebhookInput', () => {
const mockFormValues: WebhookFormValues = {
@@ -43,11 +43,9 @@ describe('createWebhookInput', () => {
describe('createWebhookUpdateInput', () => {
it('should create input for webhook update with id', () => {
const webhookId = 'test-webhook-id';
const result = createWebhookUpdateInput(mockFormValues, webhookId);
const result = createWebhookUpdateInput(mockFormValues);
expect(result).toEqual({
id: 'test-webhook-id',
targetUrl: 'https://test.com/webhook',
operations: ['person.created', 'company.updated'],
description: 'Test webhook',
@@ -60,12 +58,10 @@ describe('createWebhookInput', () => {
...mockFormValues,
targetUrl: ' https://example.com ',
};
const webhookId = 'test-webhook-id';
const result = createWebhookUpdateInput(formValues, webhookId);
const result = createWebhookUpdateInput(formValues);
expect(result.targetUrl).toBe('https://example.com');
expect(result.id).toBe('test-webhook-id');
});
});
});
@@ -12,14 +12,10 @@ export const createWebhookCreateInput = (formValues: WebhookFormValues) => {
};
};
export const createWebhookUpdateInput = (
formValues: WebhookFormValues,
webhookId: string,
) => {
export const createWebhookUpdateInput = (formValues: WebhookFormValues) => {
const cleanedOperations = cleanAndFormatOperations(formValues.operations);
return {
id: webhookId,
targetUrl: formValues.targetUrl.trim(),
operations: cleanedOperations,
description: formValues.description,