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