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,73 @@
import { createClient } from "https://esm.sh/@supabase/supabase-js@2";
const corsHeaders = {
"Access-Control-Allow-Origin": "*",
"Access-Control-Allow-Headers": "authorization, x-client-info, apikey, content-type",
};
Deno.serve(async (req) => {
if (req.method === "OPTIONS") {
return new Response(null, { headers: corsHeaders });
}
try {
if (!["GET", "POST"].includes(req.method)) {
return new Response(JSON.stringify({ error: "Method not allowed" }), {
status: 405,
headers: { ...corsHeaders, "Content-Type": "application/json" },
});
}
const proofId = req.method === "GET"
? new URL(req.url).searchParams.get("proofId")
: (await req.json()).proofId;
if (!proofId) {
return new Response(JSON.stringify({ error: "proofId is required" }), {
status: 400,
headers: { ...corsHeaders, "Content-Type": "application/json" },
});
}
const supabaseUrl = Deno.env.get("SUPABASE_URL")!;
const serviceKey = Deno.env.get("SUPABASE_SERVICE_ROLE_KEY")!;
const supabase = createClient(supabaseUrl, serviceKey);
const { data, error } = await supabase
.from("document_validation_proofs")
.select("id, document_title, document_type, generated_at, verification_hash, associations(name)")
.eq("id", proofId)
.maybeSingle();
if (error) {
throw error;
}
if (!data) {
return new Response(JSON.stringify({ error: "Proof not found" }), {
status: 404,
headers: { ...corsHeaders, "Content-Type": "application/json" },
});
}
return new Response(JSON.stringify(data), {
headers: {
...corsHeaders,
"Content-Type": "application/json",
"Cache-Control": "public, max-age=60",
},
});
} catch (error) {
console.error("[get-document-validation-proof]", error);
return new Response(
JSON.stringify({
error: error instanceof Error ? error.message : "Unexpected error",
}),
{
status: 500,
headers: { ...corsHeaders, "Content-Type": "application/json" },
},
);
}
});