reactions, match sse, etc

This commit is contained in:
yohlo
2025-09-19 14:08:36 -05:00
parent 602e6e3473
commit f99d6efaf9
20 changed files with 474 additions and 100 deletions

View File

@@ -6,7 +6,6 @@ import { transformMatch } from "../util/transform-types";
export function createMatchesService(pb: PocketBase) {
return {
async getMatch(id: string): Promise<Match | null> {
logger.info("PocketBase | Getting match", id);
const result = await pb.collection("matches").getOne(id, {
expand: "tournament, home, away",
});
@@ -15,7 +14,6 @@ export function createMatchesService(pb: PocketBase) {
// match Ids where the current lid is home_from_lid or away_from_lid
async getChildMatches(matchId: string): Promise<{ winner: Match | undefined, loser: Match | undefined }> {
logger.info("PocketBase | Getting child matches", matchId);
const match = await this.getMatch(matchId);
if (!match) throw new Error("Match not found")
@@ -52,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'
expand: 'home, away, tournament'
});
return transformMatch(result);
},