cleanup
This commit is contained in:
26
apps/website/lib/services/leagues/LeagueWizardService.ts
Normal file
26
apps/website/lib/services/leagues/LeagueWizardService.ts
Normal file
@@ -0,0 +1,26 @@
|
||||
import { apiClient } from '@/lib/apiClient';
|
||||
import { LeagueWizardCommandModel } from '@/lib/command-models/leagues/LeagueWizardCommandModel';
|
||||
import { CreateLeagueResult } from '@/lib/types/CreateLeagueResult';
|
||||
|
||||
export class LeagueWizardService {
|
||||
static async createLeague(
|
||||
form: LeagueWizardCommandModel,
|
||||
ownerId: string,
|
||||
): Promise<CreateLeagueResult> {
|
||||
const command = form.toCreateLeagueCommand(ownerId);
|
||||
const result = await apiClient.leagues.create(command);
|
||||
|
||||
return {
|
||||
leagueId: result.leagueId,
|
||||
success: result.success,
|
||||
};
|
||||
}
|
||||
|
||||
// Static method for backward compatibility
|
||||
static async createLeagueFromConfig(
|
||||
form: LeagueWizardCommandModel,
|
||||
ownerId: string,
|
||||
): Promise<CreateLeagueResult> {
|
||||
return this.createLeague(form, ownerId);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user