from api.application.contracts.company.company_request import CompanyByOwnerEmail from api.application.contracts.company.company_response import CompanyBaseResponse from api.domain.company.repository import CompanyRepository class GetCompaniesByOwnerEmail: def __init__(self, company_repository: CompanyRepository) -> None: self.company_repository = company_repository async def execute(self, request: CompanyByOwnerEmail) -> list[CompanyBaseResponse]: companies = await self.company_repository.get_companies_by_owner_email(filter={"email": request.email}) return [CompanyBaseResponse(name=comp.name.value, email=comp.email.value) for comp in companies]