25 lines
698 B
TypeScript
25 lines
698 B
TypeScript
import { client } from "@/trigger";
|
|
import { Database } from "@/supabase-types";
|
|
import { SupabaseManagement } from "@trigger.dev/supabase";
|
|
|
|
const supabase = new SupabaseManagement({
|
|
id: "jokullbase-sanity-check",
|
|
});
|
|
|
|
const db = supabase.db<Database>(process.env.NEXT_PUBLIC_SUPABASE_URL || "");
|
|
|
|
client.defineJob({
|
|
id: "bus-stop-sanity-check",
|
|
name: "Sanity Check Potential Job Arrivals",
|
|
version: "0.1.1",
|
|
enabled: false, // 1 run per insert is a bit too insane.
|
|
trigger: db.onInserted({
|
|
table: 'potential_arrivals',
|
|
}),
|
|
run: async (payload, io, ctx) => {
|
|
await io.runTask("log-payload", async function() {
|
|
io.logger.log(JSON.stringify(payload));
|
|
});
|
|
},
|
|
});
|