Data Models and Schema Changes
字数
566 字
阅读时间
3 分钟
New Data Models
SuggestionFeedback
- Purpose: 记录用户对 AI 微建议的即时反馈,支撑模型调优与个性化排序。
- Integration: 与现有
suggestions、tasks集合关联,形成“建议 → 反馈 → 任务执行”闭环。 - Key Attributes:
suggestion_id: string – 对应的微建议标识user_id: string – 用户标识feedback_type: string – 反馈类型 (helpful/neutral/not_helpful)feedback_score: number – 1-5 满意度评分comment: string – 可选文字说明action_taken: string – 是否转化为任务、收藏或忽略createdAt: date,updatedAt: date
- Relationships: With Existing:
suggestions,tasks. With New:TaskExecutionLog.
TaskExecutionLog
- Purpose: 精细记录任务执行过程、打卡记录与复盘数据,满足 PRD 中对任务闭环的统计与周报需求。
- Integration: 与
tasks、checkins、reports集成,为周报和徽章系统提供详尽数据。 - Key Attributes:
task_id: string – 任务唯一标识user_id: string – 用户标识event_type: string – 执行事件 (start/complete/review)event_payload: object – 事件详情linked_checkin_id: string – 对应情绪回执effectiveness_score: number – 执行后自评效果 0-1createdAt: date,updatedAt: date
- Relationships: With Existing:
tasks,checkins,reports. With New:ModerationAuditTrail.
ModerationAuditTrail
- Purpose: 为树洞风控与 SOS 保障建立完整审核日志,满足 PRD 对“风险识别 → 审核 → 干预”链路的审计要求。
- Integration: 与
posts,comments,sos_events,notifications交互。 - Key Attributes:
target_type: string – 被审核对象类型target_id: string – 对象 IDrisk_snapshot: object – 风险指标action_taken: string – 采取的措施reviewer_id: string – 审核人follow_up_task_id: string – 后续干预任务createdAt: date,updatedAt: date
- Relationships: With Existing:
posts,comments,sos_events,notifications. With New:TaskExecutionLog.
Schema Integration Strategy
- New Tables:
suggestion_feedback,task_execution_logs,moderation_audit_trail. - Modified Tables:
suggestions: addfeedback_count,last_feedback_at.tasks: addlatest_execution_score.posts: addlast_reviewed_at,audit_status.checkins: addmood_intensity,energy_level.
- New Indexes: For new collections and updated fields to support queries.
- Migration Strategy: Use cloud function batch processing to add default fields. Create
mock_datasetscollection to centralize future mock data. - Backward Compatibility: Ensure old data defaults gracefully and APIs tolerate missing new fields.