Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -1125,13 +1125,13 @@ With the `get_multi` method we get a python `dict` with full suport for paginati
}
```

And in the endpoint, we can import from `fastcrud.paginated` the following functions and Pydantic Schema:
And in the endpoint, we can import from `fastcrud` the following functions and Pydantic Schema:

```python
from typing import Annotated
from fastapi import Depends, Request
from sqlalchemy.ext.asyncio import AsyncSession
from fastcrud.paginated import (
from fastcrud import (
PaginatedListResponse, # What you'll use as a response_model to validate
paginated_response, # Creates a paginated response based on the parameters
compute_offset, # Calculate the offset for pagination ((page - 1) * items_per_page)
Expand Down
2 changes: 1 addition & 1 deletion docs/user-guide/api/endpoints.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ async def get_user(
### 2. Get Multiple Items (with Pagination)

```python
from fastcrud.paginated import PaginatedListResponse, paginated_response
from fastcrud import PaginatedListResponse, paginated_response

@router.get("/", response_model=PaginatedListResponse[UserRead])
async def get_users(
Expand Down
4 changes: 2 additions & 2 deletions docs/user-guide/api/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ async def get_users(db: Annotated[AsyncSession, Depends(async_get_db)]):
async def create_user(
user_data: UserCreate,
db: Annotated[AsyncSession, Depends(async_get_db)]
):
):
return await crud_users.create(db=db, object=user_data)
```

Expand All @@ -50,7 +50,7 @@ async def get_profile(current_user: Annotated[dict, Depends(get_current_user)]):
### 📊 **Easy Pagination**
Paginate any endpoint with one line:
```python
from fastcrud.paginated import PaginatedListResponse
from fastcrud import PaginatedListResponse

@router.get("/", response_model=PaginatedListResponse[UserRead])
async def get_users(page: int = 1, items_per_page: int = 10):
Expand Down
2 changes: 1 addition & 1 deletion docs/user-guide/api/pagination.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ This guide shows you how to add pagination to your API endpoints using the boile
Here's how to add basic pagination to any endpoint:

```python
from fastcrud.paginated import PaginatedListResponse
from fastcrud import PaginatedListResponse

@router.get("/", response_model=PaginatedListResponse[UserRead])
async def get_users(
Expand Down
2 changes: 1 addition & 1 deletion docs/user-guide/api/versioning.md
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ async def create_user(user_data: UserCreate):
```python
# src/app/api/v2/users.py
from app.schemas.user import UserReadV2, UserCreateV2 # New schemas
from fastcrud.paginated import PaginatedListResponse
from fastcrud import PaginatedListResponse

# Breaking change: Always return paginated response
@router.get("/", response_model=PaginatedListResponse[UserReadV2])
Expand Down
3 changes: 2 additions & 1 deletion docs/user-guide/database/crud.md
Original file line number Diff line number Diff line change
Expand Up @@ -392,7 +392,8 @@ async def user_management_example(db: AsyncSession):
Using FastCRUD's pagination utilities:

```python
from fastcrud.paginated import compute_offset, paginated_response
from fastcrud import compute_offset, paginated_response


async def get_paginated_users(
db: AsyncSession,
Expand Down
2 changes: 1 addition & 1 deletion docs/user-guide/database/schemas.md
Original file line number Diff line number Diff line change
Expand Up @@ -402,7 +402,7 @@ users = await crud_users.get_multi(
For pagination with page numbers, use `PaginatedListResponse`:

```python
from fastcrud.paginated import PaginatedListResponse
from fastcrud import PaginatedListResponse

# In API endpoint - ONLY for paginated list responses
@router.get("/users/", response_model=PaginatedListResponse[UserRead])
Expand Down
2 changes: 1 addition & 1 deletion docs/user-guide/development.md
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ Create `src/app/api/v1/categories.py`:
from typing import Annotated

from fastapi import APIRouter, Depends, HTTPException, Request
from fastcrud.paginated import PaginatedListResponse, compute_offset
from fastcrud import PaginatedListResponse, compute_offset
from sqlalchemy.ext.asyncio import AsyncSession

from ...api.dependencies import get_current_superuser, get_current_user
Expand Down
2 changes: 1 addition & 1 deletion docs/user-guide/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -83,4 +83,4 @@ Ready to dive in? Here are recommended learning paths:
3. Set up [Background Task Processing](background-tasks/index.md)
4. Review the [Production Guide](production.md) for deployment considerations

Choose your path based on your needs and experience level. Each section builds upon previous concepts while remaining self-contained for reference use.
Choose your path based on your needs and experience level. Each section builds upon previous concepts while remaining self-contained for reference use.
2 changes: 1 addition & 1 deletion src/app/api/v1/posts.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from typing import Annotated, Any, cast
from fastapi import APIRouter, Depends, Request
from fastcrud.paginated import PaginatedListResponse, compute_offset, paginated_response
from fastcrud import PaginatedListResponse, compute_offset, paginated_response
from sqlalchemy.ext.asyncio import AsyncSession

from ...api.dependencies import get_current_superuser, get_current_user
Expand Down
2 changes: 1 addition & 1 deletion src/app/api/v1/rate_limits.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from typing import Annotated, Any, cast

from fastapi import APIRouter, Depends, Request
from fastcrud.paginated import PaginatedListResponse, compute_offset, paginated_response
from fastcrud import PaginatedListResponse, compute_offset, paginated_response
from sqlalchemy.ext.asyncio import AsyncSession

from ...api.dependencies import get_current_superuser
Expand Down
2 changes: 1 addition & 1 deletion src/app/api/v1/tiers.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from typing import Annotated, Any, cast

from fastapi import APIRouter, Depends, Request
from fastcrud.paginated import PaginatedListResponse, compute_offset, paginated_response
from fastcrud import PaginatedListResponse, compute_offset, paginated_response
from sqlalchemy.ext.asyncio import AsyncSession

from ...api.dependencies import get_current_superuser
Expand Down
2 changes: 1 addition & 1 deletion src/app/api/v1/users.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from typing import Annotated, Any, cast

from fastapi import APIRouter, Depends, Request
from fastcrud.paginated import PaginatedListResponse, compute_offset, paginated_response
from fastcrud import PaginatedListResponse, compute_offset, paginated_response
from sqlalchemy.ext.asyncio import AsyncSession

from ...api.dependencies import get_current_superuser, get_current_user
Expand Down
Loading