Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: add endpoint to update users #1993

Merged
merged 2 commits into from
Nov 7, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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(...),
mattzh72 marked this conversation as resolved.
Show resolved Hide resolved
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
Loading