mirror of
https://github.com/khoaliber/LetterFeed.git
synced 2026-03-08 05:39:14 +00:00
refactor: reformat
This commit is contained in:
@@ -2,7 +2,7 @@
|
|||||||
LETTERFEED_APP_BASE_URL=http://localhost:3000
|
LETTERFEED_APP_BASE_URL=http://localhost:3000
|
||||||
|
|
||||||
# The database URL. Change this if you change the volume mount point
|
# The database URL. Change this if you change the volume mount point
|
||||||
LETTERFEED_DATABASE_URL=sqlite:////data/letterfeed.db
|
LETTERFEED_DATABASE_URL=sqlite:////data/letterfeed.db
|
||||||
|
|
||||||
# IMAP server settings. Must have IMAP over SSL on port 993
|
# IMAP server settings. Must have IMAP over SSL on port 993
|
||||||
LETTERFEED_IMAP_SERVER=
|
LETTERFEED_IMAP_SERVER=
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ LetterFeed is a self-hosted application that converts email newsletters into RSS
|
|||||||
cp .env.example .env
|
cp .env.example .env
|
||||||
```
|
```
|
||||||
|
|
||||||
Edit the `.env` file with your specific settings.
|
Edit the `.env` file with your specific settings.
|
||||||
|
|
||||||
3. **Build and run the Docker containers:**
|
3. **Build and run the Docker containers:**
|
||||||
|
|
||||||
@@ -134,4 +134,3 @@ cd backend
|
|||||||
uv sync --group test
|
uv sync --group test
|
||||||
uvicorn app.main:app --reload
|
uvicorn app.main:app --reload
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
"""CRUD operations for database models."""
|
"""CRUD operations for database models."""
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
"""SQLAlchemy models for the database."""
|
"""SQLAlchemy models for the database."""
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ from app.core.database import Base
|
|||||||
|
|
||||||
class Newsletter(Base):
|
class Newsletter(Base):
|
||||||
"""Represents a newsletter, which can have multiple senders and entries."""
|
"""Represents a newsletter, which can have multiple senders and entries."""
|
||||||
|
|
||||||
__tablename__ = "newsletters"
|
__tablename__ = "newsletters"
|
||||||
|
|
||||||
id = Column(Integer, primary_key=True, index=True)
|
id = Column(Integer, primary_key=True, index=True)
|
||||||
@@ -22,6 +23,7 @@ class Newsletter(Base):
|
|||||||
|
|
||||||
class Sender(Base):
|
class Sender(Base):
|
||||||
"""Represents an email sender associated with a newsletter."""
|
"""Represents an email sender associated with a newsletter."""
|
||||||
|
|
||||||
__tablename__ = "senders"
|
__tablename__ = "senders"
|
||||||
|
|
||||||
id = Column(Integer, primary_key=True, index=True)
|
id = Column(Integer, primary_key=True, index=True)
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ from app.core.database import Base
|
|||||||
|
|
||||||
class Settings(Base):
|
class Settings(Base):
|
||||||
"""Represents application settings, including IMAP configuration."""
|
"""Represents application settings, including IMAP configuration."""
|
||||||
|
|
||||||
__tablename__ = "settings"
|
__tablename__ = "settings"
|
||||||
|
|
||||||
id = Column(Integer, primary_key=True, index=True)
|
id = Column(Integer, primary_key=True, index=True)
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
"""API routers for the application."""
|
"""API routers for the application."""
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
"""Pydantic schemas for data validation and serialization."""
|
"""Pydantic schemas for data validation and serialization."""
|
||||||
|
|||||||
@@ -5,16 +5,19 @@ from pydantic import BaseModel, ConfigDict
|
|||||||
|
|
||||||
class SenderBase(BaseModel):
|
class SenderBase(BaseModel):
|
||||||
"""Base schema for a sender."""
|
"""Base schema for a sender."""
|
||||||
|
|
||||||
email: str
|
email: str
|
||||||
|
|
||||||
|
|
||||||
class SenderCreate(SenderBase):
|
class SenderCreate(SenderBase):
|
||||||
"""Schema for creating a new sender."""
|
"""Schema for creating a new sender."""
|
||||||
|
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
class Sender(SenderBase):
|
class Sender(SenderBase):
|
||||||
"""Schema for retrieving a sender with its ID and newsletter ID."""
|
"""Schema for retrieving a sender with its ID and newsletter ID."""
|
||||||
|
|
||||||
id: int
|
id: int
|
||||||
newsletter_id: int
|
newsletter_id: int
|
||||||
|
|
||||||
@@ -23,21 +26,25 @@ class Sender(SenderBase):
|
|||||||
|
|
||||||
class NewsletterBase(BaseModel):
|
class NewsletterBase(BaseModel):
|
||||||
"""Base schema for a newsletter."""
|
"""Base schema for a newsletter."""
|
||||||
|
|
||||||
name: str
|
name: str
|
||||||
|
|
||||||
|
|
||||||
class NewsletterCreate(NewsletterBase):
|
class NewsletterCreate(NewsletterBase):
|
||||||
"""Schema for creating a new newsletter."""
|
"""Schema for creating a new newsletter."""
|
||||||
|
|
||||||
sender_emails: List[str]
|
sender_emails: List[str]
|
||||||
|
|
||||||
|
|
||||||
class NewsletterUpdate(NewsletterBase):
|
class NewsletterUpdate(NewsletterBase):
|
||||||
"""Schema for updating an existing newsletter."""
|
"""Schema for updating an existing newsletter."""
|
||||||
|
|
||||||
sender_emails: List[str]
|
sender_emails: List[str]
|
||||||
|
|
||||||
|
|
||||||
class Newsletter(NewsletterBase):
|
class Newsletter(NewsletterBase):
|
||||||
"""Schema for retrieving a newsletter with its ID, active status, senders, and entries count."""
|
"""Schema for retrieving a newsletter with its ID, active status, senders, and entries count."""
|
||||||
|
|
||||||
id: int
|
id: int
|
||||||
is_active: bool
|
is_active: bool
|
||||||
senders: List[Sender] = []
|
senders: List[Sender] = []
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ from pydantic import BaseModel, ConfigDict, Field
|
|||||||
|
|
||||||
class SettingsBase(BaseModel):
|
class SettingsBase(BaseModel):
|
||||||
"""Base schema for application settings."""
|
"""Base schema for application settings."""
|
||||||
|
|
||||||
imap_server: str
|
imap_server: str
|
||||||
imap_username: str
|
imap_username: str
|
||||||
search_folder: str = "INBOX"
|
search_folder: str = "INBOX"
|
||||||
@@ -16,11 +17,13 @@ class SettingsBase(BaseModel):
|
|||||||
|
|
||||||
class SettingsCreate(SettingsBase):
|
class SettingsCreate(SettingsBase):
|
||||||
"""Schema for creating or updating settings, including the IMAP password."""
|
"""Schema for creating or updating settings, including the IMAP password."""
|
||||||
|
|
||||||
imap_password: str
|
imap_password: str
|
||||||
|
|
||||||
|
|
||||||
class Settings(SettingsBase):
|
class Settings(SettingsBase):
|
||||||
"""Schema for retrieving settings, with password excluded by default."""
|
"""Schema for retrieving settings, with password excluded by default."""
|
||||||
|
|
||||||
id: int
|
id: int
|
||||||
imap_password: str | None = Field(None, exclude=True)
|
imap_password: str | None = Field(None, exclude=True)
|
||||||
locked_fields: List[str] = []
|
locked_fields: List[str] = []
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
"""Application services for business logic."""
|
"""Application services for business logic."""
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
"""Unit tests for the application."""
|
"""Unit tests for the application."""
|
||||||
|
|||||||
@@ -28,4 +28,4 @@ volumes:
|
|||||||
|
|
||||||
networks:
|
networks:
|
||||||
letterfeed_network:
|
letterfeed_network:
|
||||||
driver: bridge
|
driver: bridge
|
||||||
|
|||||||
@@ -18,4 +18,4 @@
|
|||||||
"hooks": "@/hooks"
|
"hooks": "@/hooks"
|
||||||
},
|
},
|
||||||
"iconLibrary": "lucide"
|
"iconLibrary": "lucide"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -151,4 +151,3 @@ export async function processEmails(): Promise<{ message: string }> {
|
|||||||
export function getFeedUrl(newsletterId: number): string {
|
export function getFeedUrl(newsletterId: number): string {
|
||||||
return `${API_BASE_URL}/feeds/${newsletterId}`;
|
return `${API_BASE_URL}/feeds/${newsletterId}`;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user