euh lots of changes nothing works ahhh

This commit is contained in:
unurled 2025-07-14 01:09:42 +02:00
parent 95d8988876
commit 36b937c5b6
Signed by: unurled
GPG key ID: EFC5F5E709B47DDD
246 changed files with 1758 additions and 1443 deletions

View file

@ -0,0 +1,31 @@
import { getCompetition } from '@/lib/server/db/queries/competitions';
import { getRound } from '@/lib/server/db/queries/rounds';
import type { PageServerLoad } from './$types';
export const load: PageServerLoad = async ({ params, locals }) => {
const competitionId = params.id;
const roundId = params.round_id;
const { user } = locals;
if (!user) {
throw new Error('Unauthorized');
}
if (competitionId === '') {
throw new Error('Invalid competition id');
}
if (roundId === '') {
throw new Error('Invalid round id');
}
const competition = await getCompetition(competitionId);
if (!competition) {
throw new Error('Invalid competition');
}
if (competition.owner !== locals.user.id) {
throw new Error('Unauthorized');
}
const round = await getRound(competitionId, roundId);
if (!round) {
throw new Error('Invalid round');
}
return { competition: competition, round };
};

View file

@ -0,0 +1,7 @@
<script lang="ts">
import type { PageProps } from './$types';
let { data }: PageProps = $props();
</script>
{JSON.stringify(data)}