25 lines
1.0 KiB
Python
25 lines
1.0 KiB
Python
"""User model."""
|
|
from sqlalchemy import Boolean, Column, Integer, String, DateTime
|
|
from sqlalchemy.orm import relationship
|
|
from datetime import datetime
|
|
from app.core.database import Base
|
|
|
|
class User(Base):
|
|
"""User model."""
|
|
__tablename__ = "users"
|
|
|
|
id = Column(Integer, primary_key=True, index=True)
|
|
username = Column(String(50), unique=True, index=True, nullable=False)
|
|
email = Column(String(100), unique=True, index=True, nullable=False)
|
|
full_name = Column(String(100))
|
|
hashed_password = Column(String(200), nullable=False)
|
|
discord_id = Column(String(100)) # For Discord integration
|
|
profile_picture = Column(String(500)) # URL to profile picture
|
|
is_active = Column(Boolean, default=True)
|
|
is_admin = Column(Boolean, default=False)
|
|
created_at = Column(DateTime, default=datetime.utcnow)
|
|
updated_at = Column(DateTime, default=datetime.utcnow, onupdate=datetime.utcnow)
|
|
|
|
# Relationships (lazy loaded to avoid circular imports)
|
|
chores = relationship("Chore", back_populates="assigned_user", lazy="select")
|