update
This commit is contained in:
BIN
backend/models/__pycache__/telegram_bot.cpython-312.pyc
Normal file
BIN
backend/models/__pycache__/telegram_bot.cpython-312.pyc
Normal file
Binary file not shown.
Binary file not shown.
24
backend/models/telegram_bot.py
Normal file
24
backend/models/telegram_bot.py
Normal file
@@ -0,0 +1,24 @@
|
||||
from backend.models.user import db
|
||||
|
||||
class TelegramBot(db.Model):
|
||||
__tablename__ = 'telegram_bots'
|
||||
|
||||
id = db.Column(db.Integer, primary_key=True)
|
||||
name = db.Column(db.String(100), nullable=False) # 봇 식별 이름 (예: 알림용, 경고용)
|
||||
token = db.Column(db.String(200), nullable=False)
|
||||
chat_id = db.Column(db.String(100), nullable=False)
|
||||
is_active = db.Column(db.Boolean, default=True)
|
||||
description = db.Column(db.String(255), nullable=True)
|
||||
# 알림 유형: 콤마로 구분 (예: "auth,activity,system")
|
||||
notification_types = db.Column(db.String(255), default="auth,activity,system")
|
||||
|
||||
def to_dict(self):
|
||||
return {
|
||||
'id': self.id,
|
||||
'name': self.name,
|
||||
'token': self.token,
|
||||
'chat_id': self.chat_id,
|
||||
'is_active': self.is_active,
|
||||
'description': self.description,
|
||||
'notification_types': self.notification_types
|
||||
}
|
||||
@@ -38,6 +38,10 @@ class User(db.Model, UserMixin):
|
||||
password: Mapped[str] = mapped_column(String(255), nullable=False)
|
||||
is_admin: Mapped[bool] = mapped_column(Boolean, default=False, nullable=False)
|
||||
is_active: Mapped[bool] = mapped_column(Boolean, default=False, nullable=False)
|
||||
|
||||
# 가입 승인 관련 필드
|
||||
is_approved: Mapped[bool] = mapped_column(Boolean, default=False, nullable=False)
|
||||
approval_token: Mapped[Optional[str]] = mapped_column(String(100), unique=True, nullable=True)
|
||||
|
||||
# ── 유틸 메서드
|
||||
def __repr__(self) -> str: # pragma: no cover
|
||||
|
||||
Reference in New Issue
Block a user