refactor: modularize database management, models, and services for better structure and maintainability

This commit is contained in:
2025-08-01 22:19:22 +02:00
parent e22f3a627a
commit 0fd2c7a8b6
6 changed files with 810 additions and 777 deletions

50
backend/app/models.py Normal file
View File

@@ -0,0 +1,50 @@
from typing import TypedDict, List
from pydantic import BaseModel
class ArticleSummary(TypedDict):
"""Type definition for article summary data returned from the LLM."""
title: str
summary_de: str
summary_en: str
# Pydantic models for API requests and responses
class CronSettings(BaseModel):
"""Settings for the cron job that harvests news."""
hours: float
class FeedData(BaseModel):
"""Data for a news feed."""
country: str
url: str
class ModelStatus(BaseModel):
"""Status of the LLM model."""
name: str
status: str
available_models: List[str]
class ErrorResponse(BaseModel):
"""Standard error response."""
status: str
message: str
class SuccessResponse(BaseModel):
"""Standard success response."""
status: str
class TimestampResponse(BaseModel):
"""Response containing a timestamp."""
ts: int
class HoursResponse(BaseModel):
"""Response containing hours setting."""
hours: float