Skip to content

Commit

Permalink
Get rid of unused toornament types
Browse files Browse the repository at this point in the history
  • Loading branch information
Drarig29 committed Apr 10, 2021
1 parent 0afe5cf commit 45a344e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 26 deletions.
5 changes: 4 additions & 1 deletion src/convert.ts
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,10 @@ export function idFactory() {
*
* @param data Data coming from Toornament put in a single object.
*/
export function convertData(data: toornament.RootObject): ConvertResult {
export function convertData(data: {
stages: toornament.Stage[];
matches: toornament.Match[];
}): ConvertResult {
const db: Database = {
stage: [],
match: [],
Expand Down
27 changes: 2 additions & 25 deletions src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,52 +17,40 @@ export type Mapping = { [id: string]: number };
export namespace toornament {

export type PairingMethod = 'manual' | 'standard' | 'double_standard';
export type StageType = 'single_elimination' | 'double_elimination' | 'pools';
export type Status = 'pending' | 'running' | 'completed';

export interface StageSettings {
size: number;
arrival: string;
departure: string;
nb_groups: number;
calculators: Calculator[];
tiebreakers: Tiebreaker[];
group_naming: string;
round_naming: string;
pairing_method: PairingMethod;
threshold?: number;
grand_final: GrandFinalType;
third_decider?: boolean;
skip_round1?: boolean;
}

export type StageType = 'single_elimination' | 'double_elimination' | 'bracket_groups' | 'pools' | 'gauntlet' | 'league' | 'swiss' | 'simple' | 'ffa_single_elimination' | 'ffa_bracket_groups';

export interface Stage {
id: string;
number: number;
name: string;
type: StageType;
closed: boolean;
settings: StageSettings;
}

export interface Participant {
id: string;
name: string;
custom_user_identifier?: string;
custom_fields: unknown;
}

export interface Opponent {
number: number;
position: number;
participant: Participant | null;
rank?: number;
result: Result | null;
forfeit: boolean;
score?: number | null;
}

export type Status = 'pending' | 'running' | 'completed';

export interface Match {
id: string;
Expand All @@ -72,17 +60,6 @@ export namespace toornament {
number: number;
type: string;
status: Status;
settings: unknown;
scheduled_datetime?: string;
played_at?: Date;
public_note: string;
private_note?: string;
report_closed: boolean;
opponents: Opponent[];
}

export interface RootObject {
stages: Stage[];
matches: Match[];
}
}

0 comments on commit 45a344e

Please sign in to comment.