Add trigger-calendar-cleanup edge function for Coolify scheduled tasks

Created a lightweight wrapper edge function that calls cancel-expired-consulting-orders.
This solves the Coolify scheduled_tasks command column 255 character limit.

Coolify command (184 chars):
deno run --allow-net --allow-env -e "fetch('http://supabase-edge-functions:8000/functions/v1/trigger-calendar-cleanup',{method:'POST'}).then(r=>r.json()).then(j=>console.log(JSON.stringify(j)))"

This replaces the need for long curl commands or external scripts.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
dwindown
2026-01-11 22:59:02 +07:00
parent a1ba5f342b
commit 7165fcee9b

View File

@@ -0,0 +1,20 @@
import { serve } from "https://deno.land/std@0.190.0/http/server.ts";
serve(async () => {
try {
const supabaseUrl = Deno.env.get("SUPABASE_URL")!;
const response = await fetch(`${supabaseUrl}/functions/v1/cancel-expired-consulting-orders`, {
method: "POST",
headers: {
"Content-Type": "application/json",
"Authorization": `Bearer ${Deno.env.get("SUPABASE_ANON_KEY")}`,
},
});
const result = await response.json();
console.log(JSON.stringify(result));
return new Response(JSON.stringify(result), { status: 200 });
} catch (error) {
console.error(error);
return new Response(JSON.stringify({ error: error.message }), { status: 500 });
}
});