39 lines
1.7 KiB
Python
39 lines
1.7 KiB
Python
"""User model."""
|
|
<<<<<<< HEAD
|
|
from sqlalchemy import Boolean, Column, Integer, String, DateTime, Date
|
|
=======
|
|
from sqlalchemy import Boolean, Column, Integer, String, DateTime
|
|
>>>>>>> 65c71b3d67d462fe9ecc01a1c2aa17e54b626fe2
|
|
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
|
|
<<<<<<< HEAD
|
|
avatar_url = Column(String(500)) # URL to uploaded avatar
|
|
birthday = Column(Date, nullable=True) # Birthday for chore logic
|
|
=======
|
|
>>>>>>> 65c71b3d67d462fe9ecc01a1c2aa17e54b626fe2
|
|
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")
|
|
<<<<<<< HEAD
|
|
chore_assignments = relationship("ChoreAssignment", back_populates="user", lazy="select")
|
|
chore_completion_logs = relationship("ChoreCompletionLog", foreign_keys="[ChoreCompletionLog.user_id]", back_populates="user", lazy="select")
|
|
=======
|
|
>>>>>>> 65c71b3d67d462fe9ecc01a1c2aa17e54b626fe2
|