Parent: #877
Depends on: #878
Scope
Weekly cron that aggregates campaign stats for the recap display + register all airdrop crons in vercel.json.
Weekly Snapshot Logic
Aggregate from pl_points + pl_daily_prices + pl_referrals + storylines for the past week:
- Count new storylines created (from
storylines table, within past week)
- Count buy events (from
pl_points where action = 'buy', within past week)
- Count new referrals (from
pl_referrals, within past week)
- MCap at week start vs end (from
pl_daily_prices)
- Total PL points earned (from
pl_points, within past week)
Insert into pl_weekly_snapshots.
Endpoint
POST /api/cron/airdrop-weekly
Schedule: Once/week, Monday midnight UTC (0 0 * * 1)
Auth: CRON_SECRET header
Vercel Cron Registration
Add all 3 airdrop crons to vercel.json:
{ "path": "/api/cron/airdrop-points", "schedule": "*/5 * * * *" },
{ "path": "/api/cron/airdrop-price", "schedule": "0 0 * * *" },
{ "path": "/api/cron/airdrop-weekly", "schedule": "0 0 * * 1" }
Files
src/app/api/cron/airdrop-weekly/route.ts
- Modify:
vercel.json
Acceptance Criteria
Parent: #877
Depends on: #878
Scope
Weekly cron that aggregates campaign stats for the recap display + register all airdrop crons in vercel.json.
Weekly Snapshot Logic
Aggregate from
pl_points+pl_daily_prices+pl_referrals+storylinesfor the past week:storylinestable, within past week)pl_pointswhereaction = 'buy', within past week)pl_referrals, within past week)pl_daily_prices)pl_points, within past week)Insert into
pl_weekly_snapshots.Endpoint
POST /api/cron/airdrop-weeklySchedule: Once/week, Monday midnight UTC (
0 0 * * 1)Auth:
CRON_SECRETheaderVercel Cron Registration
Add all 3 airdrop crons to
vercel.json:{ "path": "/api/cron/airdrop-points", "schedule": "*/5 * * * *" }, { "path": "/api/cron/airdrop-price", "schedule": "0 0 * * *" }, { "path": "/api/cron/airdrop-weekly", "schedule": "0 0 * * 1" }Files
src/app/api/cron/airdrop-weekly/route.tsvercel.jsonAcceptance Criteria
vercel.json