regional teams
This commit is contained in:
@@ -7,7 +7,7 @@ export function createMatchesService(pb: PocketBase) {
|
||||
return {
|
||||
async getMatch(id: string): Promise<Match | null> {
|
||||
const result = await pb.collection("matches").getOne(id, {
|
||||
expand: "tournament, home, away",
|
||||
expand: "tournament, home, away, home.players, away.players",
|
||||
});
|
||||
return transformMatch(result);
|
||||
},
|
||||
@@ -19,7 +19,7 @@ export function createMatchesService(pb: PocketBase) {
|
||||
|
||||
const result = await pb.collection("matches").getFullList({
|
||||
filter: `tournament="${match.tournament.id}" && (home_from_lid = ${match.lid} || away_from_lid = ${match.lid}) && bye = false`,
|
||||
expand: "tournament, home, away",
|
||||
expand: "tournament, home, away, home.players, away.players",
|
||||
});
|
||||
|
||||
const winnerMatch = result.find(m => (m.home_from_lid === match.lid && !m.home_from_loser) || (m.away_from_lid === match.lid && !m.away_from_loser));
|
||||
@@ -50,7 +50,7 @@ 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, {
|
||||
expand: 'home, away, tournament'
|
||||
expand: 'home, away, tournament, home.players, away.players'
|
||||
});
|
||||
return transformMatch(result);
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user