refactor: replace direct calls to provisioning functions with OpenClawProvisioningService methods

This commit is contained in:
Abhimanyu Saharan
2026-02-10 22:30:14 +05:30
parent d9199f8d8d
commit ad75871e61
12 changed files with 703 additions and 844 deletions

View File

@@ -61,6 +61,23 @@ async def get_member(
).first(session)
async def get_org_owner_user(
session: AsyncSession,
*,
organization_id: UUID,
) -> User | None:
"""Return the org owner User, if one exists."""
owner = (
await OrganizationMember.objects.filter_by(organization_id=organization_id)
.filter(col(OrganizationMember.role) == "owner")
.order_by(col(OrganizationMember.created_at).asc())
.first(session)
)
if owner is None:
return None
return await User.objects.by_id(owner.user_id).first(session)
async def get_first_membership(
session: AsyncSession,
user_id: UUID,