match h2h
This commit is contained in:
@@ -347,3 +347,35 @@ export const getMatchReactions = createServerFn()
|
||||
return reactions as Reaction[]
|
||||
})
|
||||
);
|
||||
|
||||
const matchesBetweenPlayersSchema = z.object({
|
||||
player1Id: z.string(),
|
||||
player2Id: z.string(),
|
||||
});
|
||||
|
||||
export const getMatchesBetweenPlayers = createServerFn()
|
||||
.inputValidator(matchesBetweenPlayersSchema)
|
||||
.middleware([superTokensFunctionMiddleware])
|
||||
.handler(async ({ data: { player1Id, player2Id } }) =>
|
||||
toServerResult(async () => {
|
||||
logger.info("Getting matches between players", { player1Id, player2Id });
|
||||
const matches = await pbAdmin.getMatchesBetweenPlayers(player1Id, player2Id);
|
||||
return matches;
|
||||
})
|
||||
);
|
||||
|
||||
const matchesBetweenTeamsSchema = z.object({
|
||||
team1Id: z.string(),
|
||||
team2Id: z.string(),
|
||||
});
|
||||
|
||||
export const getMatchesBetweenTeams = createServerFn()
|
||||
.inputValidator(matchesBetweenTeamsSchema)
|
||||
.middleware([superTokensFunctionMiddleware])
|
||||
.handler(async ({ data: { team1Id, team2Id } }) =>
|
||||
toServerResult(async () => {
|
||||
logger.info("Getting matches between teams", { team1Id, team2Id });
|
||||
const matches = await pbAdmin.getMatchesBetweenTeams(team1Id, team2Id);
|
||||
return matches;
|
||||
})
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user