Files
evig/drizzle/0004_activity_feed.sql
g-butandClaude Sonnet 4.6 2ec21e49f4 feat: Phase 7 — Feedback Loop (delta metrics + activity feed)
- getDashboardStats: add 4 prev-month queries (parallel in same Promise.allSettled)
- MissionDelta type: devicesProcessed/devicesSold/itHilfeCompleted/workshopAttendees
- DashboardStats.delta: this month minus last month for each mission metric
- MissionMetrics: DeltaBadge component shows +N (green) / -N (red) / ±0 (grey)
- Migration: activity_feed table with actor_id, action, subject_type/id/label
- activityFeed Drizzle schema in misc.ts
- logActivity() helper — fire-and-forget, never throws
- TeamActivityFeed server component — last 10 events joined with users
- Monatsueberblick accepts children prop; 'lead' mode renders TeamActivityFeed

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-14 14:15:23 +02:00

16 lines
659 B
SQL

-- Team activity feed — lightweight event log for the dashboard
-- Written to from service functions after successful actions.
-- Read by TeamActivityFeed server component for 'lead' dashboard mode.
CREATE TABLE IF NOT EXISTS "activity_feed" (
"id" uuid PRIMARY KEY DEFAULT gen_random_uuid(),
"actor_id" uuid NOT NULL REFERENCES "users"("id") ON DELETE CASCADE,
"action" text NOT NULL,
"subject_type" text,
"subject_id" text,
"subject_label" text,
"created_at" timestamptz NOT NULL DEFAULT now()
);--> statement-breakpoint
CREATE INDEX IF NOT EXISTS "idx_activity_feed_created" ON "activity_feed"("created_at" DESC);--> statement-breakpoint