mirror of
https://github.com/insistence/RuoYi-Vue3-FastAPI.git
synced 2026-10-15 21:35:31 +00:00
feat: 支持 v2 插件、独立前端和签名制品发布 (#130)
* feat: 支持 v2 插件、原生扩展与签名发布 * fix: 修复测试 * feat: 增强宿主 SDK、运行观测与制品维护能力 * feat: 增强文件传输、配置观测与本地开发能力 * feat: 支持 SSE 实时事件流并完善开发脚手架 * feat: 完善长连接鉴权复核与关闭回收 * feat: 增强生命周期与任务关闭可靠性 * feat: 收紧健康检查契约并补齐前端与真实网络验收 * feat: 增加SDK溯源与离线更新工具并验证跨版本兼容 * feat: 增加持久化业务示例与受控 Python 交付 * feat: 增加统一运行诊断与多worker状态观测 * feat: 增加固定目标发布等待与自动验收 * fix: 修复多环境插件部署前缀与代理配置不一致 * fix: 修复测试
This commit is contained in:
@@ -0,0 +1,62 @@
|
||||
from typing import Annotated, Literal
|
||||
|
||||
from pydantic import BaseModel, ConfigDict, Field, StringConstraints, field_validator
|
||||
from sqlalchemy import CheckConstraint, Column, MetaData, String, Table
|
||||
|
||||
from common.types import DbUtcDateTime
|
||||
|
||||
MIN_PRINTABLE_CODEPOINT = 32
|
||||
metadata = MetaData()
|
||||
tasks = Table(
|
||||
'ruoyi_plugin_task_demo',
|
||||
metadata,
|
||||
Column('id', String(32), primary_key=True),
|
||||
Column('title', String(120), nullable=False),
|
||||
Column('description', String(500), nullable=False, server_default=''),
|
||||
Column('status', String(4), nullable=False, server_default='todo'),
|
||||
Column('created_at', DbUtcDateTime, nullable=False),
|
||||
Column('updated_at', DbUtcDateTime, nullable=False),
|
||||
Column('priority', String(6), nullable=False, server_default='normal'),
|
||||
CheckConstraint("status IN ('todo', 'done')", name='ck_task_demo_status'),
|
||||
CheckConstraint("priority IN ('normal', 'high')", name='ck_task_demo_priority'),
|
||||
)
|
||||
|
||||
|
||||
class TaskInput(BaseModel):
|
||||
"""任务创建和完整更新的输入字段。"""
|
||||
|
||||
model_config = ConfigDict(extra='forbid')
|
||||
|
||||
title: Annotated[str, StringConstraints(strip_whitespace=True, min_length=1, max_length=120)]
|
||||
description: str = Field(default='', max_length=500)
|
||||
status: Literal['todo', 'done'] = 'todo'
|
||||
priority: Literal['normal', 'high'] = 'normal'
|
||||
|
||||
@field_validator('title', 'description')
|
||||
@classmethod
|
||||
def reject_control_characters(cls, value: str) -> str:
|
||||
"""
|
||||
拒绝不可显示控制字符,使最大分页仍处于浏览器桥响应上限内。
|
||||
|
||||
:param value: 标题或描述文本
|
||||
:return: 已校验的文本
|
||||
"""
|
||||
if any(ord(character) < MIN_PRINTABLE_CODEPOINT and character not in '\n\r\t' for character in value):
|
||||
raise ValueError('文本不能包含不可显示的控制字符')
|
||||
return value
|
||||
|
||||
|
||||
class TaskQuery(BaseModel):
|
||||
"""限制单次响应体积,并提供稳定的分页和状态筛选。"""
|
||||
|
||||
model_config = ConfigDict(extra='forbid')
|
||||
|
||||
page: int = Field(default=1, ge=1, le=1_000_000)
|
||||
page_size: int = Field(default=10, ge=1, le=20, alias='pageSize')
|
||||
status: Literal['todo', 'done'] | None = None
|
||||
|
||||
|
||||
class TaskIdentifier(BaseModel):
|
||||
"""用于路径参数的插件任务标识。"""
|
||||
|
||||
id: str = Field(pattern=r'^[0-9a-f]{32}$')
|
||||
Reference in New Issue
Block a user