feat: add telnyx webhook api key in telephony config (#270)

This commit is contained in:
Sabiha Khan 2026-05-09 18:03:42 +05:30 committed by GitHub
parent 45a81c88e0
commit 01c201bf09
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
9 changed files with 249 additions and 13 deletions

View file

@ -75,6 +75,34 @@ class TelephonyConfigurationClient(BaseDBClient):
)
return list(result.scalars().all())
async def count_telnyx_configs_missing_webhook_public_key(
self, organization_id: int
) -> int:
"""Count Telnyx configs in this org with no webhook_public_key in credentials.
Used by the org-warnings endpoint to surface a UI nudge until customers
paste their portal-issued public key.
"""
async with self.async_session() as session:
result = await session.execute(
select(func.count(TelephonyConfigurationModel.id)).where(
TelephonyConfigurationModel.organization_id == organization_id,
TelephonyConfigurationModel.provider == "telnyx",
(
TelephonyConfigurationModel.credentials.op("->>")(
"webhook_public_key"
).is_(None)
)
| (
TelephonyConfigurationModel.credentials.op("->>")(
"webhook_public_key"
)
== ""
),
)
)
return int(result.scalar() or 0)
async def list_all_telephony_configurations_by_provider(
self, provider: str
) -> List[TelephonyConfigurationModel]: