Refactor webhook event name generation in OpenApiService (#11592)

Fixes - #11589
POT - 
![Screenshot 2025-04-16 at 12 39
11 AM](https://github.com/user-attachments/assets/43802e1a-1ece-4b44-831f-35d70285c5fb)
This commit is contained in:
madanlal mohanrao nikalje
2025-04-16 11:33:47 +05:30
committed by GitHub
parent 981b1bd767
commit 4c2c9e4273

View File

@ -82,18 +82,24 @@ export class OpenApiService {
schema.webhooks = objectMetadataItems.reduce(
(paths, item) => {
paths[`Create ${item.nameSingular}`] = computeWebhooks(
DatabaseEventAction.CREATED,
item,
);
paths[`Update ${item.nameSingular}`] = computeWebhooks(
DatabaseEventAction.UPDATED,
item,
);
paths[`Delete ${item.nameSingular}`] = computeWebhooks(
DatabaseEventAction.DELETED,
item,
);
paths[
this.createWebhookEventName(
DatabaseEventAction.CREATED,
item.nameSingular,
)
] = computeWebhooks(DatabaseEventAction.CREATED, item);
paths[
this.createWebhookEventName(
DatabaseEventAction.UPDATED,
item.nameSingular,
)
] = computeWebhooks(DatabaseEventAction.UPDATED, item);
paths[
this.createWebhookEventName(
DatabaseEventAction.DELETED,
item.nameSingular,
)
] = computeWebhooks(DatabaseEventAction.DELETED, item);
return paths;
},
@ -226,4 +232,11 @@ export class OpenApiService {
return schema;
}
createWebhookEventName(
action: DatabaseEventAction,
objectName: string,
): string {
return `${capitalize(objectName)} ${capitalize(action)}`;
}
}