57 lines
1.9 KiB
Python
57 lines
1.9 KiB
Python
"""Deal API stubs covering list/create/update operations."""
|
|
from __future__ import annotations
|
|
|
|
from decimal import Decimal
|
|
|
|
from fastapi import APIRouter, Depends, Query, status
|
|
|
|
from app.api.deps import get_organization_context
|
|
from app.services.organization_service import OrganizationContext
|
|
|
|
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)$"),
|
|
context: OrganizationContext = Depends(get_organization_context),
|
|
) -> dict[str, str]:
|
|
"""Placeholder for deal filtering endpoint."""
|
|
_ = (status_filter, context)
|
|
return _stub("GET /deals")
|
|
|
|
|
|
@router.post("/", status_code=status.HTTP_501_NOT_IMPLEMENTED)
|
|
async def create_deal(
|
|
payload: DealCreatePayload,
|
|
context: OrganizationContext = Depends(get_organization_context),
|
|
) -> dict[str, str]:
|
|
"""Placeholder for creating a new deal."""
|
|
_ = (payload, context)
|
|
return _stub("POST /deals")
|
|
|
|
|
|
@router.patch("/{deal_id}", status_code=status.HTTP_501_NOT_IMPLEMENTED)
|
|
async def update_deal(
|
|
deal_id: int,
|
|
payload: DealUpdatePayload,
|
|
context: OrganizationContext = Depends(get_organization_context),
|
|
) -> dict[str, str]:
|
|
"""Placeholder for modifying deal status or stage."""
|
|
_ = (deal_id, payload, context)
|
|
return _stub("PATCH /deals/{deal_id}")
|