mirror of
https://github.com/langbot-app/LangBot.git
synced 2026-08-09 04:40:57 +00:00
feat(platform): migrate bot admins from config.yaml to database
- Add BotAdmin ORM model (bot_admins table) scoped per bot_uuid - Add Alembic migration 0007 to create table and migrate legacy config admins - Remove top-level admins key from config.yaml template - Add GET/POST/DELETE /api/v1/platform/bots/<uuid>/admins endpoints - Update cmdmgr privilege check to query bot_admins table (bot-scoped) - Add BotAdminsPanel frontend component in bot detail sessions tab - Add i18n keys (zh-Hans, en-US)
This commit is contained in:
@@ -3,6 +3,22 @@ import sqlalchemy
|
||||
from .base import Base
|
||||
|
||||
|
||||
class BotAdmin(Base):
|
||||
"""Bot admin — a launcher that has admin privilege for a specific bot's commands"""
|
||||
|
||||
__tablename__ = 'bot_admins'
|
||||
|
||||
id = sqlalchemy.Column(sqlalchemy.Integer, primary_key=True, autoincrement=True)
|
||||
bot_uuid = sqlalchemy.Column(sqlalchemy.String(255), nullable=False)
|
||||
launcher_type = sqlalchemy.Column(sqlalchemy.String(64), nullable=False)
|
||||
launcher_id = sqlalchemy.Column(sqlalchemy.String(255), nullable=False)
|
||||
created_at = sqlalchemy.Column(sqlalchemy.DateTime, nullable=False, server_default=sqlalchemy.func.now())
|
||||
|
||||
__table_args__ = (
|
||||
sqlalchemy.UniqueConstraint('bot_uuid', 'launcher_type', 'launcher_id', name='uq_bot_admin'),
|
||||
)
|
||||
|
||||
|
||||
class Bot(Base):
|
||||
"""Bot"""
|
||||
|
||||
|
||||
Reference in New Issue
Block a user