This repository has been archived on 2025-09-07. You can view files and clone it, but you cannot make any changes to it's state, such as pushing and creating new issues, pull requests or comments.
MouseyBot/Mousey/Database/Models/news.py
2025-08-22 11:37:26 +07:00

28 lines
1 KiB
Python
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

from sqlalchemy import String, Text
from sqlalchemy.orm import Mapped, mapped_column
from Mousey.Misc import NewsStatus
from .base import Base
class News(Base):
"""
Схема для хранения информации о предложенных новостях в БД.
"""
__tablename__ = "news"
# Уникальный ID новости
news_id: Mapped[int] = mapped_column(primary_key=True, unique=True, autoincrement=True)
# Информация о пользователе, который предложил новость
tg_id: Mapped[int] = mapped_column(nullable=False)
tg_username: Mapped[str] = mapped_column(String(32), nullable=True)
# Текст новости и контакты для связи
text: Mapped[str] = mapped_column(Text, nullable=False)
contact: Mapped[str] = mapped_column(Text, nullable=True)
# Статус новости
status: Mapped[str] = mapped_column(String(3), default=NewsStatus.UNSEEN.value, nullable=False)