added select form

This commit is contained in:
PxlLoewe
2025-02-21 22:51:10 +01:00
parent 30af30bd1d
commit 3fd0e991fd
13 changed files with 716 additions and 53 deletions

View File

@@ -1,6 +1,6 @@
'use server';
import { prisma, Prisma, Event } from '@repo/db';
import { prisma, Prisma, Event, Participant } from '@repo/db';
export const upsertEvent = async (
event: Prisma.EventCreateInput,
@@ -18,3 +18,20 @@ export const upsertEvent = async (
export const deleteEvent = async (id: Event['id']) => {
await prisma.event.delete({ where: { id: id } });
};
export const upsertParticipant = async (
participant: Prisma.ParticipantCreateInput,
id?: Participant['id']
) => {
const newParticipant = id
? await prisma.participant.update({
where: { id: id },
data: participant,
})
: await prisma.participant.create({ data: participant });
return newParticipant;
};
export const deleteParticipant = async (id: Participant['id']) => {
await prisma.participant.delete({ where: { id: id } });
};