diff --git a/Harpoon.Registrations.EFStorage/WebHookRegistrationStore.cs b/Harpoon.Registrations.EFStorage/WebHookRegistrationStore.cs index 254f2eb..d8a8d71 100644 --- a/Harpoon.Registrations.EFStorage/WebHookRegistrationStore.cs +++ b/Harpoon.Registrations.EFStorage/WebHookRegistrationStore.cs @@ -117,6 +117,11 @@ public async Task InsertWebHookAsync(IPrincipal Filters = webHook.Filters.Select(f => new WebHookFilter { Trigger = f.Trigger }).ToList() }; + if (!OnBeforeAdd(dbWebHook)) + { + return WebHookRegistrationStoreResult.Success; + } + try { _context.Add(dbWebHook); @@ -130,6 +135,13 @@ public async Task InsertWebHookAsync(IPrincipal } } + /// + /// Returns a value indicating if the webhook should be added. Give the opportunity to modify the webhook as well. + /// + /// + /// + protected virtual bool OnBeforeAdd(WebHook webhook) => true; + /// public async Task UpdateWebHookAsync(IPrincipal user, IWebHook webHook, CancellationToken cancellationToken = default) {