Download backend/models/user.py from Shwy1001/BioPatch: direct link, hf CLI and curl.
- Browser
- Download file 1.17 kB
-
https://huggingface.co/spaces/Shwy1001/BioPatch/resolve/main/backend/models/user.py
- Command line
-
hf download hf://spaces/Shwy1001/BioPatch/backend/models/user.py
-
curl -L -o user.py https://huggingface.co/spaces/Shwy1001/BioPatch/resolve/main/backend/models/user.py
1.17 kB
| from __future__ import annotations | |
| from datetime import datetime | |
| from typing import TYPE_CHECKING | |
| from sqlalchemy import Boolean, DateTime, String, func | |
| from sqlalchemy.orm import Mapped, mapped_column, relationship | |
| from core.database import Base | |
| if TYPE_CHECKING: | |
| from .clinical_note import ClinicalNote | |
| class User(Base): | |
| __tablename__ = "users" | |
| id: Mapped[int] = mapped_column(primary_key=True) | |
| email: Mapped[str] = mapped_column(String(255), unique=True, index=True, nullable=False) | |
| full_name: Mapped[str] = mapped_column(String(255), nullable=False) | |
| role: Mapped[str] = mapped_column(String(32), nullable=False, default="nurse") # nurse | doctor | admin | |
| hashed_password: Mapped[str] = mapped_column(String(255), nullable=False) | |
| 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 | |
| ) | |
| notes: Mapped[list["ClinicalNote"]] = relationship(back_populates="author") | |
| def __repr__(self) -> str: | |
| return f"<User id={self.id} email={self.email!r} role={self.role!r}>" | |