forked from hesabix/arc
21 lines
790 B
Python
Executable file
21 lines
790 B
Python
Executable file
from __future__ import annotations
|
|
|
|
from datetime import datetime
|
|
|
|
from sqlalchemy import DateTime, ForeignKey, Integer, JSON
|
|
from sqlalchemy.orm import Mapped, mapped_column
|
|
|
|
from adapters.db.session import Base
|
|
|
|
|
|
class UserUiPreferences(Base):
|
|
"""ترجیحات ظاهری / UI برای هر کاربر (یک ردیف بهازای user_id)."""
|
|
|
|
__tablename__ = "user_ui_preferences"
|
|
|
|
user_id: Mapped[int] = mapped_column(Integer, ForeignKey("users.id", ondelete="CASCADE"), primary_key=True)
|
|
preferences: Mapped[dict] = mapped_column(JSON, nullable=False)
|
|
created_at: Mapped[datetime] = mapped_column(DateTime, default=datetime.utcnow, nullable=False)
|
|
updated_at: Mapped[datetime] = mapped_column(
|
|
DateTime, default=datetime.utcnow, onupdate=datetime.utcnow, nullable=False
|
|
)
|