2026-05-06 21:44:45 +08:00
|
|
|
|
"""
|
|
|
|
|
|
插件模型 — 第三方节点扩展
|
|
|
|
|
|
"""
|
feat: multi-tenant workspace isolation, RBAC, sidebar nav, billing, and Android enhancements
- Backend: workspace_id isolation for 14 model tables + safe migration/backfill
- Backend: RBAC system with 4 roles and 23 permissions, seeded on startup
- Backend: workspace admin endpoints (list/manage all workspaces)
- Backend: admin user management API (CRUD, reset password)
- Backend: billing API with subscription plans, usage tracking, rate limiting
- Backend: fix system_logs.py UNION query and wrong column references
- Backend: WebSocket JWT auth and workspace enforcement
- Frontend: sidebar navigation replacing top dropdown menu
- Frontend: user management page (Users.vue) for admins
- Frontend: enhanced Workspaces.vue with admin table view
- Frontend: workspace RBAC computed properties in user store
- Android: agent marketplace, billing/subscription UI, onboarding wizard
- Android: phone login, analytics tracker, crash handler, network diagnostics
- Android: splash screen, encrypted token storage, app update enhancements
- Docs: multi-tenant RBAC guide with 8 sections and role-permission matrix
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-07-04 01:00:22 +08:00
|
|
|
|
from sqlalchemy import Column, String, Text, Boolean, DateTime, JSON, Integer, ForeignKey, func
|
2026-05-06 21:44:45 +08:00
|
|
|
|
from sqlalchemy.dialects.mysql import CHAR
|
|
|
|
|
|
from app.core.database import Base
|
|
|
|
|
|
import uuid
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class NodePlugin(Base):
|
|
|
|
|
|
"""第三方节点插件"""
|
|
|
|
|
|
__tablename__ = "node_plugins"
|
|
|
|
|
|
|
|
|
|
|
|
id = Column(CHAR(36), primary_key=True, default=lambda: str(uuid.uuid4()), comment="插件ID")
|
|
|
|
|
|
name = Column(String(128), nullable=False, unique=True, comment="插件名称(唯一)")
|
|
|
|
|
|
version = Column(String(32), nullable=False, default="1.0.0", comment="版本号")
|
|
|
|
|
|
description = Column(Text, comment="描述")
|
|
|
|
|
|
author = Column(String(128), comment="作者")
|
|
|
|
|
|
node_type = Column(String(64), nullable=False, comment="节点类型标识(如 custom_http、custom_data)")
|
|
|
|
|
|
node_label = Column(String(128), comment="节点显示名称")
|
|
|
|
|
|
category = Column(String(64), default="custom", comment="分类: custom/http/data/ai/tool")
|
|
|
|
|
|
|
|
|
|
|
|
# manifest.json 原始内容
|
|
|
|
|
|
manifest = Column(JSON, comment="manifest.json 完整内容")
|
|
|
|
|
|
|
|
|
|
|
|
# 输入/输出定义
|
|
|
|
|
|
inputs_schema = Column(JSON, comment="输入参数 schema")
|
|
|
|
|
|
outputs_schema = Column(JSON, comment="输出参数 schema")
|
|
|
|
|
|
|
|
|
|
|
|
# 代码
|
|
|
|
|
|
code = Column(Text, comment="插件执行代码(Python)")
|
|
|
|
|
|
|
|
|
|
|
|
# 状态
|
|
|
|
|
|
enabled = Column(Boolean, default=True, comment="是否启用")
|
|
|
|
|
|
is_public = Column(Boolean, default=False, comment="是否公开到插件市场")
|
|
|
|
|
|
install_count = Column(Integer, default=0, comment="安装次数")
|
|
|
|
|
|
rating_avg = Column(Integer, default=0, comment="平均评分")
|
|
|
|
|
|
|
|
|
|
|
|
# 元数据
|
|
|
|
|
|
icon = Column(String(256), comment="图标URL")
|
|
|
|
|
|
tags = Column(JSON, comment="标签列表")
|
|
|
|
|
|
user_id = Column(CHAR(36), nullable=True, comment="上传者ID")
|
feat: multi-tenant workspace isolation, RBAC, sidebar nav, billing, and Android enhancements
- Backend: workspace_id isolation for 14 model tables + safe migration/backfill
- Backend: RBAC system with 4 roles and 23 permissions, seeded on startup
- Backend: workspace admin endpoints (list/manage all workspaces)
- Backend: admin user management API (CRUD, reset password)
- Backend: billing API with subscription plans, usage tracking, rate limiting
- Backend: fix system_logs.py UNION query and wrong column references
- Backend: WebSocket JWT auth and workspace enforcement
- Frontend: sidebar navigation replacing top dropdown menu
- Frontend: user management page (Users.vue) for admins
- Frontend: enhanced Workspaces.vue with admin table view
- Frontend: workspace RBAC computed properties in user store
- Android: agent marketplace, billing/subscription UI, onboarding wizard
- Android: phone login, analytics tracker, crash handler, network diagnostics
- Android: splash screen, encrypted token storage, app update enhancements
- Docs: multi-tenant RBAC guide with 8 sections and role-permission matrix
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-07-04 01:00:22 +08:00
|
|
|
|
workspace_id = Column(CHAR(36), ForeignKey("workspaces.id"), nullable=True, index=True, comment="工作区ID")
|
2026-05-06 21:44:45 +08:00
|
|
|
|
|
|
|
|
|
|
created_at = Column(DateTime, default=func.now(), comment="创建时间")
|
|
|
|
|
|
updated_at = Column(DateTime, default=func.now(), onupdate=func.now(), comment="更新时间")
|
|
|
|
|
|
|
|
|
|
|
|
def __repr__(self):
|
|
|
|
|
|
return f"<NodePlugin(id={self.id}, name={self.name}, type={self.node_type})>"
|