Добавление работы с конфликтными частями и исправление вайтлиста

This commit is contained in:
2026-02-25 17:50:11 +07:00
parent 6a4e56c367
commit 54125b82ac
15 changed files with 463 additions and 329 deletions

View File

@@ -31,11 +31,12 @@ class Base(DeclarativeBase):
class BanWordType(str, PyEnum):
"""Типы банвордов"""
SUBSTRING = "substring"
WORD = "word"
LEMMA = "lemma"
PART = "part"
CONFLICT_SUBSTRING = "conflict_substring"
CONFLICT_WORD = "conflict_word"
CONFLICT_LEMMA = "conflict_lemma"
CONFLICT_PART = "conflict_part"
class SpamMode(str, PyEnum):
@@ -62,7 +63,11 @@ class BanWord(Base):
id: Mapped[int] = mapped_column(Integer, primary_key=True, autoincrement=True)
word: Mapped[str] = mapped_column(String(255), nullable=False, index=True)
type: Mapped[BanWordType] = mapped_column(
Enum(BanWordType, native_enum=False),
Enum(
BanWordType,
native_enum=False,
values_callable=lambda enum: [e.value for e in enum]
),
nullable=False,
index=True
)
@@ -95,8 +100,13 @@ class TempBanWord(Base):
id: Mapped[int] = mapped_column(Integer, primary_key=True, autoincrement=True)
word: Mapped[str] = mapped_column(String(255), nullable=False, index=True)
type: Mapped[BanWordType] = mapped_column(
Enum(BanWordType, native_enum=False),
nullable=False
Enum(
BanWordType,
native_enum=False,
values_callable=lambda enum: [e.value for e in enum]
),
nullable=False,
index=True
)
added_by: Mapped[Optional[int]] = mapped_column(Integer, nullable=True)
added_at: Mapped[datetime] = mapped_column(