fix(backend): Fix webhook ingress URL generation (#9209)
The enum's string *representation* was being inserted in the URL instead of its string *value*. Before: `/api/integrations/ProviderName.GITHUB/webhooks/686db48c-e70d-4340-acf9-ccd0338fddc4/ingress` After: `/api/integrations/github/webhooks/686db48c-e70d-4340-acf9-ccd0338fddc4/ingress` --------- Co-authored-by: Nicholas Tindle <nicholas.tindle@agpt.co>pull/9206/head^2
parent
c3caa111e4
commit
7a9a771718
|
@ -35,7 +35,7 @@ class Webhook(BaseDbModel):
|
||||||
@computed_field
|
@computed_field
|
||||||
@property
|
@property
|
||||||
def url(self) -> str:
|
def url(self) -> str:
|
||||||
return webhook_ingress_url(self.provider.value, self.id)
|
return webhook_ingress_url(self.provider, self.id)
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def from_db(webhook: IntegrationWebhook):
|
def from_db(webhook: IntegrationWebhook):
|
||||||
|
|
|
@ -1,10 +1,11 @@
|
||||||
|
from backend.integrations.providers import ProviderName
|
||||||
from backend.util.settings import Config
|
from backend.util.settings import Config
|
||||||
|
|
||||||
app_config = Config()
|
app_config = Config()
|
||||||
|
|
||||||
|
|
||||||
# TODO: add test to assert this matches the actual API route
|
# TODO: add test to assert this matches the actual API route
|
||||||
def webhook_ingress_url(provider_name: str, webhook_id: str) -> str:
|
def webhook_ingress_url(provider_name: ProviderName, webhook_id: str) -> str:
|
||||||
return (
|
return (
|
||||||
f"{app_config.platform_base_url}/api/integrations/{provider_name}"
|
f"{app_config.platform_base_url}/api/integrations/{provider_name}"
|
||||||
f"/webhooks/{webhook_id}/ingress"
|
f"/webhooks/{webhook_id}/ingress"
|
||||||
|
|
Loading…
Reference in New Issue