Tasks goals: auto metrics (tasks.goals.metric_key/metric_detail/metric_computed_at, tasks.metric_sources cache). €10k/month goal gets a live progress bar: Revolut recurring income (excl. Zorgtoeslag/Joint) computed on page load + trailing-12m paid Moneybird invoices / 12 cached by a daily goal-metrics user timer; stacked bar with %, amount vs target, salary/side-income breakdown, last-updated
Some checks failed
Deploy production / deploy (push) Failing after 1m14s

This commit is contained in:
2026-10-26 01:17:29 +00:00
parent 5c6ce75409
commit 5d732fc750
10 changed files with 40489 additions and 4 deletions

View File

@@ -0,0 +1,23 @@
CREATE TABLE "tasks"."metric_sources" (
"key" text PRIMARY KEY,
"value" numeric(14,2),
"detail" jsonb,
"computed_at" timestamp with time zone DEFAULT now() NOT NULL,
"attempted_at" timestamp with time zone DEFAULT now() NOT NULL,
"error" text
);
--> statement-breakpoint
ALTER TABLE "tasks"."goals" ADD COLUMN "metric_key" text;--> statement-breakpoint
ALTER TABLE "tasks"."goals" ADD COLUMN "metric_detail" jsonb;--> statement-breakpoint
ALTER TABLE "tasks"."goals" ADD COLUMN "metric_computed_at" timestamp with time zone;--> statement-breakpoint
-- Grants (default privileges already cover new tasks tables; explicit for safety). Prod only.
DO $$
BEGIN
IF current_user = 'personal' AND EXISTS (SELECT 1 FROM pg_roles WHERE rolname = 'personal_app') THEN
GRANT SELECT, INSERT, UPDATE, DELETE ON tasks.metric_sources TO personal_app;
END IF;
END $$;
--> statement-breakpoint
-- Stan's income goal gets the auto metric (salary from money.recurring + Moneybird side income).
UPDATE tasks.goals SET metric_key = 'own-net-income-monthly'
WHERE metric_key IS NULL AND title ILIKE '€10k net/month into own Revolut%';

File diff suppressed because it is too large Load Diff