Merge branch 'organizations' (cherry-picked)
This commit is contained in:
@@ -1,7 +1,10 @@
|
||||
"""Activity timeline API stubs."""
|
||||
from __future__ import annotations
|
||||
|
||||
from fastapi import APIRouter, status
|
||||
from fastapi import APIRouter, Depends, status
|
||||
|
||||
from app.api.deps import get_organization_context
|
||||
from app.services.organization_service import OrganizationContext
|
||||
|
||||
from .models import ActivityCommentPayload
|
||||
|
||||
@@ -13,14 +16,21 @@ def _stub(endpoint: str) -> dict[str, str]:
|
||||
|
||||
|
||||
@router.get("/", status_code=status.HTTP_501_NOT_IMPLEMENTED)
|
||||
async def list_activities(deal_id: int) -> dict[str, str]:
|
||||
async def list_activities(
|
||||
deal_id: int,
|
||||
context: OrganizationContext = Depends(get_organization_context),
|
||||
) -> dict[str, str]:
|
||||
"""Placeholder for listing deal activities."""
|
||||
_ = deal_id
|
||||
_ = (deal_id, context)
|
||||
return _stub("GET /deals/{deal_id}/activities")
|
||||
|
||||
|
||||
@router.post("/", status_code=status.HTTP_501_NOT_IMPLEMENTED)
|
||||
async def create_activity_comment(deal_id: int, payload: ActivityCommentPayload) -> dict[str, str]:
|
||||
async def create_activity_comment(
|
||||
deal_id: int,
|
||||
payload: ActivityCommentPayload,
|
||||
context: OrganizationContext = Depends(get_organization_context),
|
||||
) -> dict[str, str]:
|
||||
"""Placeholder for adding a comment activity to a deal."""
|
||||
_ = (deal_id, payload)
|
||||
_ = (deal_id, payload, context)
|
||||
return _stub("POST /deals/{deal_id}/activities")
|
||||
|
||||
@@ -1,7 +1,10 @@
|
||||
"""Analytics API stubs (deal summary and funnel)."""
|
||||
from __future__ import annotations
|
||||
|
||||
from fastapi import APIRouter, Query, status
|
||||
from fastapi import APIRouter, Depends, Query, status
|
||||
|
||||
from app.api.deps import get_organization_context
|
||||
from app.services.organization_service import OrganizationContext
|
||||
|
||||
router = APIRouter(prefix="/analytics", tags=["analytics"])
|
||||
|
||||
@@ -11,13 +14,19 @@ def _stub(endpoint: str) -> dict[str, str]:
|
||||
|
||||
|
||||
@router.get("/deals/summary", status_code=status.HTTP_501_NOT_IMPLEMENTED)
|
||||
async def deals_summary(days: int = Query(30, ge=1, le=180)) -> dict[str, str]:
|
||||
async def deals_summary(
|
||||
days: int = Query(30, ge=1, le=180),
|
||||
context: OrganizationContext = Depends(get_organization_context),
|
||||
) -> dict[str, str]:
|
||||
"""Placeholder for aggregated deal statistics."""
|
||||
_ = days
|
||||
_ = (days, context)
|
||||
return _stub("GET /analytics/deals/summary")
|
||||
|
||||
|
||||
@router.get("/deals/funnel", status_code=status.HTTP_501_NOT_IMPLEMENTED)
|
||||
async def deals_funnel() -> dict[str, str]:
|
||||
async def deals_funnel(
|
||||
context: OrganizationContext = Depends(get_organization_context),
|
||||
) -> dict[str, str]:
|
||||
"""Placeholder for funnel analytics."""
|
||||
_ = context
|
||||
return _stub("GET /analytics/deals/funnel")
|
||||
|
||||
@@ -1,7 +1,10 @@
|
||||
"""Contact API stubs required by the spec."""
|
||||
from __future__ import annotations
|
||||
|
||||
from fastapi import APIRouter, Query, status
|
||||
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 ContactCreatePayload
|
||||
|
||||
@@ -18,13 +21,18 @@ async def list_contacts(
|
||||
page_size: int = Query(20, ge=1, le=100),
|
||||
search: str | None = None,
|
||||
owner_id: int | None = None,
|
||||
context: OrganizationContext = Depends(get_organization_context),
|
||||
) -> dict[str, str]:
|
||||
"""Placeholder list endpoint supporting the required filters."""
|
||||
_ = context
|
||||
return _stub("GET /contacts")
|
||||
|
||||
|
||||
@router.post("/", status_code=status.HTTP_501_NOT_IMPLEMENTED)
|
||||
async def create_contact(payload: ContactCreatePayload) -> dict[str, str]:
|
||||
async def create_contact(
|
||||
payload: ContactCreatePayload,
|
||||
context: OrganizationContext = Depends(get_organization_context),
|
||||
) -> dict[str, str]:
|
||||
"""Placeholder for creating a contact within the current organization."""
|
||||
_ = payload
|
||||
_ = (payload, context)
|
||||
return _stub("POST /contacts")
|
||||
|
||||
@@ -3,7 +3,10 @@ from __future__ import annotations
|
||||
|
||||
from decimal import Decimal
|
||||
|
||||
from fastapi import APIRouter, Query, status
|
||||
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
|
||||
|
||||
@@ -25,21 +28,29 @@ async def list_deals(
|
||||
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,)
|
||||
_ = (status_filter, context)
|
||||
return _stub("GET /deals")
|
||||
|
||||
|
||||
@router.post("/", status_code=status.HTTP_501_NOT_IMPLEMENTED)
|
||||
async def create_deal(payload: DealCreatePayload) -> dict[str, str]:
|
||||
async def create_deal(
|
||||
payload: DealCreatePayload,
|
||||
context: OrganizationContext = Depends(get_organization_context),
|
||||
) -> dict[str, str]:
|
||||
"""Placeholder for creating a new deal."""
|
||||
_ = payload
|
||||
_ = (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) -> dict[str, str]:
|
||||
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)
|
||||
_ = (deal_id, payload, context)
|
||||
return _stub("PATCH /deals/{deal_id}")
|
||||
|
||||
@@ -3,7 +3,10 @@ from __future__ import annotations
|
||||
|
||||
from datetime import date
|
||||
|
||||
from fastapi import APIRouter, Query, status
|
||||
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 TaskCreatePayload
|
||||
|
||||
@@ -20,13 +23,18 @@ async def list_tasks(
|
||||
only_open: bool = False,
|
||||
due_before: date | None = Query(default=None),
|
||||
due_after: date | None = Query(default=None),
|
||||
context: OrganizationContext = Depends(get_organization_context),
|
||||
) -> dict[str, str]:
|
||||
"""Placeholder for task filtering endpoint."""
|
||||
_ = context
|
||||
return _stub("GET /tasks")
|
||||
|
||||
|
||||
@router.post("/", status_code=status.HTTP_501_NOT_IMPLEMENTED)
|
||||
async def create_task(payload: TaskCreatePayload) -> dict[str, str]:
|
||||
async def create_task(
|
||||
payload: TaskCreatePayload,
|
||||
context: OrganizationContext = Depends(get_organization_context),
|
||||
) -> dict[str, str]:
|
||||
"""Placeholder for creating a task linked to a deal."""
|
||||
_ = payload
|
||||
_ = (payload, context)
|
||||
return _stub("POST /tasks")
|
||||
|
||||
Reference in New Issue
Block a user