feat(proxy_server.py): new /user/export endpoint

This commit is contained in:
Krrish Dholakia 2024-01-17 18:49:28 -08:00
parent f4c5c56638
commit a739b03e8b
2 changed files with 59 additions and 6 deletions

View file

@ -386,12 +386,21 @@ class PrismaClient:
status_code=status.HTTP_401_UNAUTHORIZED,
detail="Authentication Error: invalid user key - token does not exist",
)
elif user_id is not None:
response = await self.db.litellm_usertable.find_unique( # type: ignore
where={
"user_id": user_id,
}
)
elif user_id is not None or (
table_name is not None and table_name == "user"
):
if user_id is not None and query_type == "find_unique":
response = await self.db.litellm_usertable.find_unique( # type: ignore
where={
"user_id": user_id,
}
)
elif query_type == "find_all" and user_id is not None:
response = await self.db.litellm_usertable.find_many(
where={"user_id": user_id}
)
elif query_type == "find_all":
response = await self.db.litellm_usertable.find_many()
return response
except Exception as e:
print_verbose(f"LiteLLM Prisma Client Exception: {e}")