fix: ruff lint + format fixes in tests, ESLint fixes in frontend
This commit is contained in:
@@ -73,7 +73,9 @@ async def _search_contacts(db: AsyncSession, params: dict[str, Any]) -> dict[str
|
||||
}
|
||||
|
||||
|
||||
async def _get_sale_overview(db: AsyncSession, params: dict[str, Any]) -> dict[str, Any]:
|
||||
async def _get_sale_overview(
|
||||
db: AsyncSession, params: dict[str, Any]
|
||||
) -> dict[str, Any]:
|
||||
"""Get an overview of sales, optionally filtered by status or date range."""
|
||||
from app.models.sale import Sale
|
||||
from sqlalchemy import func, select
|
||||
@@ -93,7 +95,9 @@ async def _get_sale_overview(db: AsyncSession, params: dict[str, Any]) -> dict[s
|
||||
total = total_result.scalar_one()
|
||||
|
||||
offset = (page - 1) * page_size
|
||||
data_stmt = data_stmt.offset(offset).limit(page_size).order_by(Sale.created_at.desc())
|
||||
data_stmt = (
|
||||
data_stmt.offset(offset).limit(page_size).order_by(Sale.created_at.desc())
|
||||
)
|
||||
result = await db.execute(data_stmt)
|
||||
sales = list(result.scalars().all())
|
||||
|
||||
@@ -110,7 +114,9 @@ async def _create_vehicle(db: AsyncSession, params: dict[str, Any]) -> dict[str,
|
||||
required = ["make", "model", "fin", "price", "vehicle_type"]
|
||||
missing = [f for f in required if not params.get(f)]
|
||||
if missing:
|
||||
raise ValueError(f"Missing required fields for create_vehicle: {', '.join(missing)}")
|
||||
raise ValueError(
|
||||
f"Missing required fields for create_vehicle: {', '.join(missing)}"
|
||||
)
|
||||
|
||||
vehicle = await vehicle_service.create_vehicle(db, params)
|
||||
return vehicle.to_dict()
|
||||
@@ -121,7 +127,9 @@ async def _create_contact(db: AsyncSession, params: dict[str, Any]) -> dict[str,
|
||||
required = ["company_name", "role"]
|
||||
missing = [f for f in required if not params.get(f)]
|
||||
if missing:
|
||||
raise ValueError(f"Missing required fields for create_contact: {', '.join(missing)}")
|
||||
raise ValueError(
|
||||
f"Missing required fields for create_contact: {', '.join(missing)}"
|
||||
)
|
||||
|
||||
if "address_country" not in params:
|
||||
params["address_country"] = "DE"
|
||||
@@ -193,7 +201,9 @@ def get_available_actions() -> list[dict[str, Any]]:
|
||||
]
|
||||
|
||||
|
||||
async def execute_action(db: AsyncSession, action_type: str, params: dict[str, Any]) -> Any:
|
||||
async def execute_action(
|
||||
db: AsyncSession, action_type: str, params: dict[str, Any]
|
||||
) -> Any:
|
||||
"""Execute a registered action by type.
|
||||
|
||||
Raises ValueError if the action type is not registered.
|
||||
|
||||
Reference in New Issue
Block a user