diff --git a/apps/hub-server/modules/event.ts b/apps/hub-server/modules/event.ts index 979568d5..53c6a16b 100644 --- a/apps/hub-server/modules/event.ts +++ b/apps/hub-server/modules/event.ts @@ -5,13 +5,16 @@ export const handleParticipantFinished = async ( participant: Participant, user: User, ) => { - const discordID = prisma.discordAccount.findFirst({ + const discordID = await prisma.discordAccount.findFirst({ where: { userId: user.id, }, }); - prisma.user.update({ + //TODO: Send Discord Message + //TODO: Send Email + + await prisma.user.update({ where: { id: user.id, }, @@ -23,7 +26,7 @@ export const handleParticipantFinished = async ( }, }); - prisma.participant.update({ + await prisma.participant.update({ where: { id: participant.id, }, diff --git a/apps/hub/app/(app)/admin/event/_components/AppointmentModal.tsx b/apps/hub/app/(app)/admin/event/_components/AppointmentModal.tsx index 2032a60a..b4f36d59 100644 --- a/apps/hub/app/(app)/admin/event/_components/AppointmentModal.tsx +++ b/apps/hub/app/(app)/admin/event/_components/AppointmentModal.tsx @@ -7,7 +7,7 @@ import { ParticipantOptionalDefaultsSchema, } from "@repo/db/zod"; import { useSession } from "next-auth/react"; -import { Controller, useForm } from "react-hook-form"; +import { Controller, useForm, UseFormReturn } from "react-hook-form"; import { deleteAppoinement, upsertAppointment } from "../action"; import { Button } from "../../../../_components/ui/Button"; import { @@ -23,21 +23,21 @@ interface AppointmentModalProps { event?: Event; ref: RefObject; appointmentsTableRef: React.RefObject; + appointmentForm: UseFormReturn< + EventAppointmentOptionalDefaults, + any, + undefined + >; } export const AppointmentModal = ({ event, ref, appointmentsTableRef, + appointmentForm, }: AppointmentModalProps) => { const { data: session } = useSession(); - const appointmentForm = useForm({ - resolver: zodResolver(EventAppointmentOptionalDefaultsSchema), - defaultValues: { - eventId: event?.id, - presenterId: session?.user?.id, - }, - }); + const participantTableRef = useRef(null); const participantForm = useForm({ resolver: zodResolver(ParticipantOptionalDefaultsSchema), @@ -129,7 +129,7 @@ export const AppointmentModal = ({ }} include={{ User: true }} leftOfPagination={ -
+
@@ -187,7 +187,10 @@ export const AppointmentModal = ({

Verlauf

{participantForm.watch("statusLog").map((s) => { return ( -
+

{(s as any).event}

{new Date((s as any).timestamp).toLocaleString()}

diff --git a/apps/hub/app/(app)/admin/event/_components/Form.tsx b/apps/hub/app/(app)/admin/event/_components/Form.tsx index e07d7c6d..cfc905d2 100644 --- a/apps/hub/app/(app)/admin/event/_components/Form.tsx +++ b/apps/hub/app/(app)/admin/event/_components/Form.tsx @@ -54,16 +54,14 @@ export const Form = ({ event }: { event?: Event }) => { }, }); const appointmentsTableRef = useRef(null); - const participantTableRef = useRef(null); const [loading, setLoading] = useState(false); const [deleteLoading, setDeleteLoading] = useState(false); const appointmentModal = useRef(null); - const participantForm = useForm({ - resolver: zodResolver(ParticipantOptionalDefaultsSchema), - }); + return ( <>