- FastAPI backend mit Domain-Check, TLD-Pricing, User-Management - Next.js frontend mit modernem UI - Sortierbare TLD-Tabelle mit Mini-Charts - Domain availability monitoring - Subscription tiers (Starter, Professional, Enterprise) - Authentication & Authorization - Scheduler für automatische Domain-Checks
42 lines
1.4 KiB
Python
42 lines
1.4 KiB
Python
"""User model."""
|
|
from datetime import datetime
|
|
from sqlalchemy import String, Boolean, DateTime
|
|
from sqlalchemy.orm import Mapped, mapped_column, relationship
|
|
|
|
from app.database import Base
|
|
|
|
|
|
class User(Base):
|
|
"""User model for authentication and domain tracking."""
|
|
|
|
__tablename__ = "users"
|
|
|
|
id: Mapped[int] = mapped_column(primary_key=True, index=True)
|
|
email: Mapped[str] = mapped_column(String(255), unique=True, index=True, nullable=False)
|
|
hashed_password: Mapped[str] = mapped_column(String(255), nullable=False)
|
|
|
|
# Profile
|
|
name: Mapped[str | None] = mapped_column(String(100), nullable=True)
|
|
|
|
# Status
|
|
is_active: Mapped[bool] = mapped_column(Boolean, default=True)
|
|
is_verified: Mapped[bool] = mapped_column(Boolean, default=False)
|
|
|
|
# Timestamps
|
|
created_at: Mapped[datetime] = mapped_column(DateTime, default=datetime.utcnow)
|
|
updated_at: Mapped[datetime] = mapped_column(
|
|
DateTime, default=datetime.utcnow, onupdate=datetime.utcnow
|
|
)
|
|
|
|
# Relationships
|
|
domains: Mapped[list["Domain"]] = relationship(
|
|
"Domain", back_populates="user", cascade="all, delete-orphan"
|
|
)
|
|
subscription: Mapped["Subscription"] = relationship(
|
|
"Subscription", back_populates="user", uselist=False, cascade="all, delete-orphan"
|
|
)
|
|
|
|
def __repr__(self) -> str:
|
|
return f"<User {self.email}>"
|
|
|