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>
25 lines
1,009 B
TypeScript
25 lines
1,009 B
TypeScript
import type { FetchedStandingsRecord, StandingsSyncAdapter } from "./types";
|
|
|
|
/**
|
|
* TheSportsDB standings adapter.
|
|
*
|
|
* TODO: Implement when TheSportsDB adds reliable NBA/NHL standings support.
|
|
*
|
|
* Status (as of 2026-03): The free-tier lookuptable.php endpoint is documented
|
|
* as "soccer only" and returns empty results for NBA (4387) and NHL (4380).
|
|
* A premium v2 API key ($9/mo) may unlock broader support — test with:
|
|
* GET https://www.thesportsdb.com/api/v2/json/lookuptable.php?l={leagueId}
|
|
* Headers: { "X-API-KEY": process.env.THESPORTSDB_API_KEY }
|
|
*
|
|
* Reference: https://www.thesportsdb.com/forum_topic.php?t=5772
|
|
*/
|
|
export class TheSportsDbAdapter implements StandingsSyncAdapter {
|
|
constructor(private readonly leagueId: string) {}
|
|
|
|
async fetchStandings(): Promise<FetchedStandingsRecord[]> {
|
|
throw new Error(
|
|
`TheSportsDB standings sync not yet implemented (league ${this.leagueId}). ` +
|
|
"Use NhlStandingsAdapter or NbaStandingsAdapter instead."
|
|
);
|
|
}
|
|
}
|