- Add `timezone` column to User model (VARCHAR 64, default UTC) with idempotent startup migration - Expose and persist timezone via PATCH /api/users/me - Fix TimerEvent.occurred_at serialization to include UTC offset marker (+00:00) so JavaScript correctly parses timestamps as UTC - Add frontend utility (src/utils/time.js) with timezone-aware formatTime, getHHMM, getDateInTZ, tzDateTimeToUTC helpers and a curated IANA timezone list - Add Settings section to Admin page with timezone dropdown; saves to both the API and localStorage for the unauthenticated TV view - Update Activity Log to display and edit times in the user's timezone - Update TV dashboard clock to respect the saved timezone - Update README: features, setup steps, usage table, WebSocket events Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
22 lines
1.1 KiB
Python
22 lines
1.1 KiB
Python
from sqlalchemy import String, Boolean
|
|
from sqlalchemy.orm import Mapped, mapped_column, relationship
|
|
from app.models.base import Base, TimestampMixin
|
|
|
|
|
|
class User(TimestampMixin, Base):
|
|
__tablename__ = "users"
|
|
|
|
id: Mapped[int] = mapped_column(primary_key=True, autoincrement=True)
|
|
email: Mapped[str] = mapped_column(String(255), unique=True, nullable=False, index=True)
|
|
hashed_password: Mapped[str] = mapped_column(String(255), nullable=False)
|
|
full_name: Mapped[str] = mapped_column(String(255), nullable=False)
|
|
is_active: Mapped[bool] = mapped_column(Boolean, default=True)
|
|
is_admin: Mapped[bool] = mapped_column(Boolean, default=False)
|
|
timezone: Mapped[str] = mapped_column(String(64), nullable=False, default="UTC")
|
|
|
|
children: Mapped[list["Child"]] = relationship("Child", back_populates="user") # noqa: F821
|
|
subjects: Mapped[list["Subject"]] = relationship("Subject", back_populates="user") # noqa: F821
|
|
schedule_templates: Mapped[list["ScheduleTemplate"]] = relationship( # noqa: F821
|
|
"ScheduleTemplate", back_populates="user"
|
|
)
|