24 lines
727 B
Python
24 lines
727 B
Python
"""
|
|
User model for the database
|
|
"""
|
|
from sqlalchemy import Boolean, Column, Integer, String
|
|
from sqlalchemy.orm import relationship
|
|
|
|
from app.db.database import Base
|
|
|
|
|
|
class User(Base):
|
|
"""
|
|
User model representing users in the system
|
|
"""
|
|
__tablename__ = "users"
|
|
|
|
id = Column(Integer, primary_key=True, index=True)
|
|
email = Column(String, unique=True, index=True, nullable=False)
|
|
username = Column(String, unique=True, index=True, nullable=False)
|
|
hashed_password = Column(String, nullable=False)
|
|
is_active = Column(Boolean, default=True)
|
|
is_superuser = Column(Boolean, default=False)
|
|
|
|
# Relationship with tasks (one-to-many)
|
|
tasks = relationship("Task", back_populates="owner") |