Skip to content

Commit ad86b28

Browse files
authored
Merge pull request #215 from carlosplanchon/main
refactor: adapt imports to FastCRUD 0.19.0 pagination structure.
2 parents 1f89add + 79a97e3 commit ad86b28

File tree

23 files changed

+790
-800
lines changed

23 files changed

+790
-800
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1125,13 +1125,13 @@ With the `get_multi` method we get a python `dict` with full suport for paginati
11251125
}
11261126
```
11271127

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

11301130
```python
11311131
from typing import Annotated
11321132
from fastapi import Depends, Request
11331133
from sqlalchemy.ext.asyncio import AsyncSession
1134-
from fastcrud.paginated import (
1134+
from fastcrud import (
11351135
PaginatedListResponse, # What you'll use as a response_model to validate
11361136
paginated_response, # Creates a paginated response based on the parameters
11371137
compute_offset, # Calculate the offset for pagination ((page - 1) * items_per_page)

docs/user-guide/api/endpoints.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ async def get_user(
5050
### 2. Get Multiple Items (with Pagination)
5151

5252
```python
53-
from fastcrud.paginated import PaginatedListResponse, paginated_response
53+
from fastcrud import PaginatedListResponse, paginated_response
5454

5555
@router.get("/", response_model=PaginatedListResponse[UserRead])
5656
async def get_users(

docs/user-guide/api/index.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ async def get_users(db: Annotated[AsyncSession, Depends(async_get_db)]):
3131
async def create_user(
3232
user_data: UserCreate,
3333
db: Annotated[AsyncSession, Depends(async_get_db)]
34-
):
34+
):
3535
return await crud_users.create(db=db, object=user_data)
3636
```
3737

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

5555
@router.get("/", response_model=PaginatedListResponse[UserRead])
5656
async def get_users(page: int = 1, items_per_page: int = 10):

docs/user-guide/api/pagination.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ This guide shows you how to add pagination to your API endpoints using the boile
77
Here's how to add basic pagination to any endpoint:
88

99
```python
10-
from fastcrud.paginated import PaginatedListResponse
10+
from fastcrud import PaginatedListResponse
1111

1212
@router.get("/", response_model=PaginatedListResponse[UserRead])
1313
async def get_users(

docs/user-guide/api/versioning.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ async def create_user(user_data: UserCreate):
132132
```python
133133
# src/app/api/v2/users.py
134134
from app.schemas.user import UserReadV2, UserCreateV2 # New schemas
135-
from fastcrud.paginated import PaginatedListResponse
135+
from fastcrud import PaginatedListResponse
136136

137137
# Breaking change: Always return paginated response
138138
@router.get("/", response_model=PaginatedListResponse[UserReadV2])

docs/user-guide/database/crud.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -392,7 +392,8 @@ async def user_management_example(db: AsyncSession):
392392
Using FastCRUD's pagination utilities:
393393

394394
```python
395-
from fastcrud.paginated import compute_offset, paginated_response
395+
from fastcrud import compute_offset, paginated_response
396+
396397

397398
async def get_paginated_users(
398399
db: AsyncSession,

docs/user-guide/database/schemas.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -402,7 +402,7 @@ users = await crud_users.get_multi(
402402
For pagination with page numbers, use `PaginatedListResponse`:
403403

404404
```python
405-
from fastcrud.paginated import PaginatedListResponse
405+
from fastcrud import PaginatedListResponse
406406

407407
# In API endpoint - ONLY for paginated list responses
408408
@router.get("/users/", response_model=PaginatedListResponse[UserRead])

docs/user-guide/development.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ Create `src/app/api/v1/categories.py`:
136136
from typing import Annotated
137137

138138
from fastapi import APIRouter, Depends, HTTPException, Request
139-
from fastcrud.paginated import PaginatedListResponse, compute_offset
139+
from fastcrud import PaginatedListResponse, compute_offset
140140
from sqlalchemy.ext.asyncio import AsyncSession
141141

142142
from ...api.dependencies import get_current_superuser, get_current_user

docs/user-guide/index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,4 +83,4 @@ Ready to dive in? Here are recommended learning paths:
8383
3. Set up [Background Task Processing](background-tasks/index.md)
8484
4. Review the [Production Guide](production.md) for deployment considerations
8585

86-
Choose your path based on your needs and experience level. Each section builds upon previous concepts while remaining self-contained for reference use.
86+
Choose your path based on your needs and experience level. Each section builds upon previous concepts while remaining self-contained for reference use.

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ dependencies = [
2828
"arq>=0.25.0",
2929
"bcrypt>=4.1.1",
3030
"psycopg2-binary>=2.9.9",
31-
"fastcrud>=0.15.5",
31+
"fastcrud>=0.19.0",
3232
"crudadmin>=0.4.2",
3333
"gunicorn>=23.0.0",
3434
"ruff>=0.11.13",

0 commit comments

Comments
 (0)