regionals

This commit is contained in:
yohlo
2025-10-16 09:12:11 -05:00
parent 612f1f28bf
commit 470b4ef99c
28 changed files with 962 additions and 97 deletions

View File

@@ -136,16 +136,20 @@ export const getUnassociatedPlayers = createServerFn()
);
export const getPlayerStats = createServerFn()
.inputValidator(z.string())
.inputValidator(z.object({
playerId: z.string(),
viewType: z.enum(['all', 'mainline', 'regional']).optional()
}))
.middleware([superTokensFunctionMiddleware])
.handler(async ({ data }) =>
toServerResult<PlayerStats>(async () => await pbAdmin.getPlayerStats(data))
toServerResult<PlayerStats>(async () => await pbAdmin.getPlayerStats(data.playerId, data.viewType))
);
export const getAllPlayerStats = createServerFn()
.inputValidator(z.enum(['all', 'mainline', 'regional']).optional())
.middleware([superTokensFunctionMiddleware])
.handler(async () =>
toServerResult<PlayerStats[]>(async () => await pbAdmin.getAllPlayerStats())
.handler(async ({ data }) =>
toServerResult<PlayerStats[]>(async () => await pbAdmin.getAllPlayerStats(data))
);
export const getPlayerMatches = createServerFn()