CodeIssuesPull RequestsActionsSecurityInsights
✨ AI
More
Settings

Add Vercel Cron Jobs for daily reminders and DB cleanup #3710

Merged⚡ AI-generatedSccantynz wants to mergecopilot/setup-hibiscus-to-airport-taskmainopened Mar 31, 2026
ccantynzcommented Mar 31, 2026

Originally written by @Copilot on GitHub.
Imported from https://github.com/ccantynz-alt/Hibiscus-to-airport/pull/37


The repo had migrated from APScheduler to Vercel Cron Jobs but only one cron (/api/cron/reminders) was wired up. Expired password reset tokens were never cleaned from the DB, and the full scheduled-task picture wasn't clear.

Changes

  • api/cron/cleanup.js (new) — Deletes password_resets rows where expires_at is older than 2 hours (tokens are valid for 1h; the 2h window avoids any race). Mirrors the auth pattern from reminders.js (CRON_SECRET bearer check, standard { ok, results } response).
  • vercel.json — Registers /api/cron/cleanup at 0 6 * * * (6AM UTC = 7PM NZDT), one hour after the reminders job.

Scheduled tasks now active

Path Schedule (UTC) Purpose
/api/cron/reminders 0 5 * * * Day-before reminder email + SMS for confirmed+paid bookings
/api/cron/cleanup 0 6 * * * Purge expired password reset tokens

Both jobs require CRON_SECRET to be set as a Vercel environment variable; Vercel injects it automatically as `Authorization: ****** on each invocation.

ccantynzcommented Mar 31, 2026

Originally written by @vercel[bot] on GitHub.


The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
hibiscus-to-airport Ready Ready Preview, Comment Mar 31, 2026 6:05am

Request Review

Cross-repo impact

See what breaks downstream if this PR merges.

Analyze →
⮌ Merged

This pull request was merged into main.

c comment · e edit title · m merge · a approve · r request changes · ? shortcuts