forked from phoenix/litellm-mirror
feat - raise exception when creating team_id for exiting team_id
This commit is contained in:
parent
b6b86dc539
commit
9ba7d26597
1 changed files with 13 additions and 1 deletions
|
@ -7454,7 +7454,7 @@ async def new_team(
|
||||||
|
|
||||||
Example Request:
|
Example Request:
|
||||||
```
|
```
|
||||||
curl --location 'http://0.0.0.0:8000/team/new' \
|
curl --location 'http://0.0.0.0:4000/team/new' \
|
||||||
|
|
||||||
--header 'Authorization: Bearer sk-1234' \
|
--header 'Authorization: Bearer sk-1234' \
|
||||||
|
|
||||||
|
@ -7475,6 +7475,18 @@ async def new_team(
|
||||||
|
|
||||||
if data.team_id is None:
|
if data.team_id is None:
|
||||||
data.team_id = str(uuid.uuid4())
|
data.team_id = str(uuid.uuid4())
|
||||||
|
else:
|
||||||
|
# Check if team_id exists already
|
||||||
|
_existing_team_id = await prisma_client.get_data(
|
||||||
|
team_id=data.team_id, table_name="team", query_type="find_unique"
|
||||||
|
)
|
||||||
|
if _existing_team_id is not None:
|
||||||
|
raise HTTPException(
|
||||||
|
status_code=400,
|
||||||
|
detail={
|
||||||
|
"error": f"Team id = {data.team_id} already exists. Please use a different team id."
|
||||||
|
},
|
||||||
|
)
|
||||||
|
|
||||||
if (
|
if (
|
||||||
user_api_key_dict.user_role is None
|
user_api_key_dict.user_role is None
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue