From 8c726f2b27093d005ddbf0819df6cc7492c287aa Mon Sep 17 00:00:00 2001 From: Max Wofford Date: Thu, 23 Jan 2025 09:16:21 -0500 Subject: [PATCH] Bring back accidentally deleted file --- src/app/api/cron/create-background-job.ts | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 src/app/api/cron/create-background-job.ts diff --git a/src/app/api/cron/create-background-job.ts b/src/app/api/cron/create-background-job.ts new file mode 100644 index 00000000..97b451f7 --- /dev/null +++ b/src/app/api/cron/create-background-job.ts @@ -0,0 +1,12 @@ +import { sql } from '@vercel/postgres' + +export default async function createBackgroundJob( + type: 'run_lottery' | 'create_person' | 'invite', + args: {}, + status: 'pending' | 'completed' | 'failed' = 'pending', +) { + console.log(JSON.stringify(args)) + return await sql`INSERT INTO background_job (type, args, status) VALUES (${type}, ${JSON.stringify(args)}, ${status})` +} + +export const fetchCache = 'force-no-store' \ No newline at end of file