Default opened_at in upsert

X-Lovable-Edit-ID: edt-1c27884e-3833-4317-be65-fa310119b791
Co-authored-by: renee-png <262607627+renee-png@users.noreply.github.com>
This commit is contained in:
gpt-engineer-app[bot]
2026-04-19 18:07:15 +00:00
co-authored by renee-png
+5
View File
@@ -284,6 +284,11 @@ const IMPORTERS: ImporterConfig[] = [
// in batched upserts where Postgrest sends the column union.
r.status = "intake";
}
// Default opened_at to today when missing — avoids NULL violations
// in batched upserts where Postgrest sends the column union.
if (!r.opened_at) {
r.opened_at = new Date().toISOString().slice(0, 10);
}
// Normalise billing method
if (r.billing_method) {
const bm = String(r.billing_method).toLowerCase();