chore(quality): apply ruff autofixes and formatting (29 fixes, 41 files reformatted)
This commit is contained in:
@@ -3,12 +3,11 @@
|
||||
from fastapi import APIRouter, Depends, HTTPException, status, Query
|
||||
from sqlalchemy import select, func, or_
|
||||
from sqlalchemy.ext.asyncio import AsyncSession
|
||||
from sqlalchemy.orm import joinedload, selectinload
|
||||
from sqlalchemy.orm import joinedload
|
||||
|
||||
from app.api.deps import get_current_user, require_permission
|
||||
from app.api.deps import require_permission
|
||||
from app.db.session import get_async_session
|
||||
from app.models import User, Contact, Tag
|
||||
from app.models.contact import contact_tags
|
||||
from app.schemas.contact import (
|
||||
ContactCreateRequest,
|
||||
ContactUpdateRequest,
|
||||
@@ -24,7 +23,9 @@ async def list_contacts(
|
||||
page: int = Query(1, ge=1),
|
||||
size: int = Query(20, ge=1, le=100),
|
||||
search: str | None = Query(None, description="Search in name, email, phone"),
|
||||
type: str | None = Query(None, pattern="^(company|person)$", description="Filter by contact type"),
|
||||
type: str | None = Query(
|
||||
None, pattern="^(company|person)$", description="Filter by contact type"
|
||||
),
|
||||
current_user: User = Depends(require_permission("contacts:read")),
|
||||
session: AsyncSession = Depends(get_async_session),
|
||||
):
|
||||
@@ -56,8 +57,7 @@ async def list_contacts(
|
||||
|
||||
# Fetch page with tags eager-loaded
|
||||
q = (
|
||||
base_q
|
||||
.options(joinedload(Contact.tags))
|
||||
base_q.options(joinedload(Contact.tags))
|
||||
.order_by(Contact.updated_at.desc())
|
||||
.offset((page - 1) * size)
|
||||
.limit(size)
|
||||
|
||||
Reference in New Issue
Block a user