This commit is contained in:
Eden Kirin
2023-08-27 13:36:35 +02:00
parent 7b16c2f606
commit 73f08f9cb0

View File

@ -13,7 +13,6 @@ from app.domain.machine import (
Repository,
Service,
)
from app.lib.filters import ExactFilter
from app.lib.responses import ObjectListResponse, ObjectResponse
if TYPE_CHECKING:
@ -26,6 +25,7 @@ DETAIL_ROUTE = "/{machine_id:int}"
async def provides_service(db_session: AsyncSession, company_id: int) -> Service:
"""Constructs repository and service objects for the request."""
from app.controllers.company import provides_service
company_service = provides_service(db_session)
company = await company_service.get(company_id)
return Service(Repository(session=db_session, company=company))
@ -33,6 +33,7 @@ async def provides_service(db_session: AsyncSession, company_id: int) -> Service
async def get_company(db_session: AsyncSession, company_id: int) -> Company:
from app.controllers.company import provides_service
company_service = provides_service(db_session)
return await company_service.get(company_id)