Spaces:
Running
Running
| from datetime import datetime | |
| from sqlalchemy import Boolean, DateTime, String, func | |
| from sqlalchemy.orm import Mapped, mapped_column | |
| from app.db.base import Base | |
| class User(Base): | |
| __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) | |
| first_name: Mapped[str | None] = mapped_column(String(100), nullable=True) | |
| last_name: Mapped[str | None] = mapped_column(String(100), nullable=True) | |
| phone: Mapped[str | None] = mapped_column(String(20), nullable=True) | |
| gender: Mapped[str | None] = mapped_column(String(10), nullable=True) | |
| is_active: Mapped[bool] = mapped_column(Boolean, default=True, nullable=False) | |
| created_at: Mapped[datetime] = mapped_column( | |
| DateTime(timezone=True), server_default=func.now(), nullable=False | |
| ) | |