From 1007f929c238fc9f025e0c4e75b0e7dd58c42905 Mon Sep 17 00:00:00 2001 From: Ochenstarik Date: Thu, 24 Sep 2026 18:25:56 +0700 Subject: [PATCH] fix(finance): cast derived revenue parameters --- src/operations.ts | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/operations.ts b/src/operations.ts index c4a316f..a851417 100644 --- a/src/operations.ts +++ b/src/operations.ts @@ -649,11 +649,13 @@ async function refreshRevenueMetric( `INSERT INTO staff_daily_metrics (id, tenant_id, org_unit_id, business_date, metric_key, value, currency_code, source, recorded_by) - SELECT $1, $2, $3, $4, 'revenue_minor', + SELECT $1::varchar(26), $2::varchar(26), $3::varchar(26), $4::date, 'revenue_minor', COALESCE(SUM(value) FILTER (WHERE metric_key LIKE 'income\\_%' ESCAPE '\\'), 0), - 'RUB', 'module', $5 + 'RUB', 'module', $5::varchar(26) FROM staff_daily_metrics - WHERE tenant_id = $2 AND org_unit_id = $3 AND business_date = $4 + WHERE tenant_id = $2::varchar(26) + AND org_unit_id = $3::varchar(26) + AND business_date = $4::date ON CONFLICT (tenant_id, org_unit_id, business_date, metric_key) DO UPDATE SET value = EXCLUDED.value, source = 'module', recorded_by = EXCLUDED.recorded_by, updated_at = now()`,