regionals

This commit is contained in:
yohlo
2026-03-01 16:21:27 -06:00
parent f83a7d69c8
commit 6199afc687
14 changed files with 849 additions and 137 deletions

View File

@@ -41,6 +41,14 @@ export function createGroupsService(pb: PocketBase) {
for (const group of groups) {
await pb.collection("groups").delete(group.id);
}
},
async getGroup(groupId: string): Promise<Group> {
logger.info("PocketBase | Getting group", { groupId });
const result = await pb.collection("groups").getOne(groupId, {
expand: "teams,teams.players"
});
return result as unknown as Group;
}
};
}

View File

@@ -141,5 +141,17 @@ export function createMatchesService(pb: PocketBase) {
return results.map(match => transformMatch(match));
},
async getMatchesByGroup(groupId: string): Promise<Match[]> {
logger.info("PocketBase | Getting matches for group", { groupId });
const results = await pb.collection("matches").getFullList({
filter: `group = "${groupId}"`,
expand: "tournament, home, away, home.players, away.players",
sort: "created",
});
return results.map(match => transformMatch(match));
},
};
}