Spaces:
Sleeping
Sleeping
Download quantlib_pro/data/models/user.py from gdukens/QuantLib_Pro: direct link, hf CLI and curl.
- Browser
- Download file 1 kB
-
https://huggingface.co/spaces/gdukens/QuantLib_Pro/resolve/main/quantlib_pro/data/models/user.py
- Command line
-
hf download hf://spaces/gdukens/QuantLib_Pro/quantlib_pro/data/models/user.py
-
curl -L -o user.py https://huggingface.co/spaces/gdukens/QuantLib_Pro/resolve/main/quantlib_pro/data/models/user.py
1 kB
| """User model.""" | |
| from sqlalchemy import Column, String, DateTime | |
| from sqlalchemy.dialects.postgresql import UUID | |
| from sqlalchemy.sql import func | |
| import uuid | |
| from quantlib_pro.data.models.base import Base | |
| class User(Base): | |
| """User account model.""" | |
| __tablename__ = "users" | |
| id = Column(UUID(as_uuid=True), primary_key=True, default=uuid.uuid4) | |
| username = Column(String(50), unique=True, nullable=False, index=True) | |
| email = Column(String(255), unique=True, nullable=False, index=True) | |
| password_hash = Column(String(255), nullable=False) | |
| api_key = Column(String(255), unique=True, nullable=True, index=True) | |
| tier = Column(String(20), default="free", nullable=False) # free, pro, enterprise | |
| created_at = Column(DateTime(timezone=True), server_default=func.now(), nullable=False) | |
| last_login = Column(DateTime(timezone=True), nullable=True) | |
| def __repr__(self): | |
| return f"<User(id={self.id}, username={self.username}, tier={self.tier})>" | |