@@ -454,60 +454,61 @@ async function eventSearch(req: Request<{ season: string }>, res: Response) {
454454
455455// --- EPA proxy handlers ---
456456
457- async function epaTeam ( req : Request < { number : string } > , res : Response ) {
457+ async function epaTeam ( req : Request < { number : string } > , res : Response ) : Promise < void > {
458458 let data = await epaClient . getTeamEpa ( + req . params . number ) ;
459- if ( ! data ) return res . status ( 404 ) . send ( "EPA data not available" ) ;
459+ if ( ! data ) { res . status ( 404 ) . send ( "EPA data not available" ) ; return ; }
460460 res . send ( data ) ;
461461}
462462
463- async function epaTeamSeason ( req : Request < { number : string ; season : string } > , res : Response ) {
463+ async function epaTeamSeason ( req : Request < { number : string ; season : string } > , res : Response ) : Promise < void > {
464464 let data = await epaClient . getTeamSeasonEpa ( + req . params . number , + req . params . season ) ;
465- if ( ! data ) return res . status ( 404 ) . send ( "EPA data not available" ) ;
465+ if ( ! data ) { res . status ( 404 ) . send ( "EPA data not available" ) ; return ; }
466466 res . send ( data ) ;
467467}
468468
469- async function epaTeamSeasons ( req : Request < { number : string } > , res : Response ) {
469+ async function epaTeamSeasons ( req : Request < { number : string } > , res : Response ) : Promise < void > {
470470 let data = await epaClient . getTeamAllSeasons ( + req . params . number ) ;
471471 res . send ( data ?? [ ] ) ;
472472}
473473
474- async function epaTeamMatches ( req : Request < { number : string ; season : string } > , res : Response ) {
474+ async function epaTeamMatches ( req : Request < { number : string ; season : string } > , res : Response ) : Promise < void > {
475475 let data = await epaClient . getTeamMatchEpas ( + req . params . number , + req . params . season ) ;
476476 res . send ( data ?? [ ] ) ;
477477}
478478
479- async function epaRankings ( req : Request < { season : string } > , res : Response ) {
480- let data = await epaClient . getEpaRankings ( + req . params . season , {
481- limit : req . query . limit ? + req . query . limit : undefined ,
482- offset : req . query . offset ? + req . query . offset : undefined ,
483- country : req . query . country as string | undefined ,
484- state : req . query . state as string | undefined ,
485- } ) ;
479+ async function epaRankings ( req : Request < { season : string } > , res : Response ) : Promise < void > {
480+ let opts : { limit ?: number ; offset ?: number ; country ?: string ; state ?: string } = { } ;
481+ if ( req . query . limit ) opts . limit = + req . query . limit ;
482+ if ( req . query . offset ) opts . offset = + req . query . offset ;
483+ if ( req . query . country ) opts . country = req . query . country as string ;
484+ if ( req . query . state ) opts . state = req . query . state as string ;
485+ let data = await epaClient . getEpaRankings ( + req . params . season , opts ) ;
486486 res . send ( data ?? [ ] ) ;
487487}
488488
489- async function epaSeason ( req : Request < { year : string } > , res : Response ) {
489+ async function epaSeason ( req : Request < { year : string } > , res : Response ) : Promise < void > {
490490 let data = await epaClient . getSeasonEpa ( + req . params . year ) ;
491- if ( ! data ) return res . status ( 404 ) . send ( "EPA data not available" ) ;
491+ if ( ! data ) { res . status ( 404 ) . send ( "EPA data not available" ) ; return ; }
492492 res . send ( data ) ;
493493}
494494
495- async function epaEvent ( req : Request < { season : string ; code : string } > , res : Response ) {
495+ async function epaEvent ( req : Request < { season : string ; code : string } > , res : Response ) : Promise < void > {
496496 let data = await epaClient . getEventEpa ( + req . params . season , req . params . code ) ;
497497 res . send ( data ?? [ ] ) ;
498498}
499499
500- async function epaPredict ( req : Request , res : Response ) {
500+ async function epaPredict ( req : Request , res : Response ) : Promise < void > {
501501 let { red_teams, blue_teams, season } = req . body ?? { } ;
502502 if ( ! red_teams ?. length || ! blue_teams ?. length ) {
503- return res . status ( 400 ) . send ( "red_teams and blue_teams are required" ) ;
503+ res . status ( 400 ) . send ( "red_teams and blue_teams are required" ) ;
504+ return ;
504505 }
505506 let data = await epaClient . predictMatch ( red_teams , blue_teams , season ?? 2025 ) ;
506- if ( ! data ) return res . status ( 503 ) . send ( "EPA service unavailable" ) ;
507+ if ( ! data ) { res . status ( 503 ) . send ( "EPA service unavailable" ) ; return ; }
507508 res . send ( data ) ;
508509}
509510
510- async function epaHealth ( _req : Request , res : Response ) {
511+ async function epaHealth ( _req : Request , res : Response ) : Promise < void > {
511512 let healthy = await epaClient . isEpaServiceHealthy ( ) ;
512513 res . send ( { epa_service : healthy ? "ok" : "unavailable" } ) ;
513514}
0 commit comments