Implements schedule viewing from SBA production API with week navigation and game creation from scheduled matchups. Groups games by team matchup horizontally with games stacked vertically for space efficiency. Backend: - Add schedule routes (/api/schedule/current, /api/schedule/games) - Add SBA API client methods for schedule data - Fix multi-worker state isolation (single worker for in-memory state) - Add Redis migration TODO for future scalability - Support custom team IDs in quick-create endpoint Frontend: - Add Schedule tab as default on home page - Week navigation with prev/next and "Current Week" jump - Horizontal group layout (2-6 columns responsive) - Completed games show score + "Final" badge (no Play button) - Incomplete games show "Play" button to create webapp game Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
75 lines
1.6 KiB
TypeScript
75 lines
1.6 KiB
TypeScript
/**
|
|
* SBA Schedule Types
|
|
*
|
|
* Types for schedule data from SBA production API.
|
|
*/
|
|
|
|
/**
|
|
* Current season and week from /current endpoint
|
|
*/
|
|
export interface SbaCurrent {
|
|
id: number
|
|
season: number
|
|
week: number
|
|
freeze: boolean
|
|
transcount: number
|
|
bstatcount: number
|
|
pstatcount: number
|
|
bet_week: number
|
|
trade_deadline: number
|
|
pick_trade_start: number
|
|
pick_trade_end: number
|
|
playoffs_begin: number
|
|
injury_count: number
|
|
}
|
|
|
|
/**
|
|
* Team info nested in scheduled game
|
|
*/
|
|
export interface SbaScheduledTeam {
|
|
id: number
|
|
abbrev: string
|
|
sname: string // Short name e.g., "Cardinals"
|
|
lname: string // Long name e.g., "St. Louis Cardinals"
|
|
thumbnail?: string
|
|
color?: string
|
|
}
|
|
|
|
/**
|
|
* Scheduled game from /games endpoint
|
|
*
|
|
* Games are returned with nested away_team and home_team objects.
|
|
*/
|
|
export interface SbaScheduledGame {
|
|
// Game identity
|
|
id: number
|
|
season: number
|
|
week: number
|
|
game_num: number | null // Game number within the week
|
|
season_type: string // 'regular', 'playoff', etc.
|
|
|
|
// Nested team objects
|
|
away_team: SbaScheduledTeam
|
|
home_team: SbaScheduledTeam
|
|
|
|
// Scores (null if not played)
|
|
away_score: number | null
|
|
home_score: number | null
|
|
|
|
// Other fields
|
|
scorecard_url: string | null
|
|
|
|
// Computed helper properties (for backward compatibility with simpler interface)
|
|
// These are accessed via getter functions in the component
|
|
}
|
|
|
|
/**
|
|
* Schedule API response types
|
|
*/
|
|
export interface GetCurrentResponse extends SbaCurrent {}
|
|
|
|
export interface GetScheduleGamesResponse {
|
|
games: SbaScheduledGame[]
|
|
count?: number
|
|
}
|