
- Fix code linting issues - Update README with detailed documentation - Configure database paths for the current environment - Create necessary directory structure The News Aggregation Service is now ready to use with FastAPI and SQLite.
20 lines
901 B
Python
20 lines
901 B
Python
from sqlalchemy import Boolean, Column, Integer, String
|
|
from sqlalchemy.orm import relationship
|
|
|
|
from app.db.session import Base
|
|
from app.models.base import TimestampMixin, TableNameMixin
|
|
|
|
|
|
class User(Base, TimestampMixin, TableNameMixin):
|
|
"""User model for authentication and personalization."""
|
|
|
|
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)
|
|
|
|
# Relationships will be added here
|
|
preferences = relationship("UserPreference", back_populates="user", cascade="all, delete-orphan")
|
|
saved_articles = relationship("SavedArticle", back_populates="user", cascade="all, delete-orphan") |