Add ACMCC app source, Supabase backend, and project config

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
2026-06-01 20:19:26 -04:00
parent 313b51b412
commit 183fe0a93c
1422 changed files with 259271 additions and 0 deletions
@@ -0,0 +1,33 @@
CREATE OR REPLACE FUNCTION public.auto_owner_update_from_violation()
RETURNS trigger
LANGUAGE plpgsql
SECURITY DEFINER
SET search_path TO 'public'
AS $function$
DECLARE
v_title TEXT;
v_content TEXT;
BEGIN
IF TG_OP = 'INSERT' THEN
v_title := 'Violation Issued: ' || COALESCE(NEW.title, NEW.violation_type, 'Untitled');
v_content := 'A new violation has been recorded. Category: ' || COALESCE(NEW.category, 'N/A') || '. Status: ' || COALESCE(NEW.status, 'open') || '.';
ELSIF TG_OP = 'UPDATE' AND OLD.status IS DISTINCT FROM NEW.status THEN
v_title := 'Violation Status Changed: ' || COALESCE(NEW.title, NEW.violation_type, 'Untitled');
v_content := 'Status changed from "' || COALESCE(OLD.status, 'unknown') || '" to "' || COALESCE(NEW.status, 'unknown') || '".';
ELSE
RETURN NEW;
END IF;
INSERT INTO public.owner_updates (association_id, unit_id, title, content, tags, violation_ids)
VALUES (
NEW.association_id,
NEW.unit_id,
v_title,
v_content,
'[{"name":"Violations","color":"#f59e0b"}]'::jsonb,
jsonb_build_array(NEW.id::text)
);
RETURN NEW;
END;
$function$;