diff --git a/app/api/routes/user.py b/app/api/routes/user.py index 94ef567..fa03de0 100644 --- a/app/api/routes/user.py +++ b/app/api/routes/user.py @@ -3,8 +3,11 @@ from app.config.database import get_db from app.schemas.users import OTPVerifyRequest, UserCreate, UserResponse -from app.services.user import (get_current_user, register_with_otp, - verify_otp_and_create_user) +from app.services.user import ( + get_current_user, + register_with_otp, + verify_otp_and_create_user, +) router = APIRouter() diff --git a/app/migrations/versions/a4b5fabfdeac_add_otp_table.py b/app/migrations/versions/a4b5fabfdeac_add_otp_table.py index 3eb8d0c..dc5e853 100644 --- a/app/migrations/versions/a4b5fabfdeac_add_otp_table.py +++ b/app/migrations/versions/a4b5fabfdeac_add_otp_table.py @@ -5,14 +5,15 @@ Create Date: 2025-07-24 18:30:31.802426 """ + from typing import Sequence, Union import sqlalchemy as sa from alembic import op # revision identifiers, used by Alembic. -revision: str = 'a4b5fabfdeac' -down_revision: Union[str, Sequence[str], None] = 'ccf5dc612027' +revision: str = "a4b5fabfdeac" +down_revision: Union[str, Sequence[str], None] = "ccf5dc612027" branch_labels: Union[str, Sequence[str], None] = None depends_on: Union[str, Sequence[str], None] = None @@ -20,28 +21,29 @@ def upgrade() -> None: """Upgrade schema.""" # ### commands auto generated by Alembic - please adjust! ### - op.create_table('otps', - sa.Column('id', sa.Integer(), nullable=False), - sa.Column('email', sa.String(), nullable=False), - sa.Column('otp_code', sa.String(), nullable=False), - sa.Column('name', sa.String(), nullable=False), - sa.Column('password', sa.String(), nullable=True), - sa.Column('is_active', sa.Integer(), nullable=True), - sa.Column('provider_id', sa.String(), nullable=True), - sa.Column('auth_type', sa.String(), nullable=False), - sa.Column('created_at', sa.DateTime(), nullable=True), - sa.Column('expires_at', sa.DateTime(), nullable=False), - sa.PrimaryKeyConstraint('id') + op.create_table( + "otps", + sa.Column("id", sa.Integer(), nullable=False), + sa.Column("email", sa.String(), nullable=False), + sa.Column("otp_code", sa.String(), nullable=False), + sa.Column("name", sa.String(), nullable=False), + sa.Column("password", sa.String(), nullable=True), + sa.Column("is_active", sa.Integer(), nullable=True), + sa.Column("provider_id", sa.String(), nullable=True), + sa.Column("auth_type", sa.String(), nullable=False), + sa.Column("created_at", sa.DateTime(), nullable=True), + sa.Column("expires_at", sa.DateTime(), nullable=False), + sa.PrimaryKeyConstraint("id"), ) - op.create_index(op.f('ix_otps_email'), 'otps', ['email'], unique=False) - op.create_index(op.f('ix_otps_id'), 'otps', ['id'], unique=False) + op.create_index(op.f("ix_otps_email"), "otps", ["email"], unique=False) + op.create_index(op.f("ix_otps_id"), "otps", ["id"], unique=False) # ### end Alembic commands ### def downgrade() -> None: """Downgrade schema.""" # ### commands auto generated by Alembic - please adjust! ### - op.drop_index(op.f('ix_otps_id'), table_name='otps') - op.drop_index(op.f('ix_otps_email'), table_name='otps') - op.drop_table('otps') + op.drop_index(op.f("ix_otps_id"), table_name="otps") + op.drop_index(op.f("ix_otps_email"), table_name="otps") + op.drop_table("otps") # ### end Alembic commands ### diff --git a/app/services/user.py b/app/services/user.py index d36d0bc..f0599f1 100644 --- a/app/services/user.py +++ b/app/services/user.py @@ -11,8 +11,12 @@ from app.models.user import AuthType, User from app.schemas.users import UserCreate from app.settings import settings -from app.utils.auth import (cleanup_expired_otps, generate_otp, hash_password, - validate_strong_password) +from app.utils.auth import ( + cleanup_expired_otps, + generate_otp, + hash_password, + validate_strong_password, +) from app.utils.email import send_otp_email security = HTTPBearer() diff --git a/app/utils/http_client.py b/app/utils/http_client.py index d5c28ba..70bc52c 100644 --- a/app/utils/http_client.py +++ b/app/utils/http_client.py @@ -2,8 +2,12 @@ import requests -from app.utils.exceptions import (AppException, RequestConnectionError, - RequestHTTPError, RequestTimeoutError) +from app.utils.exceptions import ( + AppException, + RequestConnectionError, + RequestHTTPError, + RequestTimeoutError, +) def make_request( diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..67d938a --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,6 @@ +[tool.isort] +profile = "black" +line_length = 88 + +[tool.black] +line-length = 88