fix(proxy_server.py): use consistent naming schema - move to /team/block

This commit is contained in:
Krrish Dholakia 2024-03-26 16:59:36 -07:00
parent 4f7ba902d8
commit 77472b80eb
5 changed files with 42 additions and 12 deletions

View file

@ -6152,24 +6152,48 @@ async def team_info(
@router.post(
"/team/disable", tags=["team management"], dependencies=[Depends(user_api_key_auth)]
"/team/block", tags=["team management"], dependencies=[Depends(user_api_key_auth)]
)
async def disable_team(
data: DeleteTeamRequest,
async def block_team(
data: BlockTeamRequest,
user_api_key_dict: UserAPIKeyAuth = Depends(user_api_key_auth),
):
"""
Sets
Blocks all calls from keys with this team id.
"""
global prisma_client
if prisma_client is None:
raise Exception("No DB Connected.")
await prisma_client.db.litellm_teamtable.update_many(
where={"team_id": {"in": data.team_ids}}, data={"disabled": True}
record = await prisma_client.db.litellm_teamtable.update(
where={"team_id": data.team_id}, data={"blocked": True}
)
return record
@router.post(
"/team/unblock", tags=["team management"], dependencies=[Depends(user_api_key_auth)]
)
async def unblock_team(
data: BlockTeamRequest,
user_api_key_dict: UserAPIKeyAuth = Depends(user_api_key_auth),
):
"""
Blocks all calls from keys with this team id.
"""
global prisma_client
if prisma_client is None:
raise Exception("No DB Connected.")
record = await prisma_client.db.litellm_teamtable.update(
where={"team_id": data.team_id}, data={"blocked": False}
)
return record
#### ORGANIZATION MANAGEMENT ####