From 8fa1d41639f3a94e1c51b6551654a93fe4592042 Mon Sep 17 00:00:00 2001 From: Chaoscaot Date: Sat, 20 Dec 2025 19:03:36 +0100 Subject: [PATCH] fix: Replace ResponseUserSchema with PlayerSchema in auth and event repositories --- src/components/repo/authv2.ts | 6 +++--- src/components/repo/event.ts | 6 +++--- src/components/types/event.ts | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/components/repo/authv2.ts b/src/components/repo/authv2.ts index b44f771..1ca1cbb 100644 --- a/src/components/repo/authv2.ts +++ b/src/components/repo/authv2.ts @@ -18,7 +18,7 @@ */ import { readable, writable } from "svelte/store"; -import { ResponseUserSchema } from "@components/types/data"; +import { PlayerSchema } from "@components/types/data"; export class AuthV2Repo { constructor() { @@ -42,7 +42,7 @@ export class AuthV2Repo { }), }) .then((value) => value.json()) - .then((value) => ResponseUserSchema.parse(value)); + .then((value) => PlayerSchema.parse(value)); loggedIn.set(true); @@ -62,7 +62,7 @@ export class AuthV2Repo { }, }) .then((value) => value.json()) - .then((value) => ResponseUserSchema.parse(value)); + .then((value) => PlayerSchema.parse(value)); loggedIn.set(true); return true; } catch (e) { diff --git a/src/components/repo/event.ts b/src/components/repo/event.ts index 96a8eaa..ddbf1d3 100644 --- a/src/components/repo/event.ts +++ b/src/components/repo/event.ts @@ -36,7 +36,7 @@ import type { CreateEventGroup, UpdateEventGroup, CreateEventRelation, UpdateEve import { z } from "zod"; import type { Dayjs } from "dayjs"; import { derived } from "svelte/store"; -import { ResponseUserSchema } from "@components/types/data"; +import { PlayerSchema, type Player } from "@components/types/data"; export interface CreateEvent { name: string; @@ -247,10 +247,10 @@ export class EventRepo { } // Referees - public async listReferees(eventId: string): Promise { + public async listReferees(eventId: string): Promise { return await fetchWithToken(this.token, `/events/${eventId}/referees`) .then((value) => value.json()) - .then((value) => z.array(ResponseUserSchema).parse(value)); + .then((value) => z.array(PlayerSchema).parse(value)); } public async updateReferees(eventId: string, refereeUuids: string[]): Promise { const res = await fetchWithToken(this.token, `/events/${eventId}/referees`, { diff --git a/src/components/types/event.ts b/src/components/types/event.ts index 72776b1..0c9f2d2 100644 --- a/src/components/types/event.ts +++ b/src/components/types/event.ts @@ -19,7 +19,7 @@ import { z } from "zod"; import { TeamSchema } from "./team.js"; -import { PlayerSchema, ResponseUserSchema } from "./data.js"; +import { PlayerSchema } from "./data.js"; export const ResponseGroupsSchema = z.object({ id: z.number(),