fix: Replace ResponseUserSchema with PlayerSchema in auth and event repositories
Some checks failed
SteamWarCI Build failed

This commit is contained in:
2025-12-20 19:03:36 +01:00
parent f13305d116
commit 8fa1d41639
3 changed files with 7 additions and 7 deletions

View File

@@ -18,7 +18,7 @@
*/ */
import { readable, writable } from "svelte/store"; import { readable, writable } from "svelte/store";
import { ResponseUserSchema } from "@components/types/data"; import { PlayerSchema } from "@components/types/data";
export class AuthV2Repo { export class AuthV2Repo {
constructor() { constructor() {
@@ -42,7 +42,7 @@ export class AuthV2Repo {
}), }),
}) })
.then((value) => value.json()) .then((value) => value.json())
.then((value) => ResponseUserSchema.parse(value)); .then((value) => PlayerSchema.parse(value));
loggedIn.set(true); loggedIn.set(true);
@@ -62,7 +62,7 @@ export class AuthV2Repo {
}, },
}) })
.then((value) => value.json()) .then((value) => value.json())
.then((value) => ResponseUserSchema.parse(value)); .then((value) => PlayerSchema.parse(value));
loggedIn.set(true); loggedIn.set(true);
return true; return true;
} catch (e) { } catch (e) {

View File

@@ -36,7 +36,7 @@ import type { CreateEventGroup, UpdateEventGroup, CreateEventRelation, UpdateEve
import { z } from "zod"; import { z } from "zod";
import type { Dayjs } from "dayjs"; import type { Dayjs } from "dayjs";
import { derived } from "svelte/store"; import { derived } from "svelte/store";
import { ResponseUserSchema } from "@components/types/data"; import { PlayerSchema, type Player } from "@components/types/data";
export interface CreateEvent { export interface CreateEvent {
name: string; name: string;
@@ -247,10 +247,10 @@ export class EventRepo {
} }
// Referees // Referees
public async listReferees(eventId: string): Promise<ResponseUser[]> { public async listReferees(eventId: string): Promise<Player[]> {
return await fetchWithToken(this.token, `/events/${eventId}/referees`) return await fetchWithToken(this.token, `/events/${eventId}/referees`)
.then((value) => value.json()) .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<boolean> { public async updateReferees(eventId: string, refereeUuids: string[]): Promise<boolean> {
const res = await fetchWithToken(this.token, `/events/${eventId}/referees`, { const res = await fetchWithToken(this.token, `/events/${eventId}/referees`, {

View File

@@ -19,7 +19,7 @@
import { z } from "zod"; import { z } from "zod";
import { TeamSchema } from "./team.js"; import { TeamSchema } from "./team.js";
import { PlayerSchema, ResponseUserSchema } from "./data.js"; import { PlayerSchema } from "./data.js";
export const ResponseGroupsSchema = z.object({ export const ResponseGroupsSchema = z.object({
id: z.number(), id: z.number(),