chore: new telephony config as default (#260)

- Mark first new telephony config as default
- Show telephony config in campaign details
This commit is contained in:
Abhishek 2026-04-30 17:33:16 +05:30 committed by GitHub
parent 14bc66d21d
commit 5cfdbeff02
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 139 additions and 19 deletions

View file

@ -7,7 +7,7 @@ Each row represents one provider account that an organization has connected
from typing import Any, Dict, List, Optional
from sqlalchemy import update
from sqlalchemy import func, update
from sqlalchemy.exc import IntegrityError
from sqlalchemy.future import select
@ -140,7 +140,14 @@ class TelephonyConfigurationClient(BaseDBClient):
)
async with self.async_session() as session:
if is_default_outbound:
existing_count = await session.scalar(
select(func.count(TelephonyConfigurationModel.id)).where(
TelephonyConfigurationModel.organization_id == organization_id,
)
)
if existing_count == 0:
is_default_outbound = True
elif is_default_outbound:
await self._clear_default_outbound(session, organization_id)
row = TelephonyConfigurationModel(