Files
Crm-Backend/services/deal.py

16 lines
497 B
Python

from sqlalchemy.ext.asyncio import AsyncSession
from repositories import DealRepository
from schemas.deal import GetDealsResponse, DealSchema
class DealService:
def __init__(self, session: AsyncSession):
self.repository = DealRepository(session)
async def get_deals(self, board_id: int) -> GetDealsResponse:
deals = await self.repository.get_all(board_id)
return GetDealsResponse(
deals=[DealSchema.model_validate(deal) for deal in deals]
)