From 20840eaad339867a5f80e35d1326693fbc51e4c8 Mon Sep 17 00:00:00 2001 From: Ishaan Jaff Date: Sat, 24 Aug 2024 16:38:43 -0700 Subject: [PATCH] fix linting errors when adding a new team member --- litellm/proxy/management_endpoints/team_endpoints.py | 5 +++++ litellm/proxy/management_helpers/utils.py | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/litellm/proxy/management_endpoints/team_endpoints.py b/litellm/proxy/management_endpoints/team_endpoints.py index a1b1c618f9c..5beafc13e2f 100644 --- a/litellm/proxy/management_endpoints/team_endpoints.py +++ b/litellm/proxy/management_endpoints/team_endpoints.py @@ -571,6 +571,11 @@ async def team_member_add( await asyncio.gather(*tasks) + # Check if updated_team is None + if updated_team is None: + raise HTTPException( + status_code=404, detail={"error": f"Team with id {data.team_id} not found"} + ) return TeamAddMemberResponse( **updated_team.model_dump(), updated_users=updated_users, diff --git a/litellm/proxy/management_helpers/utils.py b/litellm/proxy/management_helpers/utils.py index b7ba5278b42..a361a442fcf 100644 --- a/litellm/proxy/management_helpers/utils.py +++ b/litellm/proxy/management_helpers/utils.py @@ -103,7 +103,7 @@ async def add_new_member( elif len(existing_user_row) == 1: user_info = existing_user_row[0] _returned_user = await prisma_client.db.litellm_usertable.update( - where={"user_id": user_info.user_id}, + where={"user_id": user_info.user_id}, # type: ignore data={"teams": {"push": [team_id]}}, ) returned_user = LiteLLM_UserTable(**_returned_user.model_dump())