feat: implement new API endpoints for activities, analytics, auth, contacts, deals, organizations, tasks, and users; remove obsolete files
Test / test (push) Successful in 12s
Test / test (push) Successful in 12s
This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
"""Organization-related API endpoints."""
|
||||
from __future__ import annotations
|
||||
|
||||
from fastapi import APIRouter, Depends
|
||||
|
||||
from app.api.deps import get_current_user, get_organization_repository
|
||||
from app.models.organization import OrganizationRead
|
||||
from app.models.user import User
|
||||
from app.repositories.org_repo import OrganizationRepository
|
||||
|
||||
router = APIRouter(prefix="/organizations", tags=["organizations"])
|
||||
|
||||
|
||||
@router.get("/me", response_model=list[OrganizationRead])
|
||||
async def list_user_organizations(
|
||||
current_user: User = Depends(get_current_user),
|
||||
repo: OrganizationRepository = Depends(get_organization_repository),
|
||||
) -> list[OrganizationRead]:
|
||||
"""Return organizations the authenticated user belongs to."""
|
||||
|
||||
organizations = await repo.list_for_user(current_user.id)
|
||||
return [OrganizationRead.model_validate(org) for org in organizations]
|
||||
Reference in New Issue
Block a user