refactor: modularize database management, models, and services for better structure and maintainability
This commit is contained in:
50
backend/app/models.py
Normal file
50
backend/app/models.py
Normal 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
|
Reference in New Issue
Block a user