Skip to content

Supporting creating a league without connecting it to iRacing#5

Merged
DarrellRichards merged 2 commits into
mainfrom
create-league-without-iracing
May 15, 2026
Merged

Supporting creating a league without connecting it to iRacing#5
DarrellRichards merged 2 commits into
mainfrom
create-league-without-iracing

Conversation

@DarrellRichards
Copy link
Copy Markdown
Owner

@DarrellRichards DarrellRichards commented May 15, 2026

Summary

Changes made

How to test

  • npm run lint
  • npm run typecheck
  • npm run test
  • npm run build

Prisma / schema impact

  • No schema changes
  • Schema updated and migration included

Checklist

  • Documentation updated if needed
  • No secrets or local-only config committed
  • Screenshots included for UI changes when helpful

Copilot AI review requested due to automatic review settings May 15, 2026 14:47
@codecov
Copy link
Copy Markdown

codecov Bot commented May 15, 2026

Codecov Report

❌ Patch coverage is 60.00000% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 59.58%. Comparing base (bbc8e98) to head (34c6ee9).

Files with missing lines Patch % Lines
src/app/api/leagues/[leagueId]/landing/route.ts 60.00% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main       #5      +/-   ##
==========================================
- Coverage   59.61%   59.58%   -0.04%     
==========================================
  Files           7        7              
  Lines         525      527       +2     
  Branches      181      183       +2     
==========================================
+ Hits          313      314       +1     
- Misses        165      166       +1     
  Partials       47       47              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds support for creating and managing leagues that are not initially linked to iRacing, including nullable iRacing league IDs, local league creation, and later linking from the admin UI.

Changes:

  • Makes League.iracingLeagueId nullable with a Prisma migration.
  • Adds local league creation and route IDs that fall back to the database ID when no iRacing ID exists.
  • Adds UI/API handling for linking an existing local league to iRacing and disables iRacing-only sync flows until linked.

Reviewed changes

Copilot reviewed 12 out of 12 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
src/components/AdminScheduleSection.tsx Supports nullable iRacing league IDs and file-only imports for unlinked leagues.
src/app/dashboard/page.tsx Adds local league creation and route fallback handling on league cards.
src/app/app/[leagueId]/page.tsx Displays unlinked league status and uses route-safe league IDs in links.
src/app/app/[leagueId]/admin/page.tsx Adds iRacing linking UI and guards iRacing sync actions for unlinked leagues.
src/app/api/leagues/route.ts Allows creating leagues with only a local name and returns route-safe IDs.
src/app/api/leagues/[leagueId]/series/[seriesId]/seasons/sync/route.ts Blocks season sync for unlinked leagues.
src/app/api/leagues/[leagueId]/members/sync/route.ts Blocks member sync for unlinked leagues.
src/app/api/leagues/[leagueId]/landing/route.ts Adds routeLeagueId to landing responses.
src/app/api/leagues/[leagueId]/iracing-link/route.ts Adds API endpoint to link a local league to an iRacing league.
prisma/schema.prisma Makes iracingLeagueId optional.
prisma/migrations/20260515143654_make_league_iracing_id_optional/migration.sql Drops the NOT NULL constraint on iracing_league_id.

Comment on lines +117 to +122
const updatedLeague = await prisma.$transaction(async (tx) => {
const updated = await tx.league.update({
where: { id: leagueId },
data: {
iracingLeagueId: selectedMembership.league_id,
leagueName: leagueData.league_name,
Comment thread src/app/app/[leagueId]/admin/page.tsx
Comment on lines +22 to +25
export async function PATCH(
request: NextRequest,
{ params }: { params: Promise<{ leagueId: string }> },
) {
Comment on lines +558 to +560
{league.iracingLeagueId != null
? `iRacing League ID: ${league.iracingLeagueId}`
: "iRacing: Not linked yet"}
Comment thread src/app/app/[leagueId]/admin/page.tsx
@DarrellRichards DarrellRichards merged commit 7ec5707 into main May 15, 2026
4 checks passed
@DarrellRichards DarrellRichards deleted the create-league-without-iracing branch May 15, 2026 14:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants