diff --git a/gestao/db/migrations/versions/2023-11-25-07-13_89f33fa986f8.py b/gestao/db/migrations/versions/2023-11-25-07-13_89f33fa986f8.py index aa30425..84fc517 100644 --- a/gestao/db/migrations/versions/2023-11-25-07-13_89f33fa986f8.py +++ b/gestao/db/migrations/versions/2023-11-25-07-13_89f33fa986f8.py @@ -10,15 +10,19 @@ # revision identifiers, used by Alembic. -revision = '89f33fa986f8' -down_revision = '0084e7dffc7c' +revision = "89f33fa986f8" +down_revision = "0084e7dffc7c" branch_labels = None depends_on = None def upgrade() -> None: with op.batch_alter_table("user") as batch_op: - batch_op.alter_column('mother_date', new_column_name='mother_name', existing_type=sa.String(length=200)) + batch_op.alter_column( + "mother_date", + new_column_name="mother_name", + existing_type=sa.String(length=200), + ) batch_op.add_column( sa.Column("password", sa.String(200), nullable=True), ) @@ -29,6 +33,10 @@ def upgrade() -> None: def downgrade() -> None: with op.batch_alter_table("user") as batch_op: - batch_op.alter_column('mother_name', new_column_name='mother_date', existing_type=sa.String(length=200)) + batch_op.alter_column( + "mother_name", + new_column_name="mother_date", + existing_type=sa.String(length=200), + ) batch_op.drop_column("password") batch_op.drop_column("religion") diff --git a/gestao/web/api/login/views.py b/gestao/web/api/login/views.py index fb46d35..7bb0bb9 100644 --- a/gestao/web/api/login/views.py +++ b/gestao/web/api/login/views.py @@ -8,14 +8,15 @@ router = APIRouter() -@router.post('/user') +@router.post("/user") async def login_user(login_data: AuthUserDTO) -> User: try: - return await User.objects.select_related(User.dependents).get(**login_data.dict()) + return await User.objects.select_related(User.dependents).get( + **login_data.dict() + ) except Exception: logging.error("User not found", exc_info=True) raise HTTPException( status_code=404, - detail='User not found', + detail="User not found", ) -