Skip to content

Commit

Permalink
chore: add endpoint to update users (#1993)
Browse files Browse the repository at this point in the history
Co-authored-by: Shubham Naik <[email protected]>
  • Loading branch information
4shub and Shubham Naik authored Nov 7, 2024
1 parent 79582b9 commit e5c194b
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion letta/server/rest_api/routers/v1/users.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from fastapi import APIRouter, Body, Depends, HTTPException, Query

from letta.schemas.api_key import APIKey, APIKeyCreate
from letta.schemas.user import User, UserCreate
from letta.schemas.user import User, UserCreate, UserUpdate
from letta.server.rest_api.utils import get_letta_server

# from letta.server.schemas.users import (
Expand Down Expand Up @@ -56,6 +56,18 @@ def create_user(
return user


@router.put("/", tags=["admin"], response_model=User, operation_id="update_user")
def update_user(
user: UserUpdate = Body(...),
server: "SyncServer" = Depends(get_letta_server),
):
"""
Update a user in the database
"""
user = server.user_manager.update_user(user)
return user


@router.delete("/", tags=["admin"], response_model=User, operation_id="delete_user")
def delete_user(
user_id: str = Query(..., description="The user_id key to be deleted."),
Expand Down

0 comments on commit e5c194b

Please sign in to comment.