mirror of
https://github.com/BerriAI/litellm.git
synced 2025-04-25 18:54:30 +00:00
fix(utils.py): change update to upsert
This commit is contained in:
parent
cb52c59481
commit
a650160390
1 changed files with 10 additions and 2 deletions
|
@ -29,9 +29,17 @@ async def add_new_member(
|
|||
"""
|
||||
## ADD TEAM ID, to USER TABLE IF NEW ##
|
||||
if new_member.user_id is not None:
|
||||
await prisma_client.db.litellm_usertable.update(
|
||||
await prisma_client.db.litellm_usertable.upsert(
|
||||
where={"user_id": new_member.user_id},
|
||||
data={"teams": {"push": [team_id]}},
|
||||
data={
|
||||
"update": {
|
||||
"teams": {"push": [team_id]}
|
||||
},
|
||||
"create": {
|
||||
"user_id": new_member.user_id,
|
||||
"teams": [team_id]
|
||||
}
|
||||
},
|
||||
)
|
||||
elif new_member.user_email is not None:
|
||||
user_data = {"user_id": str(uuid.uuid4()), "user_email": new_member.user_email}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue