18 lines
617 B
Python
18 lines
617 B
Python
"""User SQLAlchemy model."""
|
|
from sqlalchemy import Column, Integer, String
|
|
from sqlalchemy.orm import relationship
|
|
from backend.database import Base
|
|
|
|
|
|
class User(Base):
|
|
"""User model for authentication and ownership."""
|
|
__tablename__ = "users"
|
|
|
|
id = Column(Integer, primary_key=True, index=True)
|
|
username = Column(String, unique=True, index=True)
|
|
hashed_password = Column(String)
|
|
|
|
challenges = relationship("Challenge", back_populates="owner")
|
|
health_metrics = relationship("DailyHealthMetrics", back_populates="user")
|
|
workouts = relationship("WorkoutSession", back_populates="user")
|