mirror of
https://github.com/BEDOLAGA-DEV/remnawave-bedolaga-telegram-bot.git
synced 2026-02-21 20:01:47 +00:00
Merge pull request #707 from Fr1ngg/revert-704-bedolaga-8nay3u
Revert "Complete bot configuration dashboard actions"
This commit is contained in:
@@ -1,11 +1,9 @@
|
||||
from typing import Optional
|
||||
|
||||
from typing import Optional, Sequence
|
||||
|
||||
from sqlalchemy import desc, select
|
||||
from sqlalchemy import select
|
||||
from sqlalchemy.ext.asyncio import AsyncSession
|
||||
|
||||
from app.database.models import SystemSetting, SystemSettingChange
|
||||
from app.database.models import SystemSetting
|
||||
|
||||
|
||||
async def upsert_system_setting(
|
||||
@@ -40,41 +38,3 @@ async def delete_system_setting(db: AsyncSession, key: str) -> None:
|
||||
await db.delete(setting)
|
||||
await db.flush()
|
||||
|
||||
|
||||
async def log_system_setting_change(
|
||||
db: AsyncSession,
|
||||
*,
|
||||
key: str,
|
||||
old_value: Optional[str],
|
||||
new_value: Optional[str],
|
||||
changed_by: Optional[int] = None,
|
||||
changed_by_username: Optional[str] = None,
|
||||
source: str = "bot",
|
||||
reason: Optional[str] = None,
|
||||
) -> SystemSettingChange:
|
||||
change = SystemSettingChange(
|
||||
key=key,
|
||||
old_value=old_value,
|
||||
new_value=new_value,
|
||||
changed_by=changed_by,
|
||||
changed_by_username=changed_by_username,
|
||||
source=source,
|
||||
reason=reason,
|
||||
)
|
||||
db.add(change)
|
||||
await db.flush()
|
||||
return change
|
||||
|
||||
|
||||
async def get_recent_system_setting_changes(
|
||||
db: AsyncSession,
|
||||
limit: int = 10,
|
||||
) -> Sequence[SystemSettingChange]:
|
||||
stmt = (
|
||||
select(SystemSettingChange)
|
||||
.order_by(desc(SystemSettingChange.created_at))
|
||||
.limit(limit)
|
||||
)
|
||||
result = await db.execute(stmt)
|
||||
return result.scalars().all()
|
||||
|
||||
|
||||
@@ -757,30 +757,16 @@ class ServiceRule(Base):
|
||||
|
||||
class SystemSetting(Base):
|
||||
__tablename__ = "system_settings"
|
||||
|
||||
|
||||
id = Column(Integer, primary_key=True, index=True)
|
||||
key = Column(String(255), unique=True, nullable=False)
|
||||
value = Column(Text, nullable=True)
|
||||
description = Column(Text, nullable=True)
|
||||
|
||||
|
||||
created_at = Column(DateTime, default=func.now())
|
||||
updated_at = Column(DateTime, default=func.now(), onupdate=func.now())
|
||||
|
||||
|
||||
class SystemSettingChange(Base):
|
||||
__tablename__ = "system_settings_history"
|
||||
|
||||
id = Column(Integer, primary_key=True, index=True)
|
||||
key = Column(String(255), nullable=False, index=True)
|
||||
old_value = Column(Text, nullable=True)
|
||||
new_value = Column(Text, nullable=True)
|
||||
changed_by = Column(Integer, nullable=True)
|
||||
changed_by_username = Column(String(255), nullable=True)
|
||||
source = Column(String(50), nullable=False, default="bot")
|
||||
reason = Column(String(255), nullable=True)
|
||||
|
||||
created_at = Column(DateTime, default=func.now())
|
||||
|
||||
class MonitoringLog(Base):
|
||||
__tablename__ = "monitoring_logs"
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -132,11 +132,6 @@ class SupportSettingsStates(StatesGroup):
|
||||
|
||||
class BotConfigStates(StatesGroup):
|
||||
waiting_for_value = State()
|
||||
waiting_for_search_query = State()
|
||||
waiting_for_import_content = State()
|
||||
waiting_for_list_item = State()
|
||||
waiting_for_time_value = State()
|
||||
waiting_for_price_value = State()
|
||||
|
||||
class AutoPayStates(StatesGroup):
|
||||
setting_autopay_days = State()
|
||||
|
||||
Reference in New Issue
Block a user