20 lines
613 B
Python
20 lines
613 B
Python
"""Self-service user endpoints (the authenticated caller acts on themselves)."""
|
|
|
|
from fastapi import APIRouter, status
|
|
|
|
from app.api.deps import CurrentUser, UserServiceDep
|
|
from app.api.schemas.user import ChangePasswordRequest
|
|
|
|
router = APIRouter(prefix="/users", tags=["users"])
|
|
|
|
|
|
@router.patch("/me/password", status_code=status.HTTP_204_NO_CONTENT)
|
|
async def change_my_password(
|
|
body: ChangePasswordRequest, user: CurrentUser, users: UserServiceDep
|
|
) -> None:
|
|
await users.change_password(
|
|
user.id,
|
|
current_password=body.current_password,
|
|
new_password=body.new_password,
|
|
)
|