46 lines
1.5 KiB
Python
46 lines
1.5 KiB
Python
"""Deal API stubs covering list/create/update operations."""
|
|
from __future__ import annotations
|
|
|
|
from decimal import Decimal
|
|
|
|
from fastapi import APIRouter, Query, status
|
|
|
|
from .models import DealCreatePayload, DealUpdatePayload
|
|
|
|
router = APIRouter(prefix="/deals", tags=["deals"])
|
|
|
|
|
|
def _stub(endpoint: str) -> dict[str, str]:
|
|
return {"detail": f"{endpoint} is not implemented yet"}
|
|
|
|
|
|
@router.get("/", status_code=status.HTTP_501_NOT_IMPLEMENTED)
|
|
async def list_deals(
|
|
page: int = Query(1, ge=1),
|
|
page_size: int = Query(20, ge=1, le=100),
|
|
status_filter: list[str] | None = Query(default=None, alias="status"),
|
|
min_amount: Decimal | None = None,
|
|
max_amount: Decimal | None = None,
|
|
stage: str | None = None,
|
|
owner_id: int | None = None,
|
|
order_by: str | None = None,
|
|
order: str | None = Query(default=None, pattern="^(asc|desc)$"),
|
|
) -> dict[str, str]:
|
|
"""Placeholder for deal filtering endpoint."""
|
|
_ = (status_filter,)
|
|
return _stub("GET /deals")
|
|
|
|
|
|
@router.post("/", status_code=status.HTTP_501_NOT_IMPLEMENTED)
|
|
async def create_deal(payload: DealCreatePayload) -> dict[str, str]:
|
|
"""Placeholder for creating a new deal."""
|
|
_ = payload
|
|
return _stub("POST /deals")
|
|
|
|
|
|
@router.patch("/{deal_id}", status_code=status.HTTP_501_NOT_IMPLEMENTED)
|
|
async def update_deal(deal_id: int, payload: DealUpdatePayload) -> dict[str, str]:
|
|
"""Placeholder for modifying deal status or stage."""
|
|
_ = (deal_id, payload)
|
|
return _stub("PATCH /deals/{deal_id}")
|