feat: pagination and query params for a deal end-point
This commit is contained in:
@ -1,6 +1,6 @@
|
||||
from fastapi import APIRouter, Path
|
||||
from fastapi import APIRouter, Path, Query
|
||||
|
||||
from backend.dependecies import SessionDependency
|
||||
from backend.dependecies import SessionDependency, PaginationDependency
|
||||
from schemas.deal import *
|
||||
from services import DealService
|
||||
|
||||
@ -10,15 +10,17 @@ deal_router = APIRouter(
|
||||
|
||||
|
||||
@deal_router.get(
|
||||
"/{boardId}",
|
||||
"/",
|
||||
response_model=GetDealsResponse,
|
||||
operation_id="get_deals",
|
||||
)
|
||||
async def get_deals(
|
||||
session: SessionDependency,
|
||||
board_id: int = Path(alias="boardId"),
|
||||
pagination: PaginationDependency,
|
||||
board_id: Optional[int] = Query(alias="boardId", default=None),
|
||||
project_id: Optional[int] = Query(alias="projectId", default=None),
|
||||
):
|
||||
return await DealService(session).get_deals(board_id)
|
||||
return await DealService(session).get_deals(pagination, board_id, project_id)
|
||||
|
||||
|
||||
@deal_router.post(
|
||||
|
||||
Reference in New Issue
Block a user