working runner w/o spotify

This commit is contained in:
yohlo
2025-09-12 10:17:51 -05:00
parent 51e3d5141c
commit 9d92a8a510
6 changed files with 345 additions and 15 deletions

View File

@@ -20,7 +20,7 @@ export function createMatchesService(pb: PocketBase) {
if (!match) throw new Error("Match not found")
const result = await pb.collection("matches").getFullList({
filter: `tournament="${match.tournament.id}" && (home_from_lid = ${match.lid} || away_from_lid = ${match.lid})`,
filter: `tournament="${match.tournament.id}" && (home_from_lid = ${match.lid} || away_from_lid = ${match.lid}) && bye = false`,
expand: "tournament, home, away",
});
@@ -51,8 +51,10 @@ export function createMatchesService(pb: PocketBase) {
async updateMatch(id: string, data: Partial<MatchInput>): Promise<Match> {
logger.info("PocketBase | Updating match", { id, data });
const result = await pb.collection("matches").update<Match>(id, data);
return result;
const result = await pb.collection("matches").update<Match>(id, data, {
expand: 'home, away'
});
return transformMatch(result);
},
async deleteMatch(id: string): Promise<void> {

View File

@@ -44,9 +44,9 @@ export const transformMatch = (record: any): Match => {
away_from_loser: record.away_from_loser,
is_losers_bracket: record.is_losers_bracket,
status: record.status || "tbd",
tournament: transformTournamentInfo(record.expand?.tournament),
home: record.expand?.home ? transformTeamInfo(record.expand.home) : undefined,
away: record.expand?.away ? transformTeamInfo(record.expand.away) : undefined,
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,
created: record.created,
updated: record.updated,
home_seed: record.home_seed,