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:
20
supabase/functions/trigger-calendar-cleanup/index.ts
Normal file
20
supabase/functions/trigger-calendar-cleanup/index.ts
Normal 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 });
|
||||
}
|
||||
});
|
||||
Reference in New Issue
Block a user