feat: enrich member/comment/propose APIs with usernames

- ProjectMemberResponse now includes username and full_name
- Comment list endpoint returns author_username
- ProposeResponse now includes created_by_username
- All serializers resolve User objects to surface human-readable names
- Supports frontend code-first migration (TODO §3.1/3.2)
This commit is contained in:
zhi
2026-03-21 20:28:28 +00:00
parent f45f5957f4
commit 3ff9132596
4 changed files with 46 additions and 9 deletions

View File

@@ -332,9 +332,12 @@ def list_project_members(project_id: str, db: Session = Depends(get_db)):
role = db.query(Role).filter(Role.id == m.role_id).first()
if role:
role_name = role.name
user = db.query(models.User).filter(models.User.id == m.user_id).first()
result.append({
"id": m.id,
"user_id": m.user_id,
"username": user.username if user else None,
"full_name": user.full_name if user else None,
"project_id": m.project_id,
"role": role_name
})