Spaces:
Sleeping
Sleeping
Download app/models.py from Hamza4100/AI-Datrix-Backend: direct link, hf CLI and curl.
- Browser
- Download file 809 Bytes
-
https://huggingface.co/spaces/Hamza4100/AI-Datrix-Backend/resolve/main/app/models.py
- Command line
-
hf download hf://spaces/Hamza4100/AI-Datrix-Backend/app/models.py
-
curl -L -o models.py https://huggingface.co/spaces/Hamza4100/AI-Datrix-Backend/resolve/main/app/models.py
809 Bytes
| from sqlalchemy import Column, Integer, String, DateTime, Enum | |
| from sqlalchemy.ext.declarative import declarative_base | |
| from datetime import datetime | |
| import enum | |
| Base = declarative_base() | |
| class UserRole(str, enum.Enum): | |
| DOCTOR = "doctor" | |
| LAB_TECH = "lab_tech" | |
| ADMIN = "admin" | |
| class User(Base): | |
| __tablename__ = "users" | |
| id = Column(Integer, primary_key=True, index=True) | |
| username = Column(String, unique=True, index=True) | |
| email = Column(String, unique=True, index=True) | |
| password_hash = Column(String) | |
| role = Column(Enum(UserRole), default=UserRole.DOCTOR) | |
| created_at = Column(DateTime, default=datetime.utcnow) | |
| is_active = Column(Integer, default=1) # 1 for active, 0 for disabled | |
| def __repr__(self): | |
| return f"<User {self.username} ({self.role})>" | |