added burger menu with admin page and user invitation link generation
This commit is contained in:
@@ -0,0 +1,35 @@
|
||||
"""Invitation token model for user registration.
|
||||
|
||||
Note: DateTime(timezone=True) is used for PostgreSQL compatibility.
|
||||
SQLite will store as naive UTC, which is handled in the repository layer.
|
||||
"""
|
||||
|
||||
from datetime import datetime
|
||||
from sqlalchemy import Boolean, DateTime, Integer, String
|
||||
from sqlalchemy.orm import Mapped, mapped_column
|
||||
|
||||
from baby_monitor.repositories.dependencies.get_database import Base
|
||||
|
||||
|
||||
class Invitation(Base):
|
||||
"""Invitation token for new user registration."""
|
||||
|
||||
__tablename__ = "invitations"
|
||||
|
||||
id: Mapped[int] = mapped_column(
|
||||
Integer, primary_key=True, autoincrement=True
|
||||
)
|
||||
token: Mapped[str] = mapped_column(String, unique=True, nullable=False)
|
||||
created_at: Mapped[datetime] = mapped_column(
|
||||
DateTime(timezone=True), nullable=False
|
||||
)
|
||||
expires_at: Mapped[datetime] = mapped_column(
|
||||
DateTime(timezone=True), nullable=False
|
||||
)
|
||||
created_by_user_id: Mapped[int] = mapped_column(Integer, nullable=False)
|
||||
is_consumed: Mapped[bool] = mapped_column(
|
||||
Boolean, default=False, nullable=False
|
||||
)
|
||||
consumed_at: Mapped[datetime | None] = mapped_column(
|
||||
DateTime(timezone=True), nullable=True
|
||||
)
|
||||
Reference in New Issue
Block a user