feat: add image_path to recipe/subtask and user password change API
- Recipe model: add image_path field for recipe-level image
- RecipeSubtask model: add image_path for per-subtask detail images
- Schemas: add image_path to create/update/response for recipe and subtask
- Task router: pass image_path when creating tasks and subtasks
- Recipe service: copy image_path in versioning and update-in-place
- Users router: add PUT /{user_id}/password endpoint (admin only)
- User schema: add UserPasswordChange model
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -13,6 +13,7 @@ class RecipeCreate(BaseModel):
|
||||
code: str = Field(..., min_length=1, max_length=100)
|
||||
name: str = Field(..., min_length=1, max_length=255)
|
||||
description: Optional[str] = None
|
||||
image_path: Optional[str] = Field(None, max_length=500)
|
||||
# Optional task-level fields for the initial technical drawing
|
||||
file_path: Optional[str] = Field(None, max_length=500)
|
||||
file_type: Optional[str] = Field(None, pattern="^(image|pdf)$")
|
||||
@@ -23,6 +24,7 @@ class RecipeUpdate(BaseModel):
|
||||
"""Schema for updating a recipe (creates new version)."""
|
||||
name: Optional[str] = Field(None, min_length=1, max_length=255)
|
||||
description: Optional[str] = None
|
||||
image_path: Optional[str] = Field(None, max_length=500)
|
||||
change_notes: Optional[str] = None
|
||||
# Task-level fields: saved to the first task of the new version
|
||||
file_path: Optional[str] = Field(None, max_length=500)
|
||||
@@ -52,6 +54,7 @@ class RecipeResponse(BaseModel):
|
||||
code: str
|
||||
name: str
|
||||
description: Optional[str] = None
|
||||
image_path: Optional[str] = None
|
||||
created_by: int
|
||||
created_at: datetime
|
||||
active: bool
|
||||
|
||||
@@ -15,6 +15,7 @@ class SubtaskCreate(BaseModel):
|
||||
lwl: Optional[float] = None
|
||||
ltl: Optional[float] = None
|
||||
unit: str = Field("mm", max_length=20)
|
||||
image_path: Optional[str] = Field(None, max_length=500)
|
||||
|
||||
|
||||
class SubtaskUpdate(BaseModel):
|
||||
@@ -27,6 +28,7 @@ class SubtaskUpdate(BaseModel):
|
||||
lwl: Optional[float] = None
|
||||
ltl: Optional[float] = None
|
||||
unit: Optional[str] = Field(None, max_length=20)
|
||||
image_path: Optional[str] = Field(None, max_length=500)
|
||||
|
||||
|
||||
class SubtaskResponse(BaseModel):
|
||||
@@ -44,6 +46,7 @@ class SubtaskResponse(BaseModel):
|
||||
lwl: Optional[float] = None
|
||||
ltl: Optional[float] = None
|
||||
unit: str
|
||||
image_path: Optional[str] = None
|
||||
|
||||
|
||||
class TaskCreate(BaseModel):
|
||||
|
||||
@@ -52,6 +52,11 @@ class UserResponse(BaseModel):
|
||||
last_login: Optional[datetime] = None
|
||||
|
||||
|
||||
class UserPasswordChange(BaseModel):
|
||||
"""Schema for changing user password (admin only)."""
|
||||
password: str = Field(..., min_length=6, max_length=128)
|
||||
|
||||
|
||||
class LoginRequest(BaseModel):
|
||||
"""Schema for login request."""
|
||||
username: str
|
||||
|
||||
Reference in New Issue
Block a user