This commit is contained in:
Timothy Jaeryang Baek
2026-02-09 14:03:35 -06:00
parent 1034b74abd
commit c2f5cb542e
6 changed files with 17 additions and 33 deletions
+3
View File
@@ -184,6 +184,9 @@ class UserInfoResponse(UserStatus):
name: str
email: str
role: str
bio: Optional[str] = None
groups: Optional[list] = []
is_active: bool = False
class UserIdNameResponse(BaseModel):
+8 -1
View File
@@ -484,7 +484,14 @@ async def get_user_info_by_id(
):
user = Users.get_user_by_id(user_id, db=db)
if user:
return user
groups = Groups.get_groups_by_member_id(user_id, db=db)
return UserInfoResponse(
**{
**user.model_dump(),
"groups": [{"id": group.id, "name": group.name} for group in groups],
"is_active": Users.is_user_active(user_id, db=db),
}
)
else:
raise HTTPException(
status_code=status.HTTP_400_BAD_REQUEST,