mirror of
https://github.com/BerriAI/litellm.git
synced 2025-04-25 10:44:24 +00:00
(UI) fix + test displaying number of keys an internal user owns (#6507)
* fix view internal user key count * add test for /user/list * fix test user list * testing ui change * ui new build
This commit is contained in:
parent
9b9f763872
commit
8f3b634eca
31 changed files with 94 additions and 40 deletions
|
@ -797,11 +797,20 @@ async def get_users(
|
|||
total_count = await prisma_client.db.litellm_usertable.count(where=query) # type: ignore
|
||||
|
||||
# Get paginated users
|
||||
users = await prisma_client.db.litellm_usertable.find_many(
|
||||
_users = await prisma_client.db.litellm_usertable.find_many(
|
||||
where=query, # type: ignore
|
||||
skip=skip,
|
||||
take=take,
|
||||
)
|
||||
# Add key_count to each user object directly
|
||||
users = []
|
||||
for user in _users:
|
||||
user = user.model_dump()
|
||||
key_count = await prisma_client.db.litellm_verificationtoken.count(
|
||||
where={"user_id": user["user_id"]}
|
||||
)
|
||||
user["key_count"] = key_count
|
||||
users.append(user)
|
||||
|
||||
# Calculate total pages
|
||||
total_pages = -(-total_count // page_size) # Ceiling division
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue