23 lines
760 B
TypeScript
23 lines
760 B
TypeScript
import { apiClient } from '@/lib/apiClient';
|
|
import { LeagueWizardCommandModel } from '@/lib/command-models/leagues/LeagueWizardCommandModel';
|
|
import { CreateLeagueOutputDTO } from '@/lib/types/generated/CreateLeagueOutputDTO';
|
|
|
|
export class LeagueWizardService {
|
|
static async createLeague(
|
|
form: LeagueWizardCommandModel,
|
|
ownerId: string,
|
|
): Promise<CreateLeagueOutputDTO> {
|
|
const command = form.toCreateLeagueCommand(ownerId);
|
|
const result = await apiClient.leagues.create(command);
|
|
|
|
return result;
|
|
}
|
|
|
|
// Static method for backward compatibility
|
|
static async createLeagueFromConfig(
|
|
form: LeagueWizardCommandModel,
|
|
ownerId: string,
|
|
): Promise<CreateLeagueOutputDTO> {
|
|
return this.createLeague(form, ownerId);
|
|
}
|
|
} |