From 7165fcee9bafc43a6aa6e1c43b6bd0903c26c0ca Mon Sep 17 00:00:00 2001 From: dwindown Date: Sun, 11 Jan 2026 22:59:02 +0700 Subject: [PATCH] Add trigger-calendar-cleanup edge function for Coolify scheduled tasks MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- .../trigger-calendar-cleanup/index.ts | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 supabase/functions/trigger-calendar-cleanup/index.ts diff --git a/supabase/functions/trigger-calendar-cleanup/index.ts b/supabase/functions/trigger-calendar-cleanup/index.ts new file mode 100644 index 0000000..d1cab86 --- /dev/null +++ b/supabase/functions/trigger-calendar-cleanup/index.ts @@ -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 }); + } +});