Files
wecom_it_smart_desk/backend/app/models/todo_item.py
T
Simon bea288e414 feat: 2026-07-11 全量更新 - 代办集成+会议室预定+知识迭代修复+UI统一+Bug修复
== 已部署上线 (9项) ==
- 代办事项真实数据源集成 (企微审批API 8bug修复链)
- H5/坐席端 Logo样式统一+绿色背景
- 视频引导页修复 (localStorage key v2)
- 坐席端 v9 Vue版本修复 (ElMessage._context)
- 截图按钮 v10 修复 (getDisplayMedia user gesture)
- 扫码样式恢复+H5扫码登录跳转修复
- H5截图快捷键提示

== 代码完成待部署 (3项) ==
- 知识迭代3Bug修复 (#8 POST端点/#7 MERGE幂等/#6 过期检查)
- 会议室预定-小鱼易联终端 (40文件, 40/40测试通过)
- IT资产升级审批推送 (asset_service.py)

== 需求文档 (2项) ==
- 坐席端AI辅助消息框-PRD (4项新功能确认)
- 坐席端布局优化建议 v2.0 (7天计划)

== 新增文档 ==
- 日报-2026-07-11.md
- 知识迭代Bug修复报告-20260711.md
- 会议室预定-部署指南.md
- CHANGELOG.md 更新

== 测试 ==
- test_todo_integration.py: 40/40
- test_meetingroom.py: 40/40
- test_bugfix_ki_suggestions.py: 21/21
2026-07-11 23:13:10 +08:00

129 lines
3.6 KiB
Python
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# =============================================================================
# 企微IT智能服务台 — 待办事项模型
# =============================================================================
# 说明:对应数据库 todo_items 表,存储坐席的待办事项
# 待办类型:ticket(工单)/approval(审批)
# =============================================================================
import uuid
from datetime import datetime
from typing import Any, Dict, Optional
from sqlalchemy import Boolean, DateTime, Integer, JSON, String
from sqlalchemy.orm import Mapped, mapped_column
from app.database import Base
class TodoItem(Base):
"""待办事项模型 — 对应 todo_items 表。
存储坐席需要跟进的各类待办事项,包括工单、审批等。
Attributes:
id: 待办唯一标识(UUID,数据库自动生成)
type: 待办类型(ticket/approval
title: 待办标题
priority: 优先级(urgent/high/normal
description: 详细描述(JSON,存储结构化数据)
status: 状态(pending/processing/resolved
assigned_agent_id: 分配的坐席ID(可为空,表示未分配)
corp_id: 企业微信企业ID
created_at: 创建时间
updated_at: 更新时间
"""
# 表名
__tablename__ = "todo_items"
# --------------------------------------------------------------------------
# 字段定义
# --------------------------------------------------------------------------
# 主键:UUID
id: Mapped[str] = mapped_column(
String(36),
primary_key=True,
default=lambda: str(uuid.uuid4()),
comment="待办唯一标识",
)
# 待办类型
type: Mapped[str] = mapped_column(
String(20),
nullable=False,
default="ticket",
comment="待办类型: ticket/approval",
)
# 待办标题
title: Mapped[str] = mapped_column(
String(256),
nullable=False,
default="",
comment="待办标题",
)
# 优先级
priority: Mapped[str] = mapped_column(
String(20),
nullable=False,
default="normal",
comment="优先级: urgent/high/normal",
)
# 详细描述(JSON 格式,存储结构化数据)
description: Mapped[Dict[str, Any]] = mapped_column(
JSON,
nullable=False,
default=dict,
comment="详细描述",
)
# 状态
status: Mapped[str] = mapped_column(
String(20),
nullable=False,
default="pending",
comment="状态: pending/processing/resolved",
)
# 分配的坐席ID(可为空,表示未分配)
assigned_agent_id: Mapped[Optional[str]] = mapped_column(
String(64),
nullable=True,
comment="分配的坐席ID",
)
# 企业微信企业ID
corp_id: Mapped[str] = mapped_column(
String(64),
nullable=False,
default="",
comment="企业微信企业ID",
)
# 创建时间
created_at: Mapped[datetime] = mapped_column(
DateTime(timezone=True),
nullable=False,
default=datetime.now,
comment="创建时间",
)
# 更新时间
updated_at: Mapped[datetime] = mapped_column(
DateTime(timezone=True),
nullable=False,
default=datetime.now,
onupdate=datetime.now,
comment="更新时间",
)
def __repr__(self) -> str:
"""待办事项对象的字符串表示。"""
return (
f"<TodoItem(id={self.id}, type={self.type}, "
f"title={self.title}, status={self.status})>"
)