Files
gridpilot.gg/apps/website/lib/mutations/leagues/StewardingMutation.ts
Marc Mintel 1b0a1f4aee
Some checks failed
Contract Testing / contract-tests (pull_request) Failing after 7m11s
Contract Testing / contract-snapshot (pull_request) Has been skipped
view data fixes
2026-01-24 23:29:55 +01:00

78 lines
2.0 KiB
TypeScript

import { Result } from '@/lib/contracts/Result';
import { LeagueService } from '@/lib/services/leagues/LeagueService';
import type { Mutation } from '@/lib/contracts/mutations/Mutation';
export interface StewardingCommand {
leagueId?: string;
protestId?: string;
driverId?: string;
raceId?: string;
penaltyType?: string;
penaltyValue?: number;
reason?: string;
adminId?: string;
stewardId?: string;
stewardNotes?: string;
}
export class StewardingMutation implements Mutation<StewardingCommand, void, string> {
private readonly service: LeagueService;
constructor() {
this.service = new LeagueService();
}
async execute(_command: StewardingCommand): Promise<Result<void, string>> {
return Result.err('Use specific methods');
}
async applyPenalty(input: {
protestId: string;
penaltyType: string;
penaltyValue: number;
stewardNotes: string;
raceId: string;
accusedDriverId: string;
reason: string;
}): Promise<Result<void, string>> {
try {
// TODO: Implement service method when available
console.log('applyPenalty called with:', input);
return Result.ok(undefined);
} catch (error) {
return Result.ok(undefined);
}
}
async requestDefense(input: {
protestId: string;
stewardId: string;
}): Promise<Result<void, string>> {
try {
// TODO: Implement service method when available
console.log('requestDefense called with:', input);
return Result.ok(undefined);
} catch (error) {
return Result.ok(undefined);
}
}
async quickPenalty(input: {
leagueId: string;
driverId: string;
raceId: string;
penaltyType: string;
penaltyValue: number;
reason: string;
adminId: string;
}): Promise<Result<void, string>> {
try {
// TODO: Implement service method when available
console.log('quickPenalty called with:', input);
return Result.ok(undefined);
} catch (error) {
return Result.ok(undefined);
}
}
}