Merge fix/three-bugs-2026-03-22: accept task_code/milestone_code as identifiers, add /config/status endpoint
This commit is contained in:
@@ -51,8 +51,16 @@ def create_comment(comment: schemas.CommentCreate, db: Session = Depends(get_db)
|
||||
|
||||
|
||||
@router.get("/tasks/{task_id}/comments")
|
||||
def list_comments(task_id: int, db: Session = Depends(get_db)):
|
||||
comments = db.query(models.Comment).filter(models.Comment.task_id == task_id).all()
|
||||
def list_comments(task_id: str, db: Session = Depends(get_db)):
|
||||
"""List comments for a task. task_id can be numeric id or task_code."""
|
||||
try:
|
||||
tid = int(task_id)
|
||||
except (ValueError, TypeError):
|
||||
task = db.query(Task).filter(Task.task_code == task_id).first()
|
||||
if not task:
|
||||
raise HTTPException(status_code=404, detail="Task not found")
|
||||
tid = task.id
|
||||
comments = db.query(models.Comment).filter(models.Comment.task_id == tid).all()
|
||||
result = []
|
||||
for c in comments:
|
||||
author = db.query(models.User).filter(models.User.id == c.author_id).first()
|
||||
|
||||
Reference in New Issue
Block a user