Supporting creating a league without connecting it to iRacing#5
Merged
Conversation
Codecov Report❌ Patch coverage is
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. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
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.iracingLeagueIdnullable 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 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"} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Changes made
How to test
npm run lintnpm run typechecknpm run testnpm run buildPrisma / schema impact
Checklist