refactor: improve variable naming and add comments for clarity in models and services
Test / test (push) Successful in 15s

This commit is contained in:
Artem Kashaev
2025-12-01 16:24:23 +05:00
parent 1039fba571
commit dc0046c730
8 changed files with 16 additions and 15 deletions
+4 -4
View File
@@ -11,7 +11,7 @@ from sqlalchemy import DateTime, ForeignKey, Integer, func, text
from sqlalchemy import Enum as SqlEnum
from sqlalchemy.dialects.postgresql import JSONB
from sqlalchemy.orm import Mapped, mapped_column, relationship
from sqlalchemy.types import JSON as GenericJSON
from sqlalchemy.types import JSON as SA_JSON
from sqlalchemy.types import TypeDecorator
from app.models.base import Base, enum_values
@@ -33,9 +33,9 @@ class JSONBCompat(TypeDecorator):
def load_dialect_impl(self, dialect): # type: ignore[override]
if dialect.name == "sqlite":
from sqlalchemy.dialects.sqlite import JSON as SQLiteJSON # local import
from sqlalchemy.dialects.sqlite import JSON as SQLITE_JSON # local import
return dialect.type_descriptor(SQLiteJSON())
return dialect.type_descriptor(SQLITE_JSON())
return dialect.type_descriptor(JSONB())
@@ -55,7 +55,7 @@ class Activity(Base):
nullable=False,
)
payload: Mapped[dict[str, Any]] = mapped_column(
JSONBCompat().with_variant(GenericJSON(), "sqlite"),
JSONBCompat().with_variant(SA_JSON(), "sqlite"),
nullable=False,
server_default=text("'{}'"),
)