fix(proxy_server.py): bug fixes

This commit is contained in:
Krrish Dholakia 2024-02-25 00:12:16 -08:00
parent c33a472611
commit a83f890a9c
2 changed files with 7 additions and 4 deletions

View file

@ -4453,13 +4453,13 @@ async def new_team(
await prisma_client.update_data( await prisma_client.update_data(
user_id=user.user_id, user_id=user.user_id,
data={"user_id": user.user_id, "teams": [team_row.team_id]}, data={"user_id": user.user_id, "teams": [team_row.team_id]},
update_key_values={ update_key_values_custom_query={
"teams": { "teams": {
"push ": [team_row.team_id], "push ": [team_row.team_id],
} }
}, },
) )
return team_row return team_row.model_dump()
@router.post( @router.post(

View file

@ -873,6 +873,7 @@ class PrismaClient:
query_type: Literal["update", "update_many"] = "update", query_type: Literal["update", "update_many"] = "update",
table_name: Optional[Literal["user", "key", "config", "spend", "team"]] = None, table_name: Optional[Literal["user", "key", "config", "spend", "team"]] = None,
update_key_values: Optional[dict] = None, update_key_values: Optional[dict] = None,
update_key_values_custom_query: Optional[dict] = None,
): ):
""" """
Update existing data Update existing data
@ -908,7 +909,10 @@ class PrismaClient:
if user_id is None: if user_id is None:
user_id = db_data["user_id"] user_id = db_data["user_id"]
if update_key_values is None: if update_key_values is None:
update_key_values = db_data if update_key_values_custom_query is not None:
update_key_values = update_key_values_custom_query
else:
update_key_values = db_data
update_user_row = await self.db.litellm_usertable.upsert( update_user_row = await self.db.litellm_usertable.upsert(
where={"user_id": user_id}, # type: ignore where={"user_id": user_id}, # type: ignore
data={ data={
@ -950,7 +954,6 @@ class PrismaClient:
update_key_values["members_with_roles"] = json.dumps( update_key_values["members_with_roles"] = json.dumps(
update_key_values["members_with_roles"] update_key_values["members_with_roles"]
) )
update_team_row = await self.db.litellm_teamtable.upsert( update_team_row = await self.db.litellm_teamtable.upsert(
where={"team_id": team_id}, # type: ignore where={"team_id": team_id}, # type: ignore
data={ data={