feat: add update and delete functionality for courses, events, and species; enhance attendance tracking and category creation
Some checks failed
Workflow / ʦ TypeScript (push) Failing after 4m53s
Workflow / ⚫️ Test (push) Has been skipped

This commit is contained in:
T. Zehetbauer
2026-04-01 16:03:50 +02:00
parent 7b078f298b
commit c6b2824da8
48 changed files with 2036 additions and 390 deletions

View File

@@ -0,0 +1,53 @@
import { createCourseManagementApi } from '@kit/course-management/api';
import { CreateCourseForm } from '@kit/course-management/components';
import { getSupabaseServerClient } from '@kit/supabase/server-client';
import { AccountNotFound } from '~/components/account-not-found';
import { CmsPageShell } from '~/components/cms-page-shell';
interface PageProps {
params: Promise<{ account: string; courseId: string }>;
}
export default async function EditCoursePage({ params }: PageProps) {
const { account, courseId } = await params;
const client = getSupabaseServerClient();
const { data: acct } = await client
.from('accounts')
.select('id')
.eq('slug', account)
.single();
if (!acct) return <AccountNotFound />;
const api = createCourseManagementApi(client);
const course = await api.getCourse(courseId);
if (!course) return <AccountNotFound />;
const c = course as Record<string, unknown>;
return (
<CmsPageShell account={account} title={`${String(c.name)} — Bearbeiten`}>
<CreateCourseForm
accountId={acct.id}
account={account}
courseId={courseId}
initialData={{
courseNumber: String(c.course_number ?? ''),
name: String(c.name ?? ''),
description: String(c.description ?? ''),
startDate: String(c.start_date ?? ''),
endDate: String(c.end_date ?? ''),
fee: Number(c.fee ?? 0),
reducedFee: Number(c.reduced_fee ?? 0),
capacity: Number(c.capacity ?? 20),
minParticipants: Number(c.min_participants ?? 5),
status: String(c.status ?? 'planned'),
registrationDeadline: String(c.registration_deadline ?? ''),
notes: String(c.notes ?? ''),
}}
/>
</CmsPageShell>
);
}