code quality
Some checks failed
CI / lint-typecheck (pull_request) Failing after 12s
CI / tests (pull_request) Has been skipped
CI / contract-tests (pull_request) Has been skipped
CI / e2e-tests (pull_request) Has been skipped
CI / comment-pr (pull_request) Has been skipped
CI / commit-types (pull_request) Has been skipped

This commit is contained in:
2026-01-26 17:22:01 +01:00
parent cfc30c79a8
commit 9ac74f5046
305 changed files with 1192 additions and 607 deletions

View File

@@ -1,22 +1,21 @@
'use server';
import { Result } from '@/lib/contracts/Result';
import { CompleteOnboardingMutation } from '@/lib/mutations/onboarding/CompleteOnboardingMutation';
import { CompleteOnboardingInputDTO } from '@/lib/types/generated/CompleteOnboardingInputDTO';
import { CompleteOnboardingMutation, CompleteOnboardingCommand } from '@/lib/mutations/onboarding/CompleteOnboardingMutation';
import { revalidatePath } from 'next/cache';
import { routes } from '@/lib/routing/RouteConfig';
/**
* Complete onboarding - thin wrapper around mutation
*
*
* Pattern: Server Action → Mutation → Service → API Client
*
*
* Authentication is handled automatically by the API via cookies.
* The BaseApiClient includes credentials: 'include', so cookies are sent automatically.
* If authentication fails, the API returns 401/403 which gets converted to domain errors.
*/
export async function completeOnboardingAction(
input: CompleteOnboardingInputDTO
input: CompleteOnboardingCommand
): Promise<Result<{ success: boolean }, string>> {
const mutation = new CompleteOnboardingMutation();
const result = await mutation.execute(input);

View File

@@ -124,16 +124,16 @@ export async function withdrawFromRaceAction(raceId: string, driverId: string, l
}
// eslint-disable-next-line gridpilot-rules/server-actions-interface
export async function navigateToEditRaceAction(leagueId: string): Promise<void> {
export async function navigateToEditRaceAction(raceId: string, leagueId: string): Promise<void> {
redirect(routes.league.scheduleAdmin(leagueId));
}
// eslint-disable-next-line gridpilot-rules/server-actions-interface
export async function navigateToRescheduleRaceAction(leagueId: string): Promise<void> {
export async function navigateToRescheduleRaceAction(raceId: string, leagueId: string): Promise<void> {
redirect(routes.league.scheduleAdmin(leagueId));
}
// eslint-disable-next-line gridpilot-rules/server-actions-interface
export async function navigateToRaceResultsAction(raceId: string): Promise<void> {
export async function navigateToRaceResultsAction(raceId: string, leagueId: string): Promise<void> {
redirect(routes.race.results(raceId));
}

View File

@@ -50,7 +50,7 @@ export default async function DriverProfilePage({ params }: { params: Promise<{
return (
<DriverProfilePageClient
viewData={null}
error={error}
error={true}
/>
);
}
@@ -76,4 +76,4 @@ export default async function DriverProfilePage({ params }: { params: Promise<{
/>
</>
);
}
}

View File

@@ -22,7 +22,7 @@ export default async function Page() {
return (
<DriversPageClient
viewData={null}
error={error}
error={true}
/>
);
}

View File

@@ -59,8 +59,12 @@ export default async function LeagueLayout({
sponsorSlots: {
main: { price: 0, status: 'occupied' },
secondary: { price: 0, total: 0, occupied: 0 }
}
},
},
ownerId: '',
createdAt: '',
settings: {},
usedSlots: 0,
} as any,
drivers: [],
races: [],
seasonProgress: { completedRaces: 0, totalRaces: 0, percentage: 0 },
@@ -98,7 +102,7 @@ export default async function LeagueLayout({
// Check if user is admin or owner
const isOwner = currentDriver && data.league.ownerId === currentDriver.id;
const isAdmin = currentDriver && data.memberships.members?.some(m => m.driverId === currentDriver.id && m.role === 'admin');
const isAdmin = currentDriver && data.memberships.members?.some((m: any) => m.driverId === currentDriver.id && m.role === 'admin');
const hasAdminAccess = isOwner || isAdmin;
const adminTabs = hasAdminAccess ? [

View File

@@ -73,7 +73,7 @@ export default async function Page({ params }: Props) {
// Determine if current user is owner or admin
const isOwnerOrAdmin = currentDriverId
? currentDriverId === league.ownerId ||
data.memberships.members?.some(m => m.driverId === currentDriverId && m.role === 'admin')
data.memberships.members?.some((m: any) => m.driverId === currentDriverId && m.role === 'admin')
: false;
// Build ViewData using the builder

View File

@@ -20,7 +20,7 @@ export default async function LeagueRosterPage({ params }: Props) {
}
const data = result.unwrap();
const members = (data.memberships.members || []).map(m => ({
const members = (data.memberships.members || []).map((m: any) => ({
driverId: m.driverId,
driverName: m.driver.name,
role: m.role,