refactor: reformat

This commit is contained in:
Leon
2025-07-16 19:44:45 +02:00
parent 945c764b20
commit c1629aad8d
15 changed files with 23 additions and 12 deletions

View File

@@ -1 +1 @@
"""CRUD operations for database models."""
"""CRUD operations for database models."""

View File

@@ -1 +1 @@
"""SQLAlchemy models for the database."""
"""SQLAlchemy models for the database."""

View File

@@ -6,6 +6,7 @@ from app.core.database import Base
class Newsletter(Base):
"""Represents a newsletter, which can have multiple senders and entries."""
__tablename__ = "newsletters"
id = Column(Integer, primary_key=True, index=True)
@@ -22,6 +23,7 @@ class Newsletter(Base):
class Sender(Base):
"""Represents an email sender associated with a newsletter."""
__tablename__ = "senders"
id = Column(Integer, primary_key=True, index=True)

View File

@@ -5,6 +5,7 @@ from app.core.database import Base
class Settings(Base):
"""Represents application settings, including IMAP configuration."""
__tablename__ = "settings"
id = Column(Integer, primary_key=True, index=True)

View File

@@ -1 +1 @@
"""API routers for the application."""
"""API routers for the application."""

View File

@@ -1 +1 @@
"""Pydantic schemas for data validation and serialization."""
"""Pydantic schemas for data validation and serialization."""

View File

@@ -5,16 +5,19 @@ from pydantic import BaseModel, ConfigDict
class SenderBase(BaseModel):
"""Base schema for a sender."""
email: str
class SenderCreate(SenderBase):
"""Schema for creating a new sender."""
pass
class Sender(SenderBase):
"""Schema for retrieving a sender with its ID and newsletter ID."""
id: int
newsletter_id: int
@@ -23,21 +26,25 @@ class Sender(SenderBase):
class NewsletterBase(BaseModel):
"""Base schema for a newsletter."""
name: str
class NewsletterCreate(NewsletterBase):
"""Schema for creating a new newsletter."""
sender_emails: List[str]
class NewsletterUpdate(NewsletterBase):
"""Schema for updating an existing newsletter."""
sender_emails: List[str]
class Newsletter(NewsletterBase):
"""Schema for retrieving a newsletter with its ID, active status, senders, and entries count."""
id: int
is_active: bool
senders: List[Sender] = []

View File

@@ -5,6 +5,7 @@ from pydantic import BaseModel, ConfigDict, Field
class SettingsBase(BaseModel):
"""Base schema for application settings."""
imap_server: str
imap_username: str
search_folder: str = "INBOX"
@@ -16,11 +17,13 @@ class SettingsBase(BaseModel):
class SettingsCreate(SettingsBase):
"""Schema for creating or updating settings, including the IMAP password."""
imap_password: str
class Settings(SettingsBase):
"""Schema for retrieving settings, with password excluded by default."""
id: int
imap_password: str | None = Field(None, exclude=True)
locked_fields: List[str] = []

View File

@@ -1 +1 @@
"""Application services for business logic."""
"""Application services for business logic."""

View File

@@ -1 +1 @@
"""Unit tests for the application."""
"""Unit tests for the application."""