问题: 点击通知卡片跳转 detail?taskId=xxx,但 detail.vue onLoad 只认 serial 参数导致空白页 修复: 1. 后端 NotificationResponse 新增 product_serial_number 字段 2. 后端 notifications API 联表 tasks+products 批量填充 serial 3. 前端 notify/index.vue handleCardTap 优先用 product_serial_number 跳转,兜底从 content 正则解析 4. 前端 detail.vue onLoad 新增 taskId 兜底 → doQueryByTask 反查 product_sn
28 lines
623 B
Python
28 lines
623 B
Python
"""通知 Pydantic Schema"""
|
|
from __future__ import annotations
|
|
import uuid
|
|
from datetime import datetime
|
|
from pydantic import BaseModel, Field
|
|
|
|
|
|
class NotificationResponse(BaseModel):
|
|
"""通知列表响应"""
|
|
id: uuid.UUID
|
|
user_id: str
|
|
title: str
|
|
content: str
|
|
type: str
|
|
task_id: uuid.UUID | None = None
|
|
product_serial_number: str | None = None
|
|
is_read: bool
|
|
created_at: datetime
|
|
|
|
model_config = {"from_attributes": True}
|
|
|
|
|
|
class NotificationListResponse(BaseModel):
|
|
"""通知分页列表"""
|
|
notifications: list[NotificationResponse]
|
|
total: int
|
|
unread_count: int
|