Add pagination and search to projects API
- Add PaginatedResponse and PaginationMeta schemas - Update GET /api/v1/projects to support: - page param (default: 1) - limit param (default: 20, max: 100) - search param (case-insensitive name search) - Response includes pagination metadata (page, limit, total, total_pages) - Add Python cache files to gitignore
This commit is contained in:
@@ -1,8 +1,23 @@
|
||||
from datetime import datetime
|
||||
from typing import Optional, List
|
||||
from typing import Optional, List, Generic, TypeVar
|
||||
from pydantic import BaseModel
|
||||
from uuid import UUID
|
||||
|
||||
T = TypeVar("T")
|
||||
|
||||
|
||||
# Pagination schemas
|
||||
class PaginationMeta(BaseModel):
|
||||
page: int
|
||||
limit: int
|
||||
total: int
|
||||
total_pages: int
|
||||
|
||||
|
||||
class PaginatedResponse(BaseModel, Generic[T]):
|
||||
items: List[T]
|
||||
pagination: PaginationMeta
|
||||
|
||||
|
||||
# Project schemas
|
||||
class ProjectCreate(BaseModel):
|
||||
|
||||
Reference in New Issue
Block a user