23 lines
796 B
Python
23 lines
796 B
Python
from sqlalchemy import Boolean, Column, String
|
|
from sqlalchemy.orm import relationship
|
|
|
|
from app.models.base import BaseModel
|
|
|
|
|
|
class User(BaseModel):
|
|
"""User model for authentication and profile information."""
|
|
|
|
__tablename__ = "users"
|
|
|
|
email = Column(String, unique=True, index=True, nullable=False)
|
|
username = Column(String, unique=True, index=True, nullable=False)
|
|
hashed_password = Column(String, nullable=False)
|
|
full_name = Column(String, nullable=True)
|
|
is_active = Column(Boolean, default=True, nullable=False)
|
|
is_superuser = Column(Boolean, default=False, nullable=False)
|
|
|
|
# Relationships
|
|
playlists = relationship("Playlist", back_populates="user", cascade="all, delete-orphan")
|
|
|
|
def __repr__(self):
|
|
return f"<User {self.username}>" |