brackt/app/services/standings-sync/f1.ts
Chris Parsons bcca8b76fa
Add regular season standings for NBA/NHL (fixes #89) (#192)
Adds live standings sync and display for bracket-based sports (NBA/NHL),
so league members can see W/L tables and which teams their opponents drafted
during the regular season — not just after the playoff bracket is set.

- New `regular_season_standings` table with upsert-on-conflict sync
- Standings sync service with NHL (api-web.nhle.com) and NBA (ESPN) adapters,
  externalId write-back for future syncs, and unmatched-team resolution UI
- `RegularSeasonStandings` component: flat (NBA) + division/wild-card (NHL) modes,
  playoff line, TeamOwnerBadge, projected Brackt points (EV), mobile horizontal scroll
- Admin "Sync Standings" card + "Resolve Unmatched" UI on sports season page
- Admin manual standings edit hatch at /admin/sports-seasons/:id/regular-standings
- Show standings above bracket until matches exist; below once bracket is set
- `normalize-team-name` utility extracted to shared lib

Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-21 00:12:01 -07:00

31 lines
1.2 KiB
TypeScript

import type { FetchedStandingsRecord, StandingsSyncAdapter } from "./types";
/**
* F1 / IndyCar championship standings adapter.
*
* TODO: Implement using one of:
* - OpenF1 API: https://openf1.org/ (free, real-time, no key required)
* - Ergast API: https://ergast.com/mrd/ (free, historical, being deprecated)
* - Official F1 API: requires a key but is comprehensive
*
* NOTE: For season_standings sports, the sync result should upsert into
* participantSeasonResults (currentPoints + currentPosition) rather than
* regularSeasonStandings. The orchestrator in index.ts handles the routing.
*/
export class F1StandingsAdapter implements StandingsSyncAdapter {
async fetchStandings(): Promise<FetchedStandingsRecord[]> {
throw new Error(
"F1/IndyCar standings sync not yet implemented. " +
"Implement using OpenF1 API (https://openf1.org/) or Ergast API."
);
}
}
export class IndyCarStandingsAdapter implements StandingsSyncAdapter {
async fetchStandings(): Promise<FetchedStandingsRecord[]> {
throw new Error(
"IndyCar standings sync not yet implemented. " +
"Implement using the IndyCar official results API."
);
}
}