feat(P3.6): lock feature story task body edits when milestone is freeze/undergoing/completed/closed
This commit is contained in:
@@ -209,6 +209,21 @@ def update_task(task_id: int, task_update: schemas.TaskUpdate, db: Session = Dep
|
||||
body_fields = {k for k in update_data.keys() if k not in _always_allowed}
|
||||
|
||||
if body_fields:
|
||||
# P3.6 supplement: feature story tasks locked after milestone freeze
|
||||
task_type = task.task_type.value if hasattr(task.task_type, 'value') else (task.task_type or "")
|
||||
task_subtype = task.task_subtype or ""
|
||||
if task_type == "story" and task_subtype == "feature" and task.milestone_id:
|
||||
from app.models.milestone import Milestone
|
||||
ms = db.query(Milestone).filter(Milestone.id == task.milestone_id).first()
|
||||
if ms:
|
||||
ms_status = ms.status.value if hasattr(ms.status, 'value') else ms.status
|
||||
if ms_status in ("freeze", "undergoing", "completed", "closed"):
|
||||
raise HTTPException(
|
||||
status_code=400,
|
||||
detail=f"Feature story task cannot be edited: milestone is '{ms_status}'. "
|
||||
f"Blocked fields: {sorted(body_fields)}",
|
||||
)
|
||||
|
||||
# undergoing/completed/closed: body edits forbidden
|
||||
if current_status in ("undergoing", "completed", "closed"):
|
||||
raise HTTPException(
|
||||
|
||||
Reference in New Issue
Block a user