Skip to content

Commit

Permalink
Merge pull request #54 from a1d4r/develop
Browse files Browse the repository at this point in the history
Deploy: Fix telegram ID
  • Loading branch information
a1d4r authored Oct 26, 2024
2 parents f8173d3 + bc2aa43 commit 568c28a
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 4 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
"""Make telegram id int64

Revision ID: 249977e15076
Revises: 272acf3925ed
Create Date: 2024-10-26 12:57:00.043010

"""

from collections.abc import Sequence

import sqlalchemy as sa

from alembic import op

# revision identifiers, used by Alembic.
revision: str = "249977e15076"
down_revision: str | None = "272acf3925ed"
branch_labels: str | Sequence[str] | None = None
depends_on: str | Sequence[str] | None = None


def upgrade() -> None:
op.alter_column(
"users", "tg_id", existing_type=sa.INTEGER(), type_=sa.BigInteger(), existing_nullable=False
)


def downgrade() -> None:
op.alter_column(
"users", "tg_id", existing_type=sa.BigInteger(), type_=sa.INTEGER(), existing_nullable=False
)
2 changes: 1 addition & 1 deletion tests/test_user_repo.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ async def test_create_users_with_settings(
test_session: AsyncSession, user_repository: UserRepository
):
# Arrange
tg_id = 1
tg_id = 8240784014
user = User(
tg_id=tg_id,
settings=UserSettings(
Expand Down
4 changes: 3 additions & 1 deletion vkusvill_green_labels/core/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,8 @@ def validate_environment(cls, v: str | None) -> str | None:


class WebServerSettings(BaseSettings):
model_config = SettingsConfigDict(extra="ignore")

host: str = "127.0.0.1"
port: int = 8080

Expand All @@ -117,7 +119,7 @@ class Settings(BaseSettings):
database: DatabaseSettings
redis: RedisSettings
sentry: SentrySettings
web_server: WebServerSettings
web_server: WebServerSettings = WebServerSettings()
log_level: str = "INFO"
update_interval: int = Field(..., description="Update interval in seconds")

Expand Down
4 changes: 2 additions & 2 deletions vkusvill_green_labels/models/db/user.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

from uuid import uuid4

from sqlalchemy import UUID, ForeignKey
from sqlalchemy import UUID, BigInteger, ForeignKey
from sqlalchemy.orm import Mapped, mapped_column, relationship

from vkusvill_green_labels.models.db.base import Base
Expand All @@ -18,7 +18,7 @@ class User(Base):
__tablename__ = "users"

id: Mapped[UserID] = mapped_column(UUID, default=uuid4, primary_key=True)
tg_id: Mapped[int] = mapped_column(index=True, unique=True)
tg_id: Mapped[int] = mapped_column(BigInteger, index=True, unique=True)
first_name: Mapped[str | None]
last_name: Mapped[str | None]
username: Mapped[str | None]
Expand Down

0 comments on commit 568c28a

Please sign in to comment.