addes folder backup attachments logging
This commit is contained in:
@@ -13,12 +13,25 @@ class ConditionField(str, enum.Enum):
|
||||
SUBJECT = "subject"
|
||||
BODY = "body"
|
||||
HAS_ATTACHMENT = "has_attachment"
|
||||
DATE = "date"
|
||||
|
||||
|
||||
class MatchType(str, enum.Enum):
|
||||
CONTAINS = "contains"
|
||||
REGEX = "regex"
|
||||
EXACT = "exact"
|
||||
# Date-specific match types
|
||||
ON_DATE = "on_date"
|
||||
BEFORE = "before"
|
||||
AFTER = "after"
|
||||
DATE_RANGE = "date_range"
|
||||
YEAR = "year"
|
||||
LAST_N_DAYS = "last_n_days"
|
||||
LAST_N_WEEKS = "last_n_weeks"
|
||||
LAST_N_MONTHS = "last_n_months"
|
||||
OLDER_THAN_DAYS = "older_than_days"
|
||||
OLDER_THAN_WEEKS = "older_than_weeks"
|
||||
OLDER_THAN_MONTHS = "older_than_months"
|
||||
|
||||
|
||||
class ActionType(str, enum.Enum):
|
||||
@@ -101,3 +114,42 @@ class FilterAction(Base):
|
||||
parameter: Mapped[str | None] = mapped_column(String(500), nullable=True)
|
||||
|
||||
rule: Mapped["FilterRule"] = relationship(back_populates="actions")
|
||||
|
||||
|
||||
class LogLevel(str, enum.Enum):
|
||||
INFO = "info"
|
||||
WARNING = "warning"
|
||||
ERROR = "error"
|
||||
SUCCESS = "success"
|
||||
|
||||
|
||||
class FilterLog(Base):
|
||||
__tablename__ = "filter_logs"
|
||||
|
||||
id: Mapped[int] = mapped_column(Integer, primary_key=True, autoincrement=True)
|
||||
account_id: Mapped[int | None] = mapped_column(Integer, nullable=True)
|
||||
account_name: Mapped[str] = mapped_column(String(100), default="")
|
||||
level: Mapped[LogLevel] = mapped_column(Enum(LogLevel), default=LogLevel.INFO)
|
||||
message: Mapped[str] = mapped_column(String(1000))
|
||||
rule_name: Mapped[str | None] = mapped_column(String(200), nullable=True)
|
||||
action_type: Mapped[str | None] = mapped_column(String(50), nullable=True)
|
||||
mail_uid: Mapped[str | None] = mapped_column(String(100), nullable=True)
|
||||
mail_subject: Mapped[str | None] = mapped_column(String(500), nullable=True)
|
||||
mail_from: Mapped[str | None] = mapped_column(String(255), nullable=True)
|
||||
folder: Mapped[str | None] = mapped_column(String(255), nullable=True)
|
||||
details: Mapped[str | None] = mapped_column(String(2000), nullable=True)
|
||||
created_at: Mapped[datetime] = mapped_column(DateTime, server_default=func.now())
|
||||
|
||||
|
||||
class ProcessedMail(Base):
|
||||
__tablename__ = "processed_mails"
|
||||
|
||||
id: Mapped[int] = mapped_column(Integer, primary_key=True, autoincrement=True)
|
||||
account_id: Mapped[int] = mapped_column(ForeignKey("accounts.id", ondelete="CASCADE"), index=True)
|
||||
folder: Mapped[str] = mapped_column(String(255))
|
||||
mail_uid: Mapped[str] = mapped_column(String(100))
|
||||
mail_subject: Mapped[str | None] = mapped_column(String(500), nullable=True)
|
||||
mail_from: Mapped[str | None] = mapped_column(String(255), nullable=True)
|
||||
processed_at: Mapped[datetime] = mapped_column(DateTime, server_default=func.now())
|
||||
|
||||
account: Mapped["Account"] = relationship()
|
||||
|
||||
Reference in New Issue
Block a user