from fastapi import APIRouter, Depends, Request from fastapi.responses import ORJSONResponse from starlette import status from src.presentation.dependencies.commands import get_set_password_command from src.application.commands.set_password import SetPasswordCommand from presentation.schemas.password import SetPasswordRequest users_router = APIRouter(prefix='/users', tags=['users']) @users_router.patch(path='/password', response_class=ORJSONResponse, status_code=status.HTTP_200_OK) async def set_password( request: Request, body: SetPasswordRequest, command: SetPasswordCommand = Depends(get_set_password_command), ): await command(email=body.email, password=body.password) return ORJSONResponse(content={'message': 'Password updated successfully'})