thread-master/docs/product/demand-radar/tasks/T585-followup-model-reposit...

1.5 KiB
Raw Blame History

T585 — followup-model-repository-and-hooks

Status: done
Milestone: M5
Kind: feat
Est. change: ~170 lines

Goal

完成後系統應FollowUp domainrepository 就位,且在送出回覆或階段進入 engageddm_sent 時自動建立(due_at = 最後接觸 + N 天)。

Depends on

  • T550、T566

Inputs

  • Spec../spec.md §3.5、§4.7.1、§8crm_followups

Outputs

程式變更(預期路徑)

路徑 動作 說明
apps/backend/internal/module/crm/domain/followup.go add 狀態 `scheduled
apps/backend/internal/module/crm/repository/followup_mongo.go add Upsert、ListDue(now)、ListByOwner、UpdateStatus
apps/backend/internal/module/crm/repository/followup_memory.go add 測試用
apps/backend/internal/module/crm/usecase/followup.go add 建立/重算 due_athook 於 stage 轉移與回覆送出

行為變更

  • 每個 Contact 同時最多一筆活躍 FollowUpschedulednotifiedsnoozed)。
  • 天數取 Contact follow_up_days(預設 3
  • 階段推進到 replied 或更後 → FollowUp 轉 done

Out of scope

  • 掃描 Job 與通知T586
  • APIT587

Acceptance

  • unit test送出回覆 → 建立 scheduleddue_at 為最後接觸 +3 天
  • 階段轉 replied → 自動 done
  • 指令:
cd apps/backend && go test ./internal/module/crm/... -count=1