Added appointment table

This commit is contained in:
PxlLoewe
2025-02-22 17:39:22 +01:00
parent 8e1e9a67be
commit 00efe207b2
7 changed files with 192 additions and 38 deletions

View File

@@ -1,6 +1,6 @@
'use server';
import { prisma, Prisma, Event, Participant } from '@repo/db';
import { prisma, Prisma, Event, Participant, EventAppointment } from '@repo/db';
export const upsertEvent = async (
event: Prisma.EventCreateInput,
@@ -19,6 +19,26 @@ export const deleteEvent = async (id: Event['id']) => {
await prisma.event.delete({ where: { id: id } });
};
export const upsertAppointment = async (
eventAppointment: Prisma.XOR<
Prisma.EventAppointmentCreateInput,
Prisma.EventAppointmentUncheckedCreateInput
>,
id?: EventAppointment['id']
) => {
const newEventAppointment = id
? await prisma.eventAppointment.update({
where: { id: id },
data: eventAppointment,
})
: await prisma.eventAppointment.create({ data: eventAppointment });
return newEventAppointment;
};
export const deleteAppoinement = async (id: Event['id']) => {
await prisma.eventAppointment.delete({ where: { id: id } });
};
export const upsertParticipant = async (
participant: Prisma.ParticipantCreateInput,
id?: Participant['id']