company flows
This commit is contained in:
parent
c04a6ce6fe
commit
a3a6464a99
15 changed files with 963 additions and 60 deletions
|
|
@ -385,6 +385,37 @@ async def account_is_domain_owner(
|
|||
return domain_id is not None
|
||||
|
||||
|
||||
async def get_owned_domain(
|
||||
session: AsyncSession,
|
||||
domain_id,
|
||||
account_id,
|
||||
) -> MailDomain | None:
|
||||
return await session.scalar(
|
||||
select(MailDomain)
|
||||
.options(
|
||||
selectinload(MailDomain.dns_records),
|
||||
selectinload(MailDomain.smtp_credentials),
|
||||
)
|
||||
.where(
|
||||
MailDomain.id == domain_id,
|
||||
MailDomain.account_id == account_id,
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
async def list_owned_domains(
|
||||
session: AsyncSession,
|
||||
account_id,
|
||||
) -> list[MailDomain]:
|
||||
result = await session.scalars(
|
||||
select(MailDomain)
|
||||
.options(selectinload(MailDomain.dns_records))
|
||||
.where(MailDomain.account_id == account_id)
|
||||
.order_by(MailDomain.created_at.asc())
|
||||
)
|
||||
return list(result.all())
|
||||
|
||||
|
||||
async def get_account_company_domain(
|
||||
session: AsyncSession,
|
||||
account_id,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue