mirror of
https://github.com/dograh-hq/dograh.git
synced 2026-06-07 07:55:16 +02:00
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:
parent
14bc66d21d
commit
5cfdbeff02
4 changed files with 139 additions and 19 deletions
|
|
@ -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(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue