fix: stop enqueueing disabled external table exports

This commit is contained in:
姚章浩
2026-08-13 14:49:44 +08:00
parent 0f30f8cec8
commit e5be9ee780
5 changed files with 42 additions and 10 deletions
+10 -3
View File
@@ -49,10 +49,10 @@ func (s *Store) SaveCoverageDecision(ctx context.Context, d coverage.Decision) e
return fmt.Errorf("coverage case id: %w", err)
}
_, err = tx.Exec(ctx, `INSERT INTO support_cases
(id, tenant_key, channel, turn_id, coverage_decision_id, status)
VALUES($1,$2,$3,$4,$5,$6)
(id, tenant_key, channel, turn_id, coverage_decision_id, status, faq_export_status)
VALUES($1,$2,$3,$4,$5,$6,$7)
ON CONFLICT (tenant_key, channel, turn_id) DO NOTHING`,
caseID, d.TenantKey, d.Channel, d.TurnID, persistedDecisionID, "pending")
caseID, d.TenantKey, d.Channel, d.TurnID, persistedDecisionID, "pending", faqExportStatus(s.faqExportEnabled))
if err != nil {
return fmt.Errorf("coverage insert support case: %w", err)
}
@@ -64,6 +64,13 @@ func (s *Store) SaveCoverageDecision(ctx context.Context, d coverage.Decision) e
return nil
}
func faqExportStatus(enabled bool) string {
if enabled {
return "pending"
}
return "not_applicable"
}
// newUUID produces a 32-char hex id.
func newUUID() (string, error) {
var b [16]byte