new features

This commit is contained in:
Daniil
2026-02-27 23:33:56 +03:00
parent 937e58859a
commit dc04efe0fb
41 changed files with 2067 additions and 141 deletions
+8 -2
View File
@@ -2,7 +2,7 @@ from __future__ import annotations
import uuid
from fastapi import APIRouter, Depends, HTTPException, Response, status
from fastapi import APIRouter, Depends, HTTPException, Query, Response, status
from sqlalchemy.ext.asyncio import AsyncSession
from cpv3.infrastructure.auth import get_current_user
@@ -16,11 +16,17 @@ router = APIRouter(prefix="/api/projects", tags=["Projects"])
@router.get("/", response_model=list[ProjectRead])
async def list_all_projects(
search: str | None = Query(None, description="Поиск по названию или описанию"),
status_filter: str | None = Query(
None, alias="status", description="Фильтр по статусу проекта"
),
current_user: User = Depends(get_current_user),
db: AsyncSession = Depends(get_db),
) -> list[ProjectRead]:
service = ProjectService(db)
projects = await service.list_projects(requester=current_user)
projects = await service.list_projects(
requester=current_user, search=search, status=status_filter,
)
return [ProjectRead.model_validate(p) for p in projects]