Skip to content

[Airdrop P4] Weekly stats snapshot cron + vercel.json #891

@realproject7

Description

@realproject7

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

  • Weekly snapshot aggregates all stats correctly
  • Idempotent — one entry per week number
  • All 3 airdrop crons registered in vercel.json
  • CRON_SECRET auth on all endpoints

Metadata

Metadata

Assignees

No one assigned

    Labels

    agent/T3Assigned to T3 builder agentairdropPLOT 10x Airdrop Campaign

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions