feat: get deals endpoint
This commit is contained in:
15
services/deal.py
Normal file
15
services/deal.py
Normal file
@ -0,0 +1,15 @@
|
||||
from sqlalchemy.ext.asyncio import AsyncSession
|
||||
|
||||
from repositories.deal 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]
|
||||
)
|
||||
Reference in New Issue
Block a user