mirror of
https://github.com/elisiariocouto/leggen.git
synced 2025-12-13 23:12:16 +00:00
- Remove amount_threshold and keywords fields from NotificationFilters model - Remove handling of these fields from API routes (GET/PUT) - Update test to remove amount_threshold reference - Simplify notification filtering to focus on case-sensitive/insensitive keywords only These fields were not being used in the actual filtering logic and were just adding unnecessary complexity to the configuration.
52 lines
1.1 KiB
Python
52 lines
1.1 KiB
Python
from typing import Optional, List
|
|
|
|
from pydantic import BaseModel
|
|
|
|
|
|
class DiscordConfig(BaseModel):
|
|
"""Discord notification configuration"""
|
|
|
|
webhook: str
|
|
enabled: bool = True
|
|
|
|
|
|
class TelegramConfig(BaseModel):
|
|
"""Telegram notification configuration"""
|
|
|
|
token: str
|
|
chat_id: int
|
|
enabled: bool = True
|
|
|
|
|
|
class NotificationFilters(BaseModel):
|
|
"""Notification filters configuration"""
|
|
|
|
case_insensitive: List[str] = []
|
|
case_sensitive: Optional[List[str]] = None
|
|
|
|
|
|
class NotificationSettings(BaseModel):
|
|
"""Complete notification settings"""
|
|
|
|
discord: Optional[DiscordConfig] = None
|
|
telegram: Optional[TelegramConfig] = None
|
|
filters: NotificationFilters = NotificationFilters()
|
|
|
|
|
|
class NotificationTest(BaseModel):
|
|
"""Test notification request"""
|
|
|
|
service: str # "discord" or "telegram"
|
|
message: str = "Test notification from Leggen"
|
|
|
|
|
|
class NotificationHistory(BaseModel):
|
|
"""Notification history entry"""
|
|
|
|
id: str
|
|
service: str
|
|
message: str
|
|
status: str # "sent", "failed"
|
|
sent_at: str
|
|
error: Optional[str] = None
|