4a93bd1c44
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
20 lines
828 B
Python
20 lines
828 B
Python
from datetime import datetime, timezone
|
|
|
|
from sqlalchemy import DateTime, String
|
|
from sqlalchemy.orm import Mapped, mapped_column
|
|
|
|
from app.db import Base
|
|
|
|
|
|
class User(Base):
|
|
__tablename__ = "users"
|
|
|
|
id: Mapped[str] = mapped_column(String(64), primary_key=True)
|
|
tenant_id: Mapped[str] = mapped_column(String(64), nullable=False)
|
|
username: Mapped[str] = mapped_column(String(255), unique=True, index=True)
|
|
display_name: Mapped[str] = mapped_column(String(100), nullable=False)
|
|
password_hash: Mapped[str] = mapped_column(String(255), nullable=False)
|
|
role: Mapped[str] = mapped_column(String(32), default="member")
|
|
status: Mapped[str] = mapped_column(String(32), default="active")
|
|
created_at: Mapped[datetime] = mapped_column(DateTime(timezone=True), default=lambda: datetime.now(timezone.utc))
|