fix: ruff lint + format fixes in tests, ESLint fixes in frontend
This commit is contained in:
@@ -24,6 +24,7 @@ class ContactPersonBase(BaseModel):
|
||||
|
||||
class ContactPersonCreate(ContactPersonBase):
|
||||
"""POST /api/v1/contacts/:id/persons request body."""
|
||||
|
||||
pass
|
||||
|
||||
|
||||
|
||||
@@ -10,14 +10,18 @@ class ChatRequest(BaseModel):
|
||||
"""Request body for POST /copilot/chat."""
|
||||
|
||||
message: str = Field(..., min_length=1, description="User message to the Copilot")
|
||||
session_id: Optional[str] = Field(None, description="Existing session UUID to continue")
|
||||
session_id: Optional[str] = Field(
|
||||
None, description="Existing session UUID to continue"
|
||||
)
|
||||
|
||||
|
||||
class ActionItem(BaseModel):
|
||||
"""A single action proposed by the Copilot."""
|
||||
|
||||
type: str = Field(..., description="Action type, e.g. search_vehicles")
|
||||
params: dict[str, Any] = Field(default_factory=dict, description="Action parameters")
|
||||
params: dict[str, Any] = Field(
|
||||
default_factory=dict, description="Action parameters"
|
||||
)
|
||||
|
||||
|
||||
class ChatResponse(BaseModel):
|
||||
@@ -26,7 +30,9 @@ class ChatResponse(BaseModel):
|
||||
model_config = ConfigDict(from_attributes=True)
|
||||
|
||||
response: str = Field(..., description="Assistant text response")
|
||||
actions: list[ActionItem] = Field(default_factory=list, description="Proposed actions")
|
||||
actions: list[ActionItem] = Field(
|
||||
default_factory=list, description="Proposed actions"
|
||||
)
|
||||
session_id: str = Field(..., description="Session UUID")
|
||||
message_id: str = Field(..., description="Assistant message UUID")
|
||||
|
||||
@@ -35,7 +41,9 @@ class ActionRequest(BaseModel):
|
||||
"""Request body for POST /copilot/action — user confirms an action."""
|
||||
|
||||
action: str = Field(..., min_length=1, description="Action type to execute")
|
||||
params: dict[str, Any] = Field(default_factory=dict, description="Action parameters")
|
||||
params: dict[str, Any] = Field(
|
||||
default_factory=dict, description="Action parameters"
|
||||
)
|
||||
session_id: Optional[str] = Field(None, description="Session context")
|
||||
|
||||
|
||||
@@ -89,6 +97,8 @@ class VoiceResponse(BaseModel):
|
||||
|
||||
transcription: str = Field(..., description="Transcribed text")
|
||||
response: str = Field(..., description="Assistant text response")
|
||||
actions: list[ActionItem] = Field(default_factory=list, description="Proposed actions")
|
||||
actions: list[ActionItem] = Field(
|
||||
default_factory=list, description="Proposed actions"
|
||||
)
|
||||
session_id: str = Field(..., description="Session UUID")
|
||||
message_id: str = Field(..., description="Assistant message UUID")
|
||||
|
||||
@@ -9,12 +9,14 @@ from pydantic import BaseModel, ConfigDict, EmailStr, Field
|
||||
|
||||
class LoginRequest(BaseModel):
|
||||
"""POST /api/v1/auth/login request body."""
|
||||
|
||||
email: EmailStr
|
||||
password: str = Field(..., min_length=1)
|
||||
|
||||
|
||||
class TokenResponse(BaseModel):
|
||||
"""JWT token pair returned after login or refresh."""
|
||||
|
||||
access_token: str
|
||||
refresh_token: str
|
||||
token_type: str = "bearer"
|
||||
@@ -23,11 +25,13 @@ class TokenResponse(BaseModel):
|
||||
|
||||
class RefreshRequest(BaseModel):
|
||||
"""POST /api/v1/auth/refresh request body."""
|
||||
|
||||
refresh_token: str
|
||||
|
||||
|
||||
class UserBase(BaseModel):
|
||||
"""Base user fields shared across schemas."""
|
||||
|
||||
email: EmailStr
|
||||
full_name: str = Field(..., min_length=1, max_length=200)
|
||||
role: Literal["admin", "verkaeufer", "buchhaltung"] = "verkaeufer"
|
||||
@@ -36,11 +40,13 @@ class UserBase(BaseModel):
|
||||
|
||||
class UserCreate(UserBase):
|
||||
"""POST /api/v1/users request body."""
|
||||
|
||||
password: str = Field(..., min_length=8, max_length=128)
|
||||
|
||||
|
||||
class UserUpdate(BaseModel):
|
||||
"""PUT /api/v1/users/:id request body (all fields optional)."""
|
||||
|
||||
email: Optional[EmailStr] = None
|
||||
full_name: Optional[str] = Field(None, min_length=1, max_length=200)
|
||||
role: Optional[Literal["admin", "verkaeufer", "buchhaltung"]] = None
|
||||
@@ -50,6 +56,7 @@ class UserUpdate(BaseModel):
|
||||
|
||||
class UserResponse(BaseModel):
|
||||
"""User response schema (never exposes password_hash)."""
|
||||
|
||||
model_config = ConfigDict(from_attributes=True)
|
||||
|
||||
id: uuid.UUID
|
||||
@@ -64,6 +71,7 @@ class UserResponse(BaseModel):
|
||||
|
||||
class UserListResponse(BaseModel):
|
||||
"""Paginated user list response."""
|
||||
|
||||
items: list[UserResponse]
|
||||
total: int
|
||||
page: int
|
||||
@@ -72,9 +80,11 @@ class UserListResponse(BaseModel):
|
||||
|
||||
class ErrorResponse(BaseModel):
|
||||
"""Standard error response format."""
|
||||
|
||||
error: dict
|
||||
|
||||
|
||||
class HealthResponse(BaseModel):
|
||||
"""Health check response."""
|
||||
|
||||
status: str = "ok"
|
||||
|
||||
@@ -50,6 +50,7 @@ class VehicleBase(BaseModel):
|
||||
|
||||
class VehicleCreate(VehicleBase):
|
||||
"""POST /api/v1/vehicles request body."""
|
||||
|
||||
pass
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user