feat(time-tracking): add cron route for time-tracking smartsheet sync (cycle 8)

Mirrors the /api/water-log/smartsheet-sync route so time entries
eventually reach the customer's Smartsheet workbook even when the
worker loses connectivity between clock-out and the realtime push.

- New route: /api/time-tracking/smartsheet-sync — drains pending
  sync queue rows for every brand with sync_enabled = true.
- Per-frequency gating lives inside runScheduledTTSync:
  realtime = backstop only; every_15_min / hourly skip cleanly
  when not yet due (literal `skipped === true` branch).
- Auth: Bearer $SMARTSHEET_CRON_SECRET (falls back to $CRON_SECRET).
- Optional body { brandId? } for 'Retry now' admin button.
- Schedule: */15 * * * * in vercel.json (same cadence as water-log).

Co-authored-by: cyc8-bot <bot@routecomm>
This commit is contained in:
Nora
2026-07-03 19:26:18 -06:00
parent ad4d3c9976
commit da488b2cb0
2 changed files with 163 additions and 0 deletions
+4
View File
@@ -25,6 +25,10 @@
"path": "/api/water-log/smartsheet-sync",
"schedule": "*/15 * * * *"
},
{
"path": "/api/time-tracking/smartsheet-sync",
"schedule": "*/15 * * * *"
},
{
"path": "/api/email-automation/abandoned-cart",
"schedule": "0 */6 * * *"