-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #15 from AustinMusiku/add-league-types
Add league types
- Loading branch information
Showing
11 changed files
with
633 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
// Classic League | ||
export type ClassicLeague = { | ||
last_updated_data: string | null | ||
league: ClassicLeagueMeta | ||
new_entries: NewEntries | ||
standings: ClassicLeagueStandings | ||
} | ||
|
||
export type ClassicLeagueMeta = LeagueMeta & { | ||
rank: number | null | ||
} | ||
|
||
export type ClassicLeagueStandings = { | ||
has_next: boolean | ||
page: number | ||
results: ClassicLeagueStanding[] | ||
} | ||
|
||
export type ClassicLeagueStanding = Standing & { | ||
event_total: number | ||
} | ||
|
||
// ------------------------------------------ | ||
// NewEntries | ||
export type NewEntries = { | ||
has_next: boolean | ||
page: number | ||
results: NewEntry[] | ||
} | ||
|
||
export type NewEntry = { | ||
entry: number | ||
entry_name: string | ||
joined_time: string | ||
player_first_name: string | ||
player_last_name: string | ||
} | ||
|
||
// LeagueMeta | ||
export type LeagueMeta = { | ||
id: number | ||
name: string | ||
created: string | ||
closed: boolean | ||
max_entries: number | null | ||
league_type: string | ||
scoring: string | ||
admin_entry: number | ||
start_event: number | ||
code_privacy: string | ||
has_cup: boolean | ||
cup_league: null | ||
} | ||
|
||
// Standing | ||
export type Standing = { | ||
id: number | ||
player_name: string | ||
rank: number | ||
last_rank: number | ||
rank_sort: number | ||
total: number | ||
entry: number | ||
entry_name: string | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import { LeagueMeta, NewEntries, Standing } from './classicLeague' | ||
|
||
// H2H League | ||
export type H2hLeague = { | ||
last_updated_data: string | null | ||
league: H2hLeagueMeta | ||
new_entries: NewEntries | ||
standings: H2hLeagueStandings | ||
} | ||
|
||
export type H2hLeagueMeta = LeagueMeta & { | ||
ko_rounds: number | null | ||
} | ||
|
||
export type H2hLeagueStandings = { | ||
has_next: boolean | ||
page: number | ||
results: H2hLeagueStanding[] | ||
} | ||
|
||
export type H2hLeagueStanding = Standing & { | ||
division: number | ||
matches_played: number | ||
matches_won: number | ||
matches_drawn: number | ||
matches_lost: number | ||
points_for: number | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
import { | ||
ClassicLeagueResolvers, | ||
ClassicLeagueMetaResolvers, | ||
ClassicLeagueStandingsResolvers, | ||
ClassicLeagueStandingResolvers, | ||
NewEntriesResolvers, | ||
NewEntryResolvers | ||
} from '@/types/schema' | ||
|
||
export const ClassicLeague: ClassicLeagueResolvers = { | ||
last_updated_data: ({ last_updated_data }) => last_updated_data, | ||
league: ({ league }) => league, | ||
new_entries: ({ new_entries }) => new_entries, | ||
standings: ({ standings }) => standings | ||
} | ||
|
||
export const ClassicLeagueMeta: ClassicLeagueMetaResolvers = { | ||
admin_entry: ({ admin_entry }) => admin_entry, | ||
closed: ({ closed }) => closed, | ||
code_privacy: ({ code_privacy }) => code_privacy, | ||
created: ({ created }) => created, | ||
cup_league: ({ cup_league }) => cup_league, | ||
has_cup: ({ has_cup }) => has_cup, | ||
id: ({ id }) => id, | ||
league_type: ({ league_type }) => league_type, | ||
max_entries: ({ max_entries }) => max_entries, | ||
name: ({ name }) => name, | ||
rank: ({ rank }) => rank, | ||
scoring: ({ scoring }) => scoring, | ||
start_event: ({ start_event }) => start_event | ||
} | ||
|
||
export const ClassicLeagueStandings: ClassicLeagueStandingsResolvers = { | ||
has_next: ({ has_next }) => has_next, | ||
page: ({ page }) => page, | ||
results: ({ results }) => results | ||
} | ||
|
||
export const ClassicLeagueStanding: ClassicLeagueStandingResolvers = { | ||
entry: ({ entry }) => entry, | ||
entry_name: ({ entry_name }) => entry_name, | ||
event_total: ({ event_total }) => event_total, | ||
id: ({ id }) => id, | ||
last_rank: ({ last_rank }) => last_rank, | ||
player_name: ({ player_name }) => player_name, | ||
rank: ({ rank }) => rank, | ||
rank_sort: ({ rank_sort }) => rank_sort, | ||
total: ({ total }) => total | ||
} | ||
|
||
export const NewEntries: NewEntriesResolvers = { | ||
has_next: ({ has_next }) => has_next, | ||
page: ({ page }) => page, | ||
results: ({ results }) => results | ||
} | ||
|
||
export const NewEntry: NewEntryResolvers = { | ||
entry: ({ entry }) => entry, | ||
entry_name: ({ entry_name }) => entry_name, | ||
joined_time: ({ joined_time }) => joined_time, | ||
player_first_name: ({ player_first_name }) => player_first_name, | ||
player_last_name: ({ player_last_name }) => player_last_name | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
import { | ||
H2hLeagueResolvers, | ||
H2hLeagueMetaResolvers, | ||
H2hLeagueStandingsResolvers, | ||
H2hLeagueStandingResolvers | ||
} from '@/types/schema' | ||
|
||
export const H2hLeague: H2hLeagueResolvers = { | ||
last_updated_data: ({ last_updated_data }) => last_updated_data, | ||
league: ({ league }) => league, | ||
new_entries: ({ new_entries }) => new_entries, | ||
standings: ({ standings }) => standings | ||
} | ||
|
||
export const H2hLeagueMeta: H2hLeagueMetaResolvers = { | ||
admin_entry: ({ admin_entry }) => admin_entry, | ||
closed: ({ closed }) => closed, | ||
code_privacy: ({ code_privacy }) => code_privacy, | ||
created: ({ created }) => created, | ||
cup_league: ({ cup_league }) => cup_league, | ||
has_cup: ({ has_cup }) => has_cup, | ||
id: ({ id }) => id, | ||
league_type: ({ league_type }) => league_type, | ||
ko_rounds: ({ ko_rounds }) => ko_rounds, | ||
max_entries: ({ max_entries }) => max_entries, | ||
name: ({ name }) => name, | ||
scoring: ({ scoring }) => scoring, | ||
start_event: ({ start_event }) => start_event | ||
} | ||
|
||
export const H2hLeagueStandings: H2hLeagueStandingsResolvers = { | ||
has_next: ({ has_next }) => has_next, | ||
page: ({ page }) => page, | ||
results: ({ results }) => results | ||
} | ||
|
||
export const H2hLeagueStanding: H2hLeagueStandingResolvers = { | ||
division: ({ division }) => division, | ||
entry: ({ entry }) => entry, | ||
entry_name: ({ entry_name }) => entry_name, | ||
id: ({ id }) => id, | ||
last_rank: ({ last_rank }) => last_rank, | ||
matches_drawn: ({ matches_drawn }) => matches_drawn, | ||
matches_lost: ({ matches_lost }) => matches_lost, | ||
matches_played: ({ matches_played }) => matches_played, | ||
matches_won: ({ matches_won }) => matches_won, | ||
player_name: ({ player_name }) => player_name, | ||
points_for: ({ points_for }) => points_for, | ||
rank: ({ rank }) => rank, | ||
rank_sort: ({ rank_sort }) => rank_sort, | ||
total: ({ total }) => total | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.