regionals
This commit is contained in:
@@ -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;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@@ -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));
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user