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 }); + } +});