play walkout songs
This commit is contained in:
@@ -27,7 +27,7 @@ export function transformTeamInfo(record: any): TeamInfo {
|
||||
};
|
||||
}
|
||||
|
||||
export const transformMatch = (record: any): Match => {
|
||||
export const transformMatch = (record: any, isAdmin: boolean = false): Match => {
|
||||
return {
|
||||
id: record.id,
|
||||
order: record.order,
|
||||
@@ -47,8 +47,8 @@ export const transformMatch = (record: any): Match => {
|
||||
is_losers_bracket: record.is_losers_bracket,
|
||||
status: record.status || "tbd",
|
||||
tournament: record.expand?.tournament ? transformTournamentInfo(record.expand?.tournament) : record.tournament,
|
||||
home: record.expand?.home ? transformTeamInfo(record.expand.home) : record.home,
|
||||
away: record.expand?.away ? transformTeamInfo(record.expand.away) : record.away,
|
||||
home: record.expand?.home ? (isAdmin ? transformTeam(record.expand.home) : transformTeamInfo(record.expand.home)) : record.home,
|
||||
away: record.expand?.away ? (isAdmin ? transformTeam(record.expand.away) : transformTeamInfo(record.expand.away)) : record.away,
|
||||
created: record.created,
|
||||
updated: record.updated,
|
||||
home_seed: record.home_seed,
|
||||
@@ -135,20 +135,20 @@ export function transformTeam(record: any): Team {
|
||||
};
|
||||
}
|
||||
|
||||
export function transformTournament(record: any): Tournament {
|
||||
export function transformTournament(record: any, isAdmin: boolean = false): Tournament {
|
||||
const teams =
|
||||
record.expand?.teams
|
||||
?.sort((a: any, b: any) =>
|
||||
new Date(a.created) < new Date(b.created) ? -1 : 0
|
||||
)
|
||||
?.map(transformTeamInfo) ?? [];
|
||||
?.map(isAdmin ? transformTeam : transformTeamInfo) ?? [];
|
||||
|
||||
const matches =
|
||||
record.expand?.matches
|
||||
?.sort((a: any, b: any) =>
|
||||
a.lid - b.lid ? -1 : 0
|
||||
)
|
||||
?.map(transformMatch) ?? [];
|
||||
?.map((match: any) => transformMatch(match, isAdmin)) ?? [];
|
||||
|
||||
return {
|
||||
id: record.id,
|
||||
|
||||
Reference in New Issue
Block a user